forked from jaredpalmer/tsdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsdx-build-options.test.ts
53 lines (44 loc) · 1.51 KB
/
tsdx-build-options.test.ts
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
43
44
45
46
47
48
49
50
51
52
53
import * as shell from 'shelljs';
import * as util from '../utils/fixture';
import { execWithCache } from '../utils/shell';
shell.config.silent = false;
const testDir = 'e2e';
const fixtureName = 'build-default';
// create a second version of build-default's stage for concurrent testing
const stageName = 'stage-build-options';
describe('tsdx build :: options', () => {
beforeAll(() => {
util.teardownStage(stageName);
util.setupStageWithFixture(testDir, stageName, fixtureName);
});
it('should compile all formats', () => {
const output = execWithCache(
'node ../dist/index.js build --format cjs,esm,umd,system'
);
expect(shell.test('-f', 'dist/index.js')).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.cjs.development.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.cjs.production.min.js')
).toBeTruthy();
expect(shell.test('-f', 'dist/build-default.esm.js')).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.umd.development.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.umd.production.min.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.system.development.js')
).toBeTruthy();
expect(
shell.test('-f', 'dist/build-default.system.production.min.js')
).toBeTruthy();
expect(shell.test('-f', 'dist/index.d.ts')).toBeTruthy();
expect(output.code).toBe(0);
});
afterAll(() => {
util.teardownStage(stageName);
});
});