Skip to content

Commit b38429f

Browse files
authoredApr 7, 2022
integrationTests/node: fix crash on Mac with M1 by using docker (#3530)
1 parent 15040d0 commit b38429f

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed
 

‎integrationTests/integration-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Integration Tests', () => {
4040
// TODO: figure out a way to run it with --ignore-scripts
4141
exec('npm --quiet install', { cwd, stdio: 'inherit' });
4242
exec('npm --quiet test', { cwd, stdio: 'inherit' });
43-
}).timeout(60000);
43+
}).timeout(120000);
4444
}
4545

4646
testOnNodeProject('ts');

‎integrationTests/node/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"test": "node test.js"
66
},
77
"dependencies": {
8-
"graphql": "file:../graphql.tgz",
9-
"node-12": "npm:node@12.x.x",
10-
"node-14": "npm:node@14.x.x",
11-
"node-16": "npm:node@16.x.x",
12-
"node-17": "npm:node@17.x.x"
8+
"graphql": "file:../graphql.tgz"
139
}
1410
}

‎integrationTests/node/test.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
'use strict';
22

3-
const path = require('path');
43
const childProcess = require('child_process');
54

6-
const { dependencies } = require('./package.json');
5+
const graphqlPackageJSON = require('graphql/package.json');
76

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

1212
for (const version of nodeVersions) {
13-
console.log(`Testing on ${version} ...`);
13+
console.log(`Testing on node@${version} ...`);
1414

15-
const nodePath = path.join(__dirname, 'node_modules', version, 'bin/node');
16-
childProcess.execSync(nodePath + ' index.js', { stdio: 'inherit' });
15+
childProcess.execSync(
16+
`docker run --rm --volume "$PWD":/usr/src/app -w /usr/src/app node:${version}-slim node ./index.js`,
17+
{ stdio: 'inherit' },
18+
);
1719
}

‎package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"graphql-js"
2828
],
2929
"engines": {
30-
"node": "^12.22.0 || ^14.16.0 || >=16.0.0"
30+
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
3131
},
3232
"scripts": {
3333
"preversion": ". ./resources/checkgit.sh && npm ci --ignore-scripts",

0 commit comments

Comments
 (0)
Please sign in to comment.