Skip to content

Commit 6902c5c

Browse files
committed
add base.test.js
1 parent 471e024 commit 6902c5c

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"lint-staged": "lint-staged",
3838
"build": "rollup -c",
3939
"test": "jest test/**/*.test.js",
40-
"test:clean": "jest test/clean/clean.test.js"
40+
"test:base": "jest test/base.test.js"
4141
},
4242
"dependencies": {
4343
"chalk": "^2.4.1",

test/base.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { spawn } = require('child_process');
2+
3+
describe('base', () => {
4+
// 60s timeout
5+
jest.setTimeout(60000);
6+
7+
test('no cmd', done => {
8+
const child = spawn('node', ['test/no-cmd.js']);
9+
10+
let msg = '';
11+
12+
child.stdout.on('data', data => {
13+
msg += data.toString();
14+
});
15+
16+
child.stderr.on('data', data => {
17+
msg += data.toString();
18+
});
19+
20+
child.on('close', code => {
21+
expect(code).toBe(0);
22+
expect(msg).toBe('');
23+
done();
24+
});
25+
});
26+
});

test/no-cmd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
process.chdir(__dirname);
2+
require('./exec')('sclean');

0 commit comments

Comments
 (0)