Skip to content

Commit

Permalink
integrationTests: remove shell command for copying files (graphql#2802)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Sep 17, 2020
1 parent 16009cb commit 3b10b17
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions integrationTests/integration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const childProcess = require('child_process');
const { describe, it } = require('mocha');

function exec(command, options = {}) {
return childProcess.execSync(command, {
stdio: 'inherit',
const result = childProcess.execSync(command, {
encoding: 'utf-8',
...options,
});
return result != null ? result.trimEnd() : result;
}

describe('Integration Tests', () => {
Expand All @@ -20,14 +21,18 @@ describe('Integration Tests', () => {
fs.mkdirSync(tmpDir);

const distDir = path.resolve('./npmDist');
exec(`npm pack ${distDir} && cp graphql-*.tgz graphql.tgz`, { cwd: tmpDir });
const archiveName = exec(`npm --quiet pack ${distDir}`, { cwd: tmpDir });
fs.renameSync(
path.join(tmpDir, archiveName),
path.join(tmpDir, 'graphql.tgz'),
);

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

const cwd = path.join(tmpDir, projectName);
exec('npm install --quiet', { cwd });
exec('npm test', { cwd });
exec('npm --quiet install', { cwd, stdio: 'inherit' });
exec('npm --quiet test', { cwd, stdio: 'inherit' });
}

it('Should compile with all supported TS versions', () => {
Expand Down

0 comments on commit 3b10b17

Please sign in to comment.