Skip to content

Commit 7742845

Browse files
committed
Test adjustments and improvements.
* Reducing code duplication * Using import destructuring. * Ignoring integration test file output. * Changing package 'test' script to not use hashbang execution. * Explicitly requiring jake rather than relying on global import * Fixing integration tests to run on Windows.
1 parent 1c481a0 commit 7742845

19 files changed

+1686
-1086
lines changed

package-lock.json

Lines changed: 1212 additions & 651 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"lint": "eslint --format codeframe \"lib/**/*.js\" \"test/**/*.js\"",
1919
"lint:fix": "eslint --fix \"lib/**/*.js\" \"test/**/*.js\"",
20-
"test": "./bin/cli.js test",
20+
"test": "node ./bin/cli.js test",
2121
"test:ci": "npm run lint && npm run test"
2222
},
2323
"repository": {

test/integration/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.txt
2+
*.json
3+
*.tar.gz

test/integration/concurrent.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
let assert = require('assert');
2-
let exec = require('child_process').execSync;
3-
4-
const PROJECT_DIR = process.env.PROJECT_DIR;
5-
const JAKE_CMD = `${PROJECT_DIR}/bin/cli.js`;
2+
let { execJake } = require('./helpers')
63

74
suite('concurrent', function () {
85

96
this.timeout(7000);
107

118
test(' simple concurrent prerequisites 1', function () {
12-
let out = exec(`${JAKE_CMD} -q concurrent:simple1`).toString().trim()
9+
let out = execJake('-q concurrent:simple1')
1310
assert.equal('Started A\nStarted B\nFinished B\nFinished A', out);
1411
});
1512

1613
test(' simple concurrent prerequisites 2', function () {
17-
let out = exec(`${JAKE_CMD} -q concurrent:simple2`).toString().trim()
14+
let out = execJake('-q concurrent:simple2')
1815
assert.equal('Started C\nStarted D\nFinished C\nFinished D', out);
1916
});
2017

2118
test(' sequential concurrent prerequisites', function () {
22-
let out = exec(`${JAKE_CMD} -q concurrent:seqconcurrent`).toString().trim()
19+
let out = execJake('-q concurrent:seqconcurrent')
2320
assert.equal('Started A\nStarted B\nFinished B\nFinished A\nStarted C\nStarted D\nFinished C\nFinished D', out);
2421
});
2522

2623
test(' concurrent concurrent prerequisites', function () {
27-
let out = exec(`${JAKE_CMD} -q concurrent:concurrentconcurrent`).toString().trim()
24+
let out = execJake('-q concurrent:concurrentconcurrent')
2825
assert.equal('Started A\nStarted B\nStarted C\nStarted D\nFinished B\nFinished C\nFinished A\nFinished D', out);
2926
});
3027

3128
test(' concurrent prerequisites with subdependency', function () {
32-
let out = exec(`${JAKE_CMD} -q concurrent:subdep`).toString().trim()
29+
let out = execJake('-q concurrent:subdep')
3330
assert.equal('Started A\nFinished A\nStarted Ba\nFinished Ba', out);
3431
});
3532

3633
test(' failing in concurrent prerequisites', function () {
3734
try {
38-
exec(`${JAKE_CMD} -q concurrent:Cfail`);
35+
execJake('-q concurrent:Cfail');
3936
}
4037
catch(err) {
4138
assert(err.message.indexOf('Command failed') > -1);

0 commit comments

Comments
 (0)