-
Notifications
You must be signed in to change notification settings - Fork 504
/
tsdx-build-invalid.test.js
42 lines (33 loc) · 1.22 KB
/
tsdx-build-invalid.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const shell = require('shelljs');
const util = require('../utils/fixture');
const { execWithCache } = require('../utils/shell');
shell.config.silent = false;
const testDir = 'e2e';
const fixtureName = 'build-invalid';
const stageName = `stage-${fixtureName}`;
describe('tsdx build :: invalid build', () => {
beforeAll(() => {
util.teardownStage(stageName);
util.setupStageWithFixture(testDir, stageName, fixtureName);
});
it('should fail gracefully with exit code 1 when build failed', () => {
const output = execWithCache('node ../dist/index.js build');
expect(output.code).toBe(1);
});
it('should only transpile and not type check', () => {
const output = execWithCache('node ../dist/index.js build --transpileOnly');
expect(shell.test('-f', 'dist/index.js')).toBeTruthy();
expect(
shell.test('-f', 'dist/build-invalid.cjs.development.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-invalid.cjs.production.min.js')
).toBeTruthy();
expect(shell.test('-f', 'dist/build-invalid.esm.js')).toBeTruthy();
expect(shell.test('-f', 'dist/index.d.ts')).toBeTruthy();
expect(output.code).toBe(0);
});
afterAll(() => {
util.teardownStage(stageName);
});
});