diff --git a/opencensus/package.json b/opencensus/package.json index 35bdb22394..65f6f34065 100644 --- a/opencensus/package.json +++ b/opencensus/package.json @@ -14,7 +14,7 @@ }, "scripts": { "start": "node metrics-quickstart.js", - "test": "repo-tools test run --cmd ava -- -T 65s --verbose system-test/*.test.js" + "test": "repo-tools test run --cmd mocha -- system-test/*.test.js --timeout=5000" }, "dependencies": { "@opencensus/core": "^0.0.9", @@ -22,7 +22,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", - "ava": "^0.25.0" + "mocha": "^6.0.0" }, "cloud-repo-tools": { "requiresKeyFile": true, diff --git a/opencensus/system-test/metrics-quickstart.test.js b/opencensus/system-test/metrics-quickstart.test.js index a86fec66d6..2780d69730 100644 --- a/opencensus/system-test/metrics-quickstart.test.js +++ b/opencensus/system-test/metrics-quickstart.test.js @@ -15,19 +15,25 @@ 'use strict'; -const test = require(`ava`); -const tools = require(`@google-cloud/nodejs-repo-tools`); +const assert = require('assert'); +const tools = require('@google-cloud/nodejs-repo-tools'); -test('Should throw an error without projectId', async t => { +it('Should throw an error without projectId', done => { process.env.GOOGLE_PROJECT_ID = ''; const error = new Error(`Unable to proceed without a Project ID`); - await t.throws(tools.runAsync(`node metrics-quickstart.js`), Error, error); + tools.runAsync('node metrics-quickstart.js').then( + () => {}, + err => { + assert.ok(err.message.includes(error.message)); + done(); + } + ); }); -test('Should capture stats data and export it to backend', async t => { +it('Should capture stats data and export it to backend', async () => { process.env.GOOGLE_PROJECT_ID = 'fake-id'; process.env.KUBERNETES_SERVICE_HOST = 'localhost'; - const output = await tools.runAsync(`node metrics-quickstart.js`); - t.regex(output, new RegExp(`Latency *:*`)); - t.regex(output, /Done recording metrics./); + const output = await tools.runAsync('node metrics-quickstart.js'); + assert.ok(new RegExp('Latency *:*').test(output)); + assert.ok(new RegExp('Done recording metrics.').test(output)); });