|
| 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