Skip to content

Commit

Permalink
integrationTests: small refactoring (#3262)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Sep 15, 2021
1 parent e88c58e commit ac9833e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
27 changes: 13 additions & 14 deletions integrationTests/integration-test.js
Expand Up @@ -28,22 +28,21 @@ describe('Integration Tests', () => {
);

function testOnNodeProject(projectName) {
exec(`cp -R ${path.join(__dirname, projectName)} ${tmpDir}`);
const projectPath = path.join(__dirname, projectName);

const cwd = path.join(tmpDir, projectName);
exec('npm --quiet install', { cwd, stdio: 'inherit' });
exec('npm --quiet test', { cwd, stdio: 'inherit' });
}
const packageJSONPath = path.join(projectPath, 'package.json');
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));

it('Should compile with all supported TS versions', () => {
testOnNodeProject('ts');
}).timeout(40000);
it(packageJSON.description, () => {
exec(`cp -R ${projectPath} ${tmpDir}`);

it('Should work on all supported node versions', () => {
testOnNodeProject('node');
}).timeout(40000);
const cwd = path.join(tmpDir, projectName);
exec('npm --quiet install', { cwd, stdio: 'inherit' });
exec('npm --quiet test', { cwd, stdio: 'inherit' });
}).timeout(40000);
}

it('Should be compatible with Webpack', () => {
testOnNodeProject('webpack');
}).timeout(40000);
testOnNodeProject('ts');
testOnNodeProject('node');
testOnNodeProject('webpack');
});
1 change: 1 addition & 0 deletions integrationTests/node/package.json
@@ -1,5 +1,6 @@
{
"private": true,
"description": "graphql-js should work on all supported node versions",
"scripts": {
"test": "node test.js"
},
Expand Down
1 change: 1 addition & 0 deletions integrationTests/ts/package.json
@@ -1,5 +1,6 @@
{
"private": true,
"description": "graphql-js should compile with all supported TS versions",
"scripts": {
"test": "node test.js"
},
Expand Down
1 change: 1 addition & 0 deletions integrationTests/webpack/package.json
@@ -1,5 +1,6 @@
{
"private": true,
"description": "graphql-js should be compatible with Webpack",
"scripts": {
"test": "webpack && node test.js"
},
Expand Down

0 comments on commit ac9833e

Please sign in to comment.