Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
testRun.stdout.pipe(process.stdout);
testRun.stderr.pipe(process.stderr);
testRun.on('close', (exitCode) => {
if (exitCode === 0) {
resolve();
} else {
reject(new Error('Failed to run integration tests'));
}
});
});
}
// Create a production-like environment in a temporarily created directory
// and then run the integration tests on it.
tmp
.withDir((tmpDir) => {
const tmpDirPath = tmpDir.path;
const unpackedDirPath = path.join(tmpDirPath, 'package');
return createPackage(tmpDirPath)
.then((archiveFilePath) => unpackTarPackage(archiveFilePath, tmpDirPath))
.then(() => installPackageDeps(unpackedDirPath))
.then(() => runIntegrationTests(unpackedDirPath));
}, tmpOptions)
.catch((err) => {
console.error(err.stack ? chalk.red(err.stack) : chalk.red(err));
process.exit(1);
});