Skip to content

Commit 8ec9e09

Browse files
Modify test infrastructure and grunt tasks
As common lib is now a separate npm package, it has its own tests, that must be run when executing `grunt test` or `npm test` in nativescript-cli. Modify test command in package.json in order to run the tests. Change Gruntfile.js in order to ignore/build the correct typescript files in common lib. Add Bluebird as dependency as it is required for common lib. Update mocha version. Remove `chai` and `mocha` definitions as they are part of common lib now. Update some dev dependencies.
1 parent 604189a commit 8ec9e09

File tree

6 files changed

+22
-411
lines changed

6 files changed

+22
-411
lines changed

Gruntfile.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
var util = require("util");
2-
31
var now = new Date().toISOString();
42

53
function shallowCopy(obj) {
@@ -14,6 +12,13 @@ var travis = process.env["TRAVIS"];
1412
var buildNumber = process.env["TRAVIS_BUILD_NUMBER"] || process.env["BUILD_NUMBER"] || "non-ci";
1513

1614
module.exports = function(grunt) {
15+
var path = require("path");
16+
var commonLibNodeModules = path.join("lib", "common", "node_modules");
17+
if(require("fs").existsSync(commonLibNodeModules)) {
18+
grunt.file.delete(commonLibNodeModules);
19+
}
20+
grunt.file.write(path.join("lib", "common", ".d.ts"), "");
21+
1722
grunt.initConfig({
1823
copyPackageTo: process.env["CopyPackageTo"] || ".",
1924

@@ -22,29 +27,29 @@ module.exports = function(grunt) {
2227
dateString: now.substr(0, now.indexOf("T")),
2328

2429
pkg: grunt.file.readJSON("package.json"),
25-
2630
ts: {
2731
options: {
2832
target: 'es5',
2933
module: 'commonjs',
3034
sourceMap: true,
3135
declaration: false,
3236
removeComments: false,
33-
noImplicitAny: true
37+
noImplicitAny: true,
38+
experimentalDecorators: true
3439
},
3540

3641
devlib: {
37-
src: ["lib/**/*.ts"],
42+
src: ["lib/**/*.ts", "!lib/common/node_modules/**/*.ts"],
3843
reference: "lib/.d.ts"
3944
},
4045

4146
devall: {
42-
src: ["lib/**/*.ts", "test/**/*.ts"],
47+
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "lib/common/test/unit-tests/**/*.ts", "definitions/**/*.ts", "!lib/common/test/.d.ts"],
4348
reference: "lib/.d.ts"
4449
},
4550

4651
release_build: {
47-
src: ["lib/**/*.ts", "test/**/*.ts"],
52+
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts"],
4853
reference: "lib/.d.ts",
4954
options: {
5055
sourceMap: false,
@@ -55,7 +60,7 @@ module.exports = function(grunt) {
5560

5661
watch: {
5762
devall: {
58-
files: ["lib/**/*.ts", 'test/**/*.ts'],
63+
files: ["lib/**/*.ts", 'test/**/*.ts', "!lib/common/node_modules/**/*.ts"],
5964
tasks: [
6065
'ts:devall',
6166
'shell:npm_test'
@@ -105,7 +110,7 @@ module.exports = function(grunt) {
105110
},
106111

107112
clean: {
108-
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/common/vendor/*.js", "*.tgz"]
113+
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/common/vendor/*.js", "!lib/common/**/*.json", "!lib/common/Gruntfile.js", "!lib/common/node_modules/**/*", "!lib/common/hooks/**/*.js", "!lib/common/bin/*.js", "*.tgz"]
109114
}
110115
});
111116

lib/common

Submodule common updated 89 files

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"main": "./lib/nativescript-cli.js",
1212
"scripts": {
13-
"test": "node_modules\\.bin\\_mocha --ui mocha-fibers --recursive --reporter spec --require test/test-bootstrap.js --timeout 60000 test/",
13+
"test": "node_modules\\.bin\\_mocha --ui mocha-fibers --recursive --reporter spec --require test/test-bootstrap.js --timeout 60000 test/ lib/common/test/unit-tests",
1414
"postinstall": "node postinstall.js",
1515
"preuninstall": "node preuninstall.js"
1616
},
@@ -24,6 +24,7 @@
2424
"mobile"
2525
],
2626
"dependencies": {
27+
"bluebird": "2.9.34",
2728
"bplist-parser": "0.1.0",
2829
"broccoli": "0.16.4",
2930
"broccoli-funnel": "0.2.3",
@@ -81,12 +82,12 @@
8182
"devDependencies": {
8283
"chai": "1.8.x",
8384
"grunt": "0.4.5",
84-
"grunt-contrib-clean": "0.5.0",
85-
"grunt-contrib-copy": "0.5.0",
86-
"grunt-contrib-watch": "0.5.3",
87-
"grunt-shell": "0.6.4",
85+
"grunt-contrib-clean": "0.6.0",
86+
"grunt-contrib-copy": "0.8.0",
87+
"grunt-contrib-watch": "0.6.1",
88+
"grunt-shell": "1.1.2",
8889
"grunt-ts": "4.2.0",
89-
"mocha": "1.21.4",
90+
"mocha": "2.2.5",
9091
"mocha-fibers": "https://github.com/Icenium/mocha-fibers/tarball/master",
9192
"should": "7.0.2",
9293
"typescript": "1.5.3"

test/.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/// <reference path="../lib/.d.ts" />
2-
/// <reference path="./definitions/mocha.d.ts" />
32
/// <reference path="./definitions/should.d.ts" />
4-

test/definitions/chai.d.ts

-283
This file was deleted.

0 commit comments

Comments
 (0)