Skip to content

Commit 5aaa74c

Browse files
nareshqlogicJustinBeckwith
authored andcommitted
refactor(samples): convert sample tests from ava to mocha (#126)
1 parent 978735a commit 5aaa74c

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

cloud-tasks/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"node": ">=8"
1010
},
1111
"scripts": {
12-
"unit-test": "ava --verbose system-test/*.test.js",
12+
"unit-test": "mocha system-test/*.test.js --timeout=600000",
1313
"system-test": "repo-tools test app --config package.json --config-key cloud-repo-tools",
1414
"test": "npm run unit-test && npm run system-test"
1515
},
@@ -21,7 +21,7 @@
2121
},
2222
"devDependencies": {
2323
"@google-cloud/nodejs-repo-tools": "^3.0.0",
24-
"ava": "^0.25.0",
24+
"mocha": "^5.2.0",
2525
"proxyquire": "^2.0.1",
2626
"sinon": "^7.0.0"
2727
},
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2+
env:
3+
mocha: true
24
rules:
35
node/no-unpublished-require: off
4-
node/no-unsupported-features: off
56
no-empty: off

cloud-tasks/system-test/createTask.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515

1616
'use strict';
1717

18-
const path = require(`path`);
19-
const test = require(`ava`);
20-
const tools = require(`@google-cloud/nodejs-repo-tools`);
18+
const path = require('path');
19+
const assert = require('assert');
20+
const tools = require('@google-cloud/nodejs-repo-tools');
2121

22-
const {runAsync} = require(`@google-cloud/nodejs-repo-tools`);
22+
const {runAsync} = require('@google-cloud/nodejs-repo-tools');
2323

2424
const PROJECT_ID = process.env.GCLOUD_PROJECT;
2525
const QUEUE = process.env.QUEUE_ID || 'my-appengine-queue';
26-
const cmd = `node createTask.js`;
27-
const cwd = path.join(__dirname, `..`);
26+
const cmd = 'node createTask.js';
27+
const cwd = path.join(__dirname, '..');
2828

29-
test.before(t => {
29+
before(() => {
3030
if (!QUEUE) {
31-
t.fail(`You must set the QUEUE_ID environment variable!`);
31+
assert.fail('You must set the QUEUE_ID environment variable!');
3232
}
33+
tools.checkCredentials();
3334
});
34-
test.before(tools.checkCredentials);
3535

36-
test.serial(`should create a task`, async t => {
36+
it('should create a task', async () => {
3737
const output = await runAsync(
3838
`${cmd} --project=${PROJECT_ID} --location=us-central1 --queue=${QUEUE}`,
3939
cwd
4040
);
41-
t.true(output.includes('Created task'));
41+
assert.strictEqual(output.includes('Created task'), true);
4242
});

0 commit comments

Comments
 (0)