From ff044bbb0fce2a78a0d3e379895fd1f37046575f Mon Sep 17 00:00:00 2001 From: Jesse McCarthy Date: Thu, 19 May 2016 08:26:59 -0400 Subject: [PATCH] Use more ideal mocha hooks (#3446) * setup() instead of manual before(). * suiteTeardown() instead of afterEach(). --- packages/babel-core/test/api.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 2c75c9e753..18ddd0d1b9 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -432,23 +432,19 @@ suite("api", function () { var oldBabelEnv = process.env.BABEL_ENV; var oldNodeEnv = process.env.NODE_ENV; - - // This this a global side effect and we need to make sure it's localized - // to every test below. - function before() { + setup(function () { + // Tests need to run with the default and specific values for these. They + // need to be cleared for each test. delete process.env.BABEL_ENV; delete process.env.NODE_ENV; - } + }); - - afterEach(function () { + suiteTeardown(function () { process.env.BABEL_ENV = oldBabelEnv; process.env.NODE_ENV = oldNodeEnv; }); test("default", function () { - before(); - var result = babel.transform("foo;", { env: { development: { code: false } @@ -459,8 +455,6 @@ suite("api", function () { }); test("BABEL_ENV", function () { - before(); - process.env.BABEL_ENV = "foo"; var result = babel.transform("foo;", { env: { @@ -471,8 +465,6 @@ suite("api", function () { }); test("NODE_ENV", function () { - before(); - process.env.NODE_ENV = "foo"; var result = babel.transform("foo;", { env: {