Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: skip installation test if GOOGLE_CLOUD_TESTS_IN_VPCSC is passed #345

Merged
merged 12 commits into from
Feb 15, 2019
32 changes: 20 additions & 12 deletions system-test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,30 @@ import {ncp} from 'ncp';
import * as tmp from 'tmp';
import {promisify} from 'util';

const RUNNING_IN_VPCSC = !!process.env['GOOGLE_CLOUD_TESTS_IN_VPCSC'];

const mvp = promisify(mv) as {} as (...args: string[]) => Promise<void>;
const ncpp = promisify(ncp);
const stagingDir = tmp.dirSync({unsafeCleanup: true});
const stagingPath = stagingDir.name;
const pkg = require('../../package.json');

it('should be able to use the d.ts', async () => {
console.log(`${__filename} staging area: ${stagingPath}`);
await execa('npm', ['pack'], {stdio: 'inherit'});
const tarball = `google-cloud-bigquery-${pkg.version}.tgz`;
await mvp(tarball, `${stagingPath}/google-cloud-bigquery.tgz`);
await ncpp('system-test/fixtures/kitchen', `${stagingPath}/`);
await execa('npm', ['install'], {cwd: `${stagingPath}/`, stdio: 'inherit'});
}).timeout(40000);
describe('Installation test', () => {
before(function() {
if (RUNNING_IN_VPCSC) this.skip();
});

/**
* CLEAN UP - remove the staging directory when done.
*/
after('cleanup staging', () => stagingDir.removeCallback());
/**
* CLEAN UP - remove the staging directory when done.
*/
after('cleanup staging', () => stagingDir.removeCallback());

it('should be able to use the d.ts', async () => {
console.log(`${__filename} staging area: ${stagingPath}`);
await execa('npm', ['pack'], {stdio: 'inherit'});
const tarball = `google-cloud-bigquery-${pkg.version}.tgz`;
await mvp(tarball, `${stagingPath}/google-cloud-bigquery.tgz`);
await ncpp('system-test/fixtures/kitchen', `${stagingPath}/`);
await execa('npm', ['install'], {cwd: `${stagingPath}/`, stdio: 'inherit'});
}).timeout(40000);
});