diff --git a/packages/google-cloud-asset/samples/package.json b/packages/google-cloud-asset/samples/package.json index 38c6c9eea34..527c478b300 100644 --- a/packages/google-cloud-asset/samples/package.json +++ b/packages/google-cloud-asset/samples/package.json @@ -12,7 +12,7 @@ "repository": "googleapis/nodejs-asset", "private": true, "scripts": { - "test": "mocha system-test --timeout 20000" + "test": "mocha --timeout 20000" }, "dependencies": { "@google-cloud/asset": "^0.3.0", @@ -22,7 +22,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "execa": "^1.0.0", "mocha": "^6.0.0" } } diff --git a/packages/google-cloud-asset/samples/system-test/.eslintrc.yml b/packages/google-cloud-asset/samples/test/.eslintrc.yml similarity index 100% rename from packages/google-cloud-asset/samples/system-test/.eslintrc.yml rename to packages/google-cloud-asset/samples/test/.eslintrc.yml diff --git a/packages/google-cloud-asset/samples/system-test/quickstart.test.js b/packages/google-cloud-asset/samples/test/quickstart.test.js similarity index 84% rename from packages/google-cloud-asset/samples/system-test/quickstart.test.js rename to packages/google-cloud-asset/samples/test/quickstart.test.js index e04aa190eab..688490a1cb5 100644 --- a/packages/google-cloud-asset/samples/system-test/quickstart.test.js +++ b/packages/google-cloud-asset/samples/test/quickstart.test.js @@ -16,14 +16,13 @@ 'use strict'; const {assert} = require('chai'); -const path = require('path'); const uuid = require('uuid'); -const execa = require('execa'); +const cp = require('child_process'); const {Storage} = require('@google-cloud/storage'); -const cwd = path.join(__dirname, '..'); -const cmd = 'node quickstart.js'; +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const cmd = 'node quickstart.js'; const storage = new Storage(); const bucketName = `asset-nodejs-${uuid.v4()}`; const bucket = storage.bucket(bucketName); @@ -39,7 +38,7 @@ describe('quickstart sample tests', () => { it('should export assets to specified path', async () => { const dumpFilePath = `gs://${bucketName}/my-assets.txt`; - await execa.shell(`${cmd} export-assets ${dumpFilePath}`, {cwd}); + execSync(`${cmd} export-assets ${dumpFilePath}`); const file = await bucket.file('my-assets.txt'); const exists = await file.exists(); assert.ok(exists); @@ -48,10 +47,7 @@ describe('quickstart sample tests', () => { it('should get assets history successfully', async () => { const assetName = `//storage.googleapis.com/${bucketName}`; - const {stdout} = await execa.shell( - `${cmd} batch-get-history ${assetName}`, - {cwd} - ); + const stdout = execSync(`${cmd} batch-get-history ${assetName}`); assert.match(stdout, new RegExp(assetName)); }); });