|
1 | 1 | 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') |
6 | 3 |
|
7 | 4 | suite('concurrent', function () { |
8 | 5 |
|
9 | 6 | this.timeout(7000); |
10 | 7 |
|
11 | 8 | test(' simple concurrent prerequisites 1', function () { |
12 | | - let out = exec(`${JAKE_CMD} -q concurrent:simple1`).toString().trim() |
| 9 | + let out = execJake('-q concurrent:simple1') |
13 | 10 | assert.equal('Started A\nStarted B\nFinished B\nFinished A', out); |
14 | 11 | }); |
15 | 12 |
|
16 | 13 | test(' simple concurrent prerequisites 2', function () { |
17 | | - let out = exec(`${JAKE_CMD} -q concurrent:simple2`).toString().trim() |
| 14 | + let out = execJake('-q concurrent:simple2') |
18 | 15 | assert.equal('Started C\nStarted D\nFinished C\nFinished D', out); |
19 | 16 | }); |
20 | 17 |
|
21 | 18 | test(' sequential concurrent prerequisites', function () { |
22 | | - let out = exec(`${JAKE_CMD} -q concurrent:seqconcurrent`).toString().trim() |
| 19 | + let out = execJake('-q concurrent:seqconcurrent') |
23 | 20 | assert.equal('Started A\nStarted B\nFinished B\nFinished A\nStarted C\nStarted D\nFinished C\nFinished D', out); |
24 | 21 | }); |
25 | 22 |
|
26 | 23 | test(' concurrent concurrent prerequisites', function () { |
27 | | - let out = exec(`${JAKE_CMD} -q concurrent:concurrentconcurrent`).toString().trim() |
| 24 | + let out = execJake('-q concurrent:concurrentconcurrent') |
28 | 25 | assert.equal('Started A\nStarted B\nStarted C\nStarted D\nFinished B\nFinished C\nFinished A\nFinished D', out); |
29 | 26 | }); |
30 | 27 |
|
31 | 28 | test(' concurrent prerequisites with subdependency', function () { |
32 | | - let out = exec(`${JAKE_CMD} -q concurrent:subdep`).toString().trim() |
| 29 | + let out = execJake('-q concurrent:subdep') |
33 | 30 | assert.equal('Started A\nFinished A\nStarted Ba\nFinished Ba', out); |
34 | 31 | }); |
35 | 32 |
|
36 | 33 | test(' failing in concurrent prerequisites', function () { |
37 | 34 | try { |
38 | | - exec(`${JAKE_CMD} -q concurrent:Cfail`); |
| 35 | + execJake('-q concurrent:Cfail'); |
39 | 36 | } |
40 | 37 | catch(err) { |
41 | 38 | assert(err.message.indexOf('Command failed') > -1); |
|
0 commit comments