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

Test on Node.js 8 #882

Merged
merged 4 commits into from Nov 10, 2020
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -48,3 +48,29 @@ jobs:
if: ${{ matrix.coverage }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-legacy:
name: Test - ubuntu-latest - Node v8.9, Webpack 4
runs-on: ubuntu-latest
env:
YARN_NODE_LINKER: node-modules
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install dependencies
run: yarn
- name: Install webpack 4
run: yarn add -D webpack@4
- name: Build babel-loader
run: yarn run build
env:
BABEL_ENV: test
- name: Use Node.js 8.9
uses: actions/setup-node@v1
with:
node-version: '8.9'
- name: Run tests for webpack version 4
run: node scripts/test-legacy

1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@ test/output
!.yarn/releases
.pnp.*
.vscode
scripts/test-legacy-source/output
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
],
"main": "lib/index.js",
"engines": {
"node": ">= 6.9"
"node": ">= 8.9"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a breaking change in #822, but no one complained 🤷
We can make it work if someone opens an issue.

Also, AVA doesn't work on Node.js 8 so I'm running a smaller single test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema-utils, introduced in that PR, uses some syntax that is not supported on Node.js 6.

},
"dependencies": {
"find-cache-dir": "^2.1.0",
Expand Down
1 change: 1 addition & 0 deletions scripts/test-legacy-source/input.js
@@ -0,0 +1 @@
class App {}
52 changes: 52 additions & 0 deletions scripts/test-legacy.js
@@ -0,0 +1,52 @@
const webpack = require("webpack");
const path = require("path");
const fs = require("fs");
const assert = require("assert");

const babelLoader = path.join(__dirname, "../lib");

const config = {
mode: "development",
entry: path.join(__dirname, "test-legacy-source/input.js"),
output: {
path: path.join(__dirname, "test-legacy-source/output"),
},
module: {
rules: [
{
test: /\.jsx?/,
loader: babelLoader,
options: {
presets: ["@babel/preset-env"],
},
exclude: /node_modules/,
},
],
},
};

webpack(config, (err, stats) => {
assert.strictEqual(err, null);
assert.deepStrictEqual(stats.compilation.errors, []);
assert.deepStrictEqual(stats.compilation.warnings, []);

fs.readdir(path.join(__dirname, "test-legacy-source/output"), (err, files) => {
assert.strictEqual(err, null);
assert.strictEqual(files.length, 1);
fs.readFile(path.join(__dirname, "test-legacy-source/output", files[0]), (err, data) => {
assert.strictEqual(err, null);
const test = "var App = function App()";
const subject = data.toString();

assert.notStrictEqual(subject.indexOf(test), -1);

console.log("DONE");
clearTimeout(timeout);
});
});
});

const timeout = setTimeout(() => {
console.error("TIMEOUT");
process.exit(1);
}, 10 * 1000);