diff --git a/cloud-language/snippets/slackbot/system-test/controller.test.js b/cloud-language/snippets/slackbot/system-test/controller.test.js index 267bf27ae3..715cc037eb 100644 --- a/cloud-language/snippets/slackbot/system-test/controller.test.js +++ b/cloud-language/snippets/slackbot/system-test/controller.test.js @@ -50,7 +50,7 @@ test.before((t) => { }); }); -test.after((t) => { +test.after.always((t) => { process.env.SLACK_TOKEN_PATH = originalToken; try { fs.unlinkSync(SLACK_TOKEN_PATH); diff --git a/cloud-language/snippets/slackbot/system-test/demo_bot.test.js b/cloud-language/snippets/slackbot/system-test/demo_bot.test.js index 7c08120592..c29ba507b1 100644 --- a/cloud-language/snippets/slackbot/system-test/demo_bot.test.js +++ b/cloud-language/snippets/slackbot/system-test/demo_bot.test.js @@ -59,7 +59,7 @@ test.before.cb((t) => { }); }); -test.after.cb((t) => { +test.after.cb.always((t) => { fs.unlink(DB_PATH, (err) => { if (err) { t.end(err); diff --git a/cloud-language/snippets/system-test/analyze.test.js b/cloud-language/snippets/system-test/analyze.test.js index 16560e87c5..dceebfda51 100644 --- a/cloud-language/snippets/system-test/analyze.test.js +++ b/cloud-language/snippets/system-test/analyze.test.js @@ -33,7 +33,7 @@ test.before(async () => { await bucket.upload(localFilePath); }); -test.after(async () => { +test.after.always(async () => { const bucket = storage.bucket(bucketName); await bucket.deleteFiles({ force: true }); await bucket.deleteFiles({ force: true }); // Try a second time... @@ -41,7 +41,7 @@ test.after(async () => { }); test.beforeEach(stubConsole); -test.afterEach(restoreConsole); +test.afterEach.always(restoreConsole); test(`should run sync recognize`, async (t) => { const output = await runAsync(`${cmd} sentiment-text "${text}"`, cwd); diff --git a/cloud-language/snippets/system-test/quickstart.test.js b/cloud-language/snippets/system-test/quickstart.test.js index 41cfb414d3..3fea05ff7f 100644 --- a/cloud-language/snippets/system-test/quickstart.test.js +++ b/cloud-language/snippets/system-test/quickstart.test.js @@ -21,7 +21,7 @@ const proxyquire = require(`proxyquire`).noPreserveCache(); const language = proxyquire(`@google-cloud/language`, {})(); test.beforeEach(stubConsole); -test.afterEach(restoreConsole); +test.afterEach.always(restoreConsole); test.cb(`should detect sentiment`, (t) => { const expectedText = `Hello, world!`;