Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix babel8 tests on windows #14928

Merged
merged 6 commits into from Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 39 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -234,10 +234,13 @@ jobs:
with:
node-version: "*"

test-babel-8-breaking:
name: Test Babel 8 breaking changes
build-babel8:
name: Build Babel 8 Artifacts for tests
needs: prepare-yarn-cache
runs-on: ubuntu-latest
# Yarn PnP does not support native ESM yet (https://github.com/yarnpkg/berry/issues/638)
# env:
# YARN_NODE_LINKER: pnp # use pnp linker for better linking performance and stricter checks
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -258,6 +261,39 @@ jobs:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
- uses: actions/upload-artifact@v3
with:
name: babel8-test-artifact
path: |
codemods/*/lib/**/*
eslint/*/lib/**/*
packages/*/lib/**/*
packages/babel-standalone/*.js
!**/node_modules/**

test-babel-8-breaking:
name: Test Babel 8 breaking changes on Node.js
needs: build-babel8
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js 14.17
uses: actions/setup-node@v3
with:
node-version: "14.17" # Node.js 14.17 is the first LTS supported by Babel 8
cache: "yarn"
- name: Install
run: |
yarn install
- uses: actions/download-artifact@v3
with:
name: babel8-test-artifact
- name: Generate runtime helpers
run: make build-plugin-transform-runtime-dist
- name: Test
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
Expand Down Expand Up @@ -287,8 +323,7 @@ jobs:
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
run: make build-plugin-transform-runtime-dist
- name: Test on Windows
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
Expand Down
Expand Up @@ -12,7 +12,7 @@ var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/Reac
__source: {
fileName: _jsxFileName,
lineNumber: 4,
columnNumber: 9
columnNumber: 7
}
}), /*#__PURE__*/React.createElement("div", {
key: "2",
Expand All @@ -21,22 +21,22 @@ var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/Reac
__source: {
fileName: _jsxFileName,
lineNumber: 5,
columnNumber: 9
columnNumber: 7
}
}), /*#__PURE__*/React.createElement("div", {
key: "3",
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 6,
columnNumber: 9
columnNumber: 7
}
}), /*#__PURE__*/React.createElement("div", { ...props,
key: "4",
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 7,
columnNumber: 9
columnNumber: 7
}
})));
@@ -0,0 +1,25 @@
{
"externalHelpers": false,
"presets": [
[
"env",
{
"corejs": 3,
"useBuiltIns": "entry"
}
]
],
"plugins": [
[
"transform-runtime",
{
"regenerator": false,
"corejs": false,
"helpers": true,
"useESModules": true,
"absoluteRuntime": true
}
]
],
"BABEL_8_BREAKING": false
}
@@ -0,0 +1,9 @@
async function test () {
console.log('test')
}

async function main () {
console.log(await test())
}

main()
Expand Up @@ -20,5 +20,6 @@
"absoluteRuntime": true
}
]
]
],
"BABEL_8_BREAKING": true
}
@@ -0,0 +1,54 @@
var _asyncToGenerator = require("<CWD>/packages/babel-runtime/helpers/asyncToGenerator.js")["default"];

function test() {
return _test.apply(this, arguments);
}

function _test() {
_test = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
console.log('test');

case 1:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _test.apply(this, arguments);
}

function main() {
return _main.apply(this, arguments);
}

function _main() {
_main = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.t0 = console;
_context2.next = 3;
return test();

case 3:
_context2.t1 = _context2.sent;

_context2.t0.log.call(_context2.t0, _context2.t1);

case 5:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _main.apply(this, arguments);
}

main();
@@ -1,5 +1,4 @@
{
"externalHelpers": false,
"os": ["linux", "darwin"],
"targets": { "browsers": "ie 6, ios 4" }
}

This file was deleted.

2 changes: 1 addition & 1 deletion packages/babel-preset-react/test/index.js
@@ -1,5 +1,5 @@
import _reactPreset from "../lib/index.js";
const reactPreset = _reactPreset.default;
const reactPreset = _reactPreset.default || _reactPreset;

describe("react preset", () => {
it("does throw clear error when no options passed for Babel 6", () => {
Expand Down