Skip to content

Commit e2f1b76

Browse files
committed
test: add a smoke test that builds _all_ formats
- there was never a test that built all, meaning tests left out the somewhat popular UMD build in particular - per my investigation, CJS + UMD, CJS + System, UMD + System started bugging out recently due to an upstream bug, but this wasn't known proactively because there were no tests for it - and I also found that CJS + System actually was bugging out in the previous version, TSDX v0.13.3, but I'm guessing no one reported it back then as it's an unpopular combination of formats - this test fails prior to upgrade of rpts2 to v0.27.3 and succeeds after the upgrade - so this should act as a regression test against this bug as well - created a new e2e build-options test file for this because build-default is meant to have 0 options and test only the defaults - had to give it a differentiated "stage" name as it uses the same build-default fixture and so breaks during test parallelization without that - should also move the regeneratorRuntime `--target node` test here since that's an option and not a default
1 parent eaa1c3b commit e2f1b76

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import * as shell from 'shelljs';
2+
3+
import * as util from '../utils/fixture';
4+
import { execWithCache } from '../utils/shell';
5+
6+
shell.config.silent = false;
7+
8+
const testDir = 'e2e';
9+
const fixtureName = 'build-default';
10+
// create a second version of build-default's stage for concurrent testing
11+
const stageName = 'stage-build-options';
12+
13+
describe('tsdx build :: options', () => {
14+
beforeAll(() => {
15+
util.teardownStage(stageName);
16+
util.setupStageWithFixture(testDir, stageName, fixtureName);
17+
});
18+
19+
it('should compile all formats', () => {
20+
const output = execWithCache(
21+
'node ../dist/index.js build --format cjs,esm,umd,system'
22+
);
23+
24+
expect(shell.test('-f', 'dist/index.js')).toBeTruthy();
25+
expect(
26+
shell.test('-f', 'dist/build-default.cjs.development.js')
27+
).toBeTruthy();
28+
expect(
29+
shell.test('-f', 'dist/build-default.cjs.production.min.js')
30+
).toBeTruthy();
31+
expect(shell.test('-f', 'dist/build-default.esm.js')).toBeTruthy();
32+
expect(
33+
shell.test('-f', 'dist/build-default.umd.development.js')
34+
).toBeTruthy();
35+
expect(
36+
shell.test('-f', 'dist/build-default.umd.production.min.js')
37+
).toBeTruthy();
38+
expect(
39+
shell.test('-f', 'dist/build-default.system.development.js')
40+
).toBeTruthy();
41+
expect(
42+
shell.test('-f', 'dist/build-default.system.production.min.js')
43+
).toBeTruthy();
44+
45+
expect(shell.test('-f', 'dist/index.d.ts')).toBeTruthy();
46+
47+
expect(output.code).toBe(0);
48+
});
49+
50+
afterAll(() => {
51+
util.teardownStage(stageName);
52+
});
53+
});

0 commit comments

Comments
 (0)