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

integrationTests/node: fix crash on Mac with M1 by using docker #3530

Merged
merged 1 commit into from Apr 7, 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
2 changes: 1 addition & 1 deletion integrationTests/integration-test.js
Expand Up @@ -40,7 +40,7 @@ describe('Integration Tests', () => {
// TODO: figure out a way to run it with --ignore-scripts
exec('npm --quiet install', { cwd, stdio: 'inherit' });
exec('npm --quiet test', { cwd, stdio: 'inherit' });
}).timeout(60000);
}).timeout(120000);
}

testOnNodeProject('ts');
Expand Down
6 changes: 1 addition & 5 deletions integrationTests/node/package.json
Expand Up @@ -5,10 +5,6 @@
"test": "node test.js"
},
"dependencies": {
"graphql": "file:../graphql.tgz",
"node-12": "npm:node@12.x.x",
"node-14": "npm:node@14.x.x",
"node-16": "npm:node@16.x.x",
"node-17": "npm:node@17.x.x"
"graphql": "file:../graphql.tgz"
}
}
16 changes: 9 additions & 7 deletions integrationTests/node/test.js
@@ -1,17 +1,19 @@
'use strict';

const path = require('path');
const childProcess = require('child_process');

const { dependencies } = require('./package.json');
const graphqlPackageJSON = require('graphql/package.json');

const nodeVersions = Object.keys(dependencies)
.filter((pkg) => pkg.startsWith('node-'))
const nodeVersions = graphqlPackageJSON.engines.node
.split(' || ')
.map((version) => version.replace(/^(\^|>=)/, ''))
.sort((a, b) => b.localeCompare(a));

for (const version of nodeVersions) {
console.log(`Testing on ${version} ...`);
console.log(`Testing on node@${version} ...`);

const nodePath = path.join(__dirname, 'node_modules', version, 'bin/node');
childProcess.execSync(nodePath + ' index.js', { stdio: 'inherit' });
childProcess.execSync(
`docker run --rm --volume "$PWD":/usr/src/app -w /usr/src/app node:${version}-slim node ./index.js`,
{ stdio: 'inherit' },
);
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -27,7 +27,7 @@
"graphql-js"
],
"engines": {
"node": "^12.22.0 || ^14.16.0 || >=16.0.0"
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
},
"scripts": {
"preversion": ". ./resources/checkgit.sh && npm ci --ignore-scripts",
Expand Down