diff --git a/cloud-tasks/.eslintrc.yml b/cloud-tasks/.eslintrc.yml index 282535f55f..0aa37ac630 100644 --- a/cloud-tasks/.eslintrc.yml +++ b/cloud-tasks/.eslintrc.yml @@ -1,3 +1,4 @@ --- rules: no-console: off + node/no-missing-require: off diff --git a/cloud-tasks/package.json b/cloud-tasks/package.json index fa8baa65d6..d0a4d8e68b 100644 --- a/cloud-tasks/package.json +++ b/cloud-tasks/package.json @@ -8,7 +8,7 @@ "node": ">=8" }, "scripts": { - "test": "mocha system-test" + "test": "mocha" }, "dependencies": { "@google-cloud/tasks": "^0.5.0", @@ -17,7 +17,7 @@ "yargs": "^13.0.0" }, "devDependencies": { - "execa": "^1.0.0", + "chai": "^4.2.0", "mocha": "^6.0.0", "uuid": "^3.3.2" } diff --git a/cloud-tasks/system-test/.eslintrc.yml b/cloud-tasks/test/.eslintrc.yml similarity index 100% rename from cloud-tasks/system-test/.eslintrc.yml rename to cloud-tasks/test/.eslintrc.yml diff --git a/cloud-tasks/system-test/test.samples.js b/cloud-tasks/test/test.samples.js similarity index 58% rename from cloud-tasks/system-test/test.samples.js rename to cloud-tasks/test/test.samples.js index fbdc608960..49e880f940 100644 --- a/cloud-tasks/system-test/test.samples.js +++ b/cloud-tasks/test/test.samples.js @@ -14,31 +14,28 @@ 'use strict'; -const path = require('path'); -const assert = require('assert'); -const execa = require('execa'); +const {assert} = require('chai'); +const {execSync} = require('child_process'); const uuid = require('uuid'); const PROJECT_ID = process.env.GCLOUD_PROJECT; const queueName = `gcloud-${uuid.v4().split('-')[0]}`; -const cwd = path.join(__dirname, '..'); -const exec = cmd => execa.shell(cmd, {cwd}); describe('Cloud Task Sample Tests', () => { - it('should create a queue', async () => { - const {stdout} = await exec(`node createQueue ${PROJECT_ID} ${queueName}`); - assert.ok(stdout.includes('Created queue')); + it('should create a queue', () => { + const stdout = execSync(`node createQueue ${PROJECT_ID} ${queueName}`); + assert.match(stdout, /Created queue/); }); - it('should create a task', async () => { - const {stdout} = await exec( + it('should create a task', () => { + const stdout = execSync( `node createTask --project=${PROJECT_ID} --location=us-central1 --queue=${queueName}` ); - assert.ok(stdout.includes('Created task')); + assert.match(stdout, /Created task/); }); - it('should delete a queue', async () => { - const {stdout} = await exec(`node deleteQueue ${PROJECT_ID} ${queueName}`); - assert.ok(stdout.includes('Deleted queue')); + it('should delete a queue', () => { + const stdout = execSync(`node deleteQueue ${PROJECT_ID} ${queueName}`); + assert.match(stdout, /Deleted queue/); }); });