From 90517c67f2c5b61beca9fd679782ef5134aef474 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Thu, 7 Apr 2022 17:19:30 +0300 Subject: [PATCH] integrationTests/node: fix crash on Mac with M1 by using docker --- integrationTests/integration-test.js | 2 +- integrationTests/node/package.json | 6 +----- integrationTests/node/test.js | 14 +++++++++----- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/integrationTests/integration-test.js b/integrationTests/integration-test.js index 91d1575b0d8..41718d0605c 100644 --- a/integrationTests/integration-test.js +++ b/integrationTests/integration-test.js @@ -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'); diff --git a/integrationTests/node/package.json b/integrationTests/node/package.json index 87f399e73f4..e4e8d36d977 100644 --- a/integrationTests/node/package.json +++ b/integrationTests/node/package.json @@ -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" } } diff --git a/integrationTests/node/test.js b/integrationTests/node/test.js index 94cc957b471..318618c7b8a 100644 --- a/integrationTests/node/test.js +++ b/integrationTests/node/test.js @@ -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' }, + ); } diff --git a/package-lock.json b/package-lock.json index 49dc7c3f80a..61f83a9af18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "url-loader": "4.1.1" }, "engines": { - "node": "^12.22.0 || ^14.16.0 || >=16.0.0" + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, "node_modules/@algolia/autocomplete-core": { diff --git a/package.json b/package.json index 2f41494b40b..f0c7062af15 100644 --- a/package.json +++ b/package.json @@ -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",