diff --git a/test/integration/fixtures/build-withBabel/.babelrc.js b/test/integration/fixtures/build-withBabel/.babelrc.js index 21782b135..05e08f2e8 100644 --- a/test/integration/fixtures/build-withBabel/.babelrc.js +++ b/test/integration/fixtures/build-withBabel/.babelrc.js @@ -1,5 +1,6 @@ module.exports = { plugins: [ - 'styled-components' + 'styled-components', + ['@babel/plugin-transform-runtime', { helpers: false }], ] } diff --git a/test/integration/fixtures/build-withBabel/src/generator.ts b/test/integration/fixtures/build-withBabel/src/generator.ts new file mode 100644 index 000000000..aedb252e5 --- /dev/null +++ b/test/integration/fixtures/build-withBabel/src/generator.ts @@ -0,0 +1,3 @@ +export function* testGenerator() { + return yield 'blah'; +} diff --git a/test/integration/fixtures/build-withBabel/src/index.ts b/test/integration/fixtures/build-withBabel/src/index.ts index f0887b014..345066424 100644 --- a/test/integration/fixtures/build-withBabel/src/index.ts +++ b/test/integration/fixtures/build-withBabel/src/index.ts @@ -1,5 +1,7 @@ import './styled.tsx'; +export { testGenerator } from './generator'; + export const sum = (a: number, b: number) => { if ('development' === process.env.NODE_ENV) { console.log('fuck'); diff --git a/test/integration/tsdx-build-withBabel.test.js b/test/integration/tsdx-build-withBabel.test.js index 45c70227b..72b93a1aa 100644 --- a/test/integration/tsdx-build-withBabel.test.js +++ b/test/integration/tsdx-build-withBabel.test.js @@ -32,6 +32,13 @@ describe('integration :: tsdx build :: .babelrc.js', () => { expect(output.code).toBe(1); }); + it('should add an import of regeneratorRuntime', () => { + const output = shell.grep(/@babel\/runtime\/regenerator/, [ + 'dist/build-withbabel.*.js', + ]); + expect(output.code).toBe(0); + }); + it('should compile files into a dist directory', () => { expect(shell.test('-f', 'dist/index.js')).toBeTruthy(); expect(