Skip to content

Commit 2f8544d

Browse files
committed
refactor/test: move generator test to build-default
- now that generators are supported out-of-the-box via polyfill-regenerator, this is no longer an integration test - also remove @babel/plugin-transform-runtime because it's no longer used in tests and likely not needed much either, especially if babel-polyfills is recommended for other uses like core-js - it no longer ran either since the code was already transformed by polyfill-regenerator first
1 parent 6e405d5 commit 2f8544d

9 files changed

Lines changed: 18 additions & 33 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
"typescript": "^3.7.3"
100100
},
101101
"devDependencies": {
102-
"@babel/plugin-transform-runtime": "^7.6.0",
103102
"@types/eslint": "^6.1.2",
104103
"@types/fs-extra": "^8.0.0",
105104
"@types/node": "^13.1.0",

src/createRollupConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export async function createRollupConfig(
6060
input: opts.input,
6161
// Tell Rollup which packages to ignore
6262
external: (id: string) => {
63-
// bundle in polyfills as TSDX can't (yet) ensure installed as deps
63+
// bundle in polyfills as TSDX can't (yet) ensure they're installed as deps
6464
if (id.startsWith('regenerator-runtime')) {
6565
return false;
6666
}

test/e2e/fixtures/build-default/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import './syntax/optional-chaining';
33

44
import './syntax/jsx-import/JSX-import-JSX';
55

6+
export { testGenerator } from './syntax/generator';
7+
68
export { foo } from './foo';
79

810
export const sum = (a: number, b: number) => {

test/integration/fixtures/build-withBabel/src/generator.ts renamed to test/e2e/fixtures/build-default/src/syntax/generator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// regression test for generators
12
export function* testGenerator() {
23
return yield 'blah';
34
}

test/e2e/tsdx-build-default.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as shell from 'shelljs';
22

33
import * as util from '../utils/fixture';
4-
import { execWithCache } from '../utils/shell';
4+
import { execWithCache, grep } from '../utils/shell';
55

66
shell.config.silent = false;
77

@@ -51,6 +51,14 @@ describe('tsdx build :: zero-config defaults', () => {
5151
expect(output.code).toBe(0);
5252
});
5353

54+
it('should bundle regeneratorRuntime', () => {
55+
const output = execWithCache('node ../dist/index.js build');
56+
expect(output.code).toBe(0);
57+
58+
const matched = grep(/regeneratorRuntime = r/, ['dist/build-default.*.js']);
59+
expect(matched).toBeTruthy();
60+
});
61+
5462
it('should clean the dist directory before rebuilding', () => {
5563
let output = execWithCache('node ../dist/index.js build');
5664
expect(output.code).toBe(0);

test/integration/fixtures/build-withBabel/.babelrc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@ module.exports = {
22
presets: [
33
// ensure Babel presets are merged and applied
44
'./test-babel-preset'
5-
],
6-
plugins: [
7-
['@babel/plugin-transform-runtime', { helpers: false }],
85
]
96
}

test/integration/fixtures/build-withBabel/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export { Title } from './styled';
22

3-
export { testGenerator } from './generator';
4-
53
export const sum = (a: number, b: number) => {
64
if ('development' === process.env.NODE_ENV) {
75
console.log('fuck');

test/integration/tsdx-build-withBabel.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ describe('integration :: tsdx build :: .babelrc.js', () => {
3737
expect(matched).toBeFalsy();
3838
});
3939

40-
it('should bundle regeneratorRuntime', () => {
41-
const output = execWithCache('node ../dist/index.js build');
42-
expect(output.code).toBe(0);
43-
44-
const matched = grep(/regeneratorRuntime = r/, [
45-
'dist/build-withbabel.*.js',
46-
]);
47-
expect(matched).toBeTruthy();
48-
});
49-
5040
it('should merge and apply presets', () => {
5141
const output = execWithCache('node ../dist/index.js build');
5242
expect(output.code).toBe(0);

yarn.lock

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
semver "^5.4.1"
4141
source-map "^0.5.0"
4242

43-
"@babel/generator@^7.11.0", "@babel/generator@^7.11.5", "@babel/generator@^7.9.0":
43+
"@babel/generator@^7.11.5", "@babel/generator@^7.9.0":
4444
version "7.11.6"
4545
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.11.6.tgz#b868900f81b163b4d464ea24545c61cbac4dc620"
4646
integrity sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA==
@@ -156,7 +156,7 @@
156156
dependencies:
157157
"@babel/types" "^7.11.0"
158158

159-
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.7.4":
159+
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4":
160160
version "7.10.4"
161161
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620"
162162
integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==
@@ -270,7 +270,7 @@
270270
chalk "^2.0.0"
271271
js-tokens "^4.0.0"
272272

273-
"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.11.0", "@babel/parser@^7.11.5", "@babel/parser@^7.7.5", "@babel/parser@^7.9.0":
273+
"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.11.5", "@babel/parser@^7.7.5", "@babel/parser@^7.9.0":
274274
version "7.11.5"
275275
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
276276
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==
@@ -671,16 +671,6 @@
671671
dependencies:
672672
"@babel/helper-plugin-utils" "^7.10.4"
673673

674-
"@babel/plugin-transform-runtime@^7.6.0":
675-
version "7.7.4"
676-
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.7.4.tgz#51fe458c1c1fa98a8b07934f4ed38b6cd62177a6"
677-
integrity sha512-O8kSkS5fP74Ad/8pfsCMGa8sBRdLxYoSReaARRNSz3FbFQj3z/QUvoUmJ28gn9BO93YfnXc3j+Xyaqe8cKDNBQ==
678-
dependencies:
679-
"@babel/helper-module-imports" "^7.7.4"
680-
"@babel/helper-plugin-utils" "^7.0.0"
681-
resolve "^1.8.1"
682-
semver "^5.5.1"
683-
684674
"@babel/plugin-transform-shorthand-properties@^7.10.4":
685675
version "7.10.4"
686676
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.4.tgz#9fd25ec5cdd555bb7f473e5e6ee1c971eede4dd6"
@@ -7175,7 +7165,7 @@ [email protected]:
71757165
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
71767166
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=
71777167

7178-
[email protected], [email protected], resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1:
7168+
[email protected], [email protected], resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.3.2, resolve@^1.5.0:
71797169
version "1.15.1"
71807170
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
71817171
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
@@ -7428,7 +7418,7 @@ semver-regex@^2.0.0:
74287418
resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338"
74297419
integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==
74307420

7431-
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1:
7421+
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0:
74327422
version "5.7.1"
74337423
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
74347424
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

0 commit comments

Comments
 (0)