Skip to content

Commit

Permalink
integrationTests/node: fix crash on Mac with M1 by using docker
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Apr 7, 2022
1 parent 15040d0 commit 90517c6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
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"
}
}
14 changes: 9 additions & 5 deletions integrationTests/node/test.js
Expand Up @@ -2,16 +2,20 @@

const path = require('path');
const childProcess = require('child_process');
const graphqlPackageJSON = require('graphql/package.json');

const { dependencies } = require('./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

0 comments on commit 90517c6

Please sign in to comment.