Skip to content

Commit 6fa0121

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.
1 parent 604189a commit 6fa0121

File tree

6 files changed

+16
-406
lines changed

6 files changed

+16
-406
lines changed

Gruntfile.js

+12-8
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,7 +27,6 @@ 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',
@@ -34,17 +38,17 @@ module.exports = function(grunt) {
3438
},
3539

3640
devlib: {
37-
src: ["lib/**/*.ts"],
41+
src: ["lib/**/*.ts", "!lib/common/node_modules/**/*.ts"],
3842
reference: "lib/.d.ts"
3943
},
4044

4145
devall: {
42-
src: ["lib/**/*.ts", "test/**/*.ts"],
46+
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "lib/common/test/unit-tests/**/*.ts", "definitions/**/*.ts", "!lib/common/test/.d.ts"],
4347
reference: "lib/.d.ts"
4448
},
4549

4650
release_build: {
47-
src: ["lib/**/*.ts", "test/**/*.ts"],
51+
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts"],
4852
reference: "lib/.d.ts",
4953
options: {
5054
sourceMap: false,
@@ -55,7 +59,7 @@ module.exports = function(grunt) {
5559

5660
watch: {
5761
devall: {
58-
files: ["lib/**/*.ts", 'test/**/*.ts'],
62+
files: ["lib/**/*.ts", 'test/**/*.ts', "!lib/common/node_modules/**/*.ts"],
5963
tasks: [
6064
'ts:devall',
6165
'shell:npm_test'
@@ -105,7 +109,7 @@ module.exports = function(grunt) {
105109
},
106110

107111
clean: {
108-
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/common/vendor/*.js", "*.tgz"]
112+
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"]
109113
}
110114
});
111115

lib/common

Submodule common updated 89 files

package.json

+3-2
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",
@@ -86,7 +87,7 @@
8687
"grunt-contrib-watch": "0.5.3",
8788
"grunt-shell": "0.6.4",
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)