diff --git a/test/e2e/tsdx-build-options.test.ts b/test/e2e/tsdx-build-options.test.ts new file mode 100644 index 000000000..ded530033 --- /dev/null +++ b/test/e2e/tsdx-build-options.test.ts @@ -0,0 +1,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); + }); +});