Update runtime integration tests for Node.js >= 16.6 (#13923)
This commit is contained in:
parent
76e4566bfc
commit
6393e60a68
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -391,6 +391,18 @@ jobs:
|
||||
node-version: 14.2
|
||||
- name: Test Node.js 14.2
|
||||
run: yarn test:runtime:node
|
||||
- name: Use Node.js 16.5
|
||||
uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: 16.5
|
||||
- name: Test Node.js 16.5
|
||||
run: yarn test:runtime:node
|
||||
- name: Use Node.js 16.6
|
||||
uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: 16.6
|
||||
- name: Test Node.js 16.6
|
||||
run: yarn test:runtime:node
|
||||
|
||||
e2e-publish:
|
||||
name: Publish to local Verdaccio registry
|
||||
|
||||
13
test/runtime-integration/expected-cjs-16.0.txt
Normal file
13
test/runtime-integration/expected-cjs-16.0.txt
Normal file
@ -0,0 +1,13 @@
|
||||
================= require - auto ====================
|
||||
typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
13
test/runtime-integration/expected-cjs-absolute-16.0.txt
Normal file
13
test/runtime-integration/expected-cjs-absolute-16.0.txt
Normal file
@ -0,0 +1,13 @@
|
||||
================= require - auto ====================
|
||||
typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/absolute/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
@ -3,11 +3,8 @@ typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/absolute/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
Error: require() of ES Module <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/absolute/require-esm.cjs not supported.
|
||||
Instead change the require of toPrimitive.js in <ROOT>/test/runtime-integration/src/absolute/require-esm.cjs to a dynamic import() which is available in all CommonJS modules.
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
|
||||
@ -3,11 +3,8 @@ typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
Error: require() of ES Module <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs not supported.
|
||||
Instead change the require of toPrimitive.js in <ROOT>/test/runtime-integration/src/require-esm.cjs to a dynamic import() which is available in all CommonJS modules.
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
|
||||
22
test/runtime-integration/expected-esm-16.0.txt
Normal file
22
test/runtime-integration/expected-esm-16.0.txt
Normal file
@ -0,0 +1,22 @@
|
||||
================== import - auto ====================
|
||||
typeof inheritsLoose: function
|
||||
A.__proto__ === B true
|
||||
================= import - esm ======================
|
||||
typeof toArray: function
|
||||
arr: 1,2,3
|
||||
=============== import - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
================= require - auto ====================
|
||||
typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
@ -12,11 +12,8 @@ typeof objectWithoutProperties: function
|
||||
typeof objectWithoutProperties.default: function
|
||||
obj: { b: 2, [Symbol(Symbol.toStringTag)]: 5 }
|
||||
================= require - esm =====================
|
||||
Error: Must use import to load ES Module: <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js
|
||||
require() of ES modules is not supported.
|
||||
require() of <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
||||
Instead rename toPrimitive.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <ROOT>/packages/babel-runtime/helpers/esm/package.json.
|
||||
|
||||
Error: require() of ES Module <ROOT>/packages/babel-runtime/helpers/esm/toPrimitive.js from <ROOT>/test/runtime-integration/src/require-esm.cjs not supported.
|
||||
Instead change the require of toPrimitive.js in <ROOT>/test/runtime-integration/src/require-esm.cjs to a dynamic import() which is available in all CommonJS modules.
|
||||
=============== require - corejs ====================
|
||||
typeof Set: function
|
||||
arr: 1,2,3
|
||||
|
||||
@ -10,7 +10,11 @@ if (
|
||||
(major === 13 && minor >= 2)
|
||||
) {
|
||||
const expectedEsm =
|
||||
major === 13 && minor <= 3 ? "expected-esm-13.2.txt" : "expected-esm.txt";
|
||||
major === 13 && minor <= 3
|
||||
? "expected-esm-13.2.txt"
|
||||
: major < 16 || (major === 16 && minor <= 5)
|
||||
? "expected-esm-16.0.txt"
|
||||
: "expected-esm.txt";
|
||||
|
||||
test("ESM", "./src/main-esm.mjs", expectedEsm);
|
||||
// TODO: This never worked in any Babel version
|
||||
@ -24,6 +28,8 @@ const expectedCjs =
|
||||
? "expected-cjs-13.0.txt"
|
||||
: major === 13 && minor <= 3
|
||||
? "expected-cjs-13.2.txt"
|
||||
: major < 16 || (major === 16 && minor <= 5)
|
||||
? "expected-cjs-16.0.txt"
|
||||
: "expected-cjs.txt";
|
||||
|
||||
test("CJS", "./src/main-cjs.cjs", expectedCjs);
|
||||
@ -35,6 +41,8 @@ const expectedCjsAbsolute =
|
||||
? "expected-cjs-absolute-13.0.txt"
|
||||
: major === 13 && minor <= 3
|
||||
? "expected-cjs-absolute-13.2.txt"
|
||||
: major < 16 || (major === 16 && minor <= 5)
|
||||
? "expected-cjs-absolute-16.0.txt"
|
||||
: "expected-cjs-absolute.txt";
|
||||
|
||||
test(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user