diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 780c5a682b44..daacda4ee519 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -139,7 +139,7 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { if (binName[0] === ".") return; let suiteLoc = path.join(fixtureLoc, binName); - suite("bin/" + binName, function () { + describe("bin/" + binName, function () { _.each(fs.readdirSync(suiteLoc), function (testName) { if (testName[0] === ".") return; @@ -170,7 +170,7 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); } - test(testName, buildTest(binName, testName, opts)); + it(testName, buildTest(binName, testName, opts)); }); }); }); diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index ffe36f457f41..39813d7e1690 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -2,8 +2,8 @@ let assert = require("assert"); let chalk = require("chalk"); let codeFrame = require(".."); -suite("babel-code-frame", function () { - test("basic usage", function () { +describe("babel-code-frame", function () { + it("basic usage", function () { const rawLines = [ "class Foo {", " constructor()", @@ -17,7 +17,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("optional column number", function () { + it("optional column number", function () { const rawLines = [ "class Foo {", " constructor()", @@ -30,7 +30,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("optional column number", function () { + it("optional column number", function () { const rawLines = [ "class Foo {", " constructor()", @@ -43,7 +43,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("maximum context lines and padding", function () { + it("maximum context lines and padding", function () { const rawLines = [ "/**", " * Sums two numbers.", @@ -68,7 +68,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("no unnecessary padding due to one-off errors", function () { + it("no unnecessary padding due to one-off errors", function () { const rawLines = [ "/**", " * Sums two numbers.", @@ -93,7 +93,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("tabs", function () { + it("tabs", function () { const rawLines = [ "\tclass Foo {", "\t \t\t constructor\t(\t)", @@ -107,7 +107,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("opts.highlightCode", function () { + it("opts.highlightCode", function () { const rawLines = "console.log('babel')"; const result = codeFrame(rawLines, 1, 9, {highlightCode: true}); const stripped = chalk.stripColor(result); @@ -118,7 +118,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("opts.linesAbove", function () { + it("opts.linesAbove", function () { let rawLines = [ "/**", " * Sums two numbers.", @@ -142,7 +142,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("opts.linesBelow", function () { + it("opts.linesBelow", function () { let rawLines = [ "/**", " * Sums two numbers.", @@ -165,7 +165,7 @@ suite("babel-code-frame", function () { ].join("\n")); }); - test("opts.linesAbove and opts.linesBelow", function () { + it("opts.linesAbove and opts.linesBelow", function () { let rawLines = [ "/**", " * Sums two numbers.", diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 8001408efaf4..1122e497e8bc 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -22,7 +22,7 @@ function transformAsync(code, opts) { }; } -suite("parser and generator options", function() { +describe("parser and generator options", function() { let recast = { parse: function(code, opts) { return opts.parser.parse(code); @@ -45,13 +45,13 @@ suite("parser and generator options", function() { }); } - test("options", function() { + it("options", function() { let string = "original;"; assert.deepEqual(newTransform(string).ast, babel.transform(string).ast); assert.equal(newTransform(string).code, string); }); - test("experimental syntax", function() { + it("experimental syntax", function() { let experimental = "var a: number = 1;"; assert.deepEqual(newTransform(experimental).ast, babel.transform(experimental, { @@ -81,7 +81,7 @@ suite("parser and generator options", function() { assert.equal(newTransformWithPlugins(experimental).code, experimental); }); - test("other options", function() { + it("other options", function() { let experimental = "if (true) {\n import a from 'a';\n}"; assert.notEqual(newTransform(experimental).ast, babel.transform(experimental, { @@ -93,8 +93,8 @@ suite("parser and generator options", function() { }); }); -suite("api", function () { - test("analyze", function () { +describe("api", function () { + it("analyze", function () { assert.equal(babel.analyse("foobar;").marked.length, 0); assert.equal(babel.analyse("foobar;", { @@ -114,7 +114,7 @@ suite("api", function () { }).marked[0].message, "foobar"); }); - test("transformFile", function (done) { + it("transformFile", function (done) { babel.transformFile(__dirname + "/fixtures/api/file.js", {}, function (err, res) { if (err) return done(err); assert.equal(res.code, "foo();"); @@ -122,11 +122,11 @@ suite("api", function () { }); }); - test("transformFileSync", function () { + it("transformFileSync", function () { assert.equal(babel.transformFileSync(__dirname + "/fixtures/api/file.js", {}).code, "foo();"); }); - test("options throw on falsy true", function () { + it("options throw on falsy true", function () { return assert.throws( function () { babel.transform("", { @@ -137,7 +137,7 @@ suite("api", function () { ); }); - test("options merge backwards", function () { + it("options merge backwards", function () { return transformAsync("", { presets: [__dirname + "/../../babel-preset-es2015"], plugins: [__dirname + "/../../babel-plugin-syntax-jsx"] @@ -146,7 +146,7 @@ suite("api", function () { }); }); - test("option wrapPluginVisitorMethod", function () { + it("option wrapPluginVisitorMethod", function () { let calledRaw = 0; let calledIntercept = 0; @@ -178,7 +178,7 @@ suite("api", function () { assert.equal(calledIntercept, 4); }); - test("pass per preset", function () { + it("pass per preset", function () { let aliasBaseType = null; function execTest(passPerPreset) { @@ -255,7 +255,7 @@ suite("api", function () { }); - test("handles preset shortcuts (adds babel-preset-)", function () { + it("handles preset shortcuts (adds babel-preset-)", function () { return assert.throws( function () { babel.transform("", { @@ -266,7 +266,7 @@ suite("api", function () { ); }); - test("handles preset shortcuts 2 (adds babel-preset-)", function () { + it("handles preset shortcuts 2 (adds babel-preset-)", function () { return assert.throws( function () { babel.transform("", { @@ -277,7 +277,7 @@ suite("api", function () { ); }); - test("source map merging", function () { + it("source map merging", function () { let result = babel.transform([ "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }", "", @@ -315,19 +315,19 @@ suite("api", function () { }); }); - test("code option false", function () { + it("code option false", function () { return transformAsync("foo('bar');", { code: false }).then(function (result) { assert.ok(!result.code); }); }); - test("ast option false", function () { + it("ast option false", function () { return transformAsync("foo('bar');", { ast: false }).then(function (result) { assert.ok(!result.ast); }); }); - test("auxiliaryComment option", function () { + it("auxiliaryComment option", function () { return transformAsync("class Foo {}", { auxiliaryCommentBefore: "before", auxiliaryCommentAfter: "after", @@ -347,7 +347,7 @@ suite("api", function () { }); }); - test("modules metadata", function () { + it("modules metadata", function () { return Promise.all([ transformAsync("import { externalName as localName } from \"external\";").then(function (result) { assert.deepEqual(result.metadata.modules.imports[0], { @@ -499,7 +499,7 @@ suite("api", function () { ]); }); - test("ignore option", function () { + it("ignore option", function () { return Promise.all([ transformAsync("", { ignore: "node_modules", @@ -518,7 +518,7 @@ suite("api", function () { ]); }); - test("only option", function () { + it("only option", function () { return Promise.all([ transformAsync("", { only: "node_modules", @@ -552,7 +552,7 @@ suite("api", function () { ]); }); - suite("env option", function () { + describe("env option", function () { let oldBabelEnv = process.env.BABEL_ENV; let oldNodeEnv = process.env.NODE_ENV; @@ -568,7 +568,7 @@ suite("api", function () { process.env.NODE_ENV = oldNodeEnv; }); - test("default", function () { + it("default", function () { let result = babel.transform("foo;", { env: { development: { code: false } @@ -578,7 +578,7 @@ suite("api", function () { assert.equal(result.code, undefined); }); - test("BABEL_ENV", function () { + it("BABEL_ENV", function () { process.env.BABEL_ENV = "foo"; let result = babel.transform("foo;", { env: { @@ -588,7 +588,7 @@ suite("api", function () { assert.equal(result.code, undefined); }); - test("NODE_ENV", function () { + it("NODE_ENV", function () { process.env.NODE_ENV = "foo"; let result = babel.transform("foo;", { env: { @@ -599,7 +599,7 @@ suite("api", function () { }); }); - test("resolveModuleSource option", function () { + it("resolveModuleSource option", function () { let actual = "import foo from \"foo-import-default\";\nimport \"foo-import-bare\";\nexport { foo } from \"foo-export-named\";"; let expected = "import foo from \"resolved/foo-import-default\";\nimport \"resolved/foo-import-bare\";\nexport { foo } from \"resolved/foo-export-named\";"; @@ -612,26 +612,26 @@ suite("api", function () { }); }); - suite("buildExternalHelpers", function () { - test("all", function () { + describe("buildExternalHelpers", function () { + it("all", function () { let script = buildExternalHelpers(); assert.ok(script.indexOf("classCallCheck") >= -1); assert.ok(script.indexOf("inherits") >= 0); }); - test("whitelist", function () { + it("whitelist", function () { let script = buildExternalHelpers(["inherits"]); assert.ok(script.indexOf("classCallCheck") === -1); assert.ok(script.indexOf("inherits") >= 0); }); - test("empty whitelist", function () { + it("empty whitelist", function () { let script = buildExternalHelpers([]); assert.ok(script.indexOf("classCallCheck") === -1); assert.ok(script.indexOf("inherits") === -1); }); - test("underscored", function () { + it("underscored", function () { let script = buildExternalHelpers(["typeof"]); assert.ok(script.indexOf("typeof") >= 0); }); diff --git a/packages/babel-core/test/browserify.js b/packages/babel-core/test/browserify.js index 7841e20e9980..9923f6c52ea8 100644 --- a/packages/babel-core/test/browserify.js +++ b/packages/babel-core/test/browserify.js @@ -3,8 +3,8 @@ let assert = require("assert"); let path = require("path"); let vm = require("vm"); -suite("browserify", function() { - test("babel/register may be used without breaking browserify", function(done) { +describe("browserify", function() { + it("babel/register may be used without breaking browserify", function(done) { let bundler = browserify(path.join(__dirname, "fixtures/browserify/register.js")); bundler.bundle(function(err, bundle) { diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index ff1ab338c55f..0a0b952d5123 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -10,7 +10,7 @@ function fixture() { return path.join.apply(path, args); } -suite("buildConfigChain", function () { +describe("buildConfigChain", function () { let oldBabelEnv; let oldNodeEnv; @@ -27,7 +27,7 @@ suite("buildConfigChain", function () { process.env.NODE_ENV = oldNodeEnv; }); - test("dir1", function () { + it("dir1", function () { let chain = buildConfigChain({ filename: fixture("dir1", "src.js") }); @@ -76,7 +76,7 @@ suite("buildConfigChain", function () { assert.deepEqual(chain, expected); }); - test("dir2", function () { + it("dir2", function () { let chain = buildConfigChain({ filename: fixture("dir2", "src.js") }); @@ -115,7 +115,7 @@ suite("buildConfigChain", function () { assert.deepEqual(chain, expected); }); - test("env - base", function () { + it("env - base", function () { let chain = buildConfigChain({ filename: fixture("env", "src.js") }); @@ -154,7 +154,7 @@ suite("buildConfigChain", function () { assert.deepEqual(chain, expected); }); - test("env - foo", function () { + it("env - foo", function () { process.env.NODE_ENV = "foo"; let chain = buildConfigChain({ @@ -205,7 +205,7 @@ suite("buildConfigChain", function () { assert.deepEqual(chain, expected); }); - test("env - bar", function () { + it("env - bar", function () { process.env.NODE_ENV = "foo"; // overridden process.env.NODE_ENV = "bar"; @@ -258,7 +258,7 @@ suite("buildConfigChain", function () { }); - test("env - foo", function () { + it("env - foo", function () { process.env.NODE_ENV = "foo"; let chain = buildConfigChain({ diff --git a/packages/babel-core/test/evaluation.js b/packages/babel-core/test/evaluation.js index d587c83511f9..be9cc2a66c0f 100644 --- a/packages/babel-core/test/evaluation.js +++ b/packages/babel-core/test/evaluation.js @@ -2,9 +2,9 @@ let traverse = require("babel-traverse").default; let assert = require("assert"); let parse = require("babylon").parse; -suite("evaluation", function () { +describe("evaluation", function () { function addTest(code, type, value, notConfident) { - test(type + ": " + code, function () { + it(type + ": " + code, function () { let visitor = {}; visitor[type] = function (path) { diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index a4fea18c476d..592c431d5481 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -3,9 +3,9 @@ import OptionManager from "../lib/transformation/file/options/option-manager"; import Logger from "../lib/transformation/file/logger"; import path from "path"; -suite("option-manager", () => { - suite("memoisePluginContainer", () => { - test("throws for babel 5 plugin", () => { +describe("option-manager", () => { + describe("memoisePluginContainer", () => { + it("throws for babel 5 plugin", () => { return assert.throws( () => OptionManager.memoisePluginContainer(({ Plugin }) => new Plugin("object-assign", {})), /Babel 5 plugin is being run with Babel 6/ @@ -13,8 +13,8 @@ suite("option-manager", () => { }); }); - suite("mergeOptions", () => { - test("throws for removed babel 5 options", () => { + describe("mergeOptions", () => { + it("throws for removed babel 5 options", () => { return assert.throws( () => { let opt = new OptionManager(new Logger(null, "unknown")); @@ -26,7 +26,7 @@ suite("option-manager", () => { ); }); - test("throws for removed babel 5 options", () => { + it("throws for removed babel 5 options", () => { return assert.throws( () => { let opt = new OptionManager(new Logger(null, "unknown")); @@ -39,7 +39,7 @@ suite("option-manager", () => { ); }); - test("throws for resolved but erroring preset", () => { + it("throws for resolved but erroring preset", () => { return assert.throws( () => { let opt = new OptionManager(new Logger(null, "unknown")); @@ -51,7 +51,7 @@ suite("option-manager", () => { ); }); - test("throws for invalid preset configuration", function() { + it("throws for invalid preset configuration", function() { return assert.throws( function () { let opt = new OptionManager(new Logger(null, "unknown")); @@ -64,9 +64,9 @@ suite("option-manager", () => { }); }); - suite("presets", function () { + describe("presets", function () { function presetTest(name) { - test(name, function () { + it(name, function () { let opt = new OptionManager(new Logger(null, "unknown")); let options = opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)] diff --git a/packages/babel-core/test/path.js b/packages/babel-core/test/path.js index 17d4d91d4f89..c76fc31e59bd 100644 --- a/packages/babel-core/test/path.js +++ b/packages/babel-core/test/path.js @@ -2,8 +2,8 @@ let transform = require("../lib/api/node").transform; let Plugin = require("../lib/transformation/plugin"); let chai = require("chai"); -suite("traversal path", function () { - test("replaceWithSourceString", function () { +describe("traversal path", function () { + it("replaceWithSourceString", function () { let expectCode = "function foo() {}"; let actualCode = transform(expectCode, { @@ -19,7 +19,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("console.whatever();"); }); - test("replaceWith (arrow expression body to block statement body)", function () { + it("replaceWith (arrow expression body to block statement body)", function () { let expectCode = "var fn = () => true;"; let actualCode = transform(expectCode, { @@ -44,7 +44,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("var fn = () => {\n return true;\n};"); }); - test("replaceWith (arrow block statement body to expression body)", function () { + it("replaceWith (arrow block statement body to expression body)", function () { let expectCode = "var fn = () => { return true; }"; let actualCode = transform(expectCode, { @@ -63,7 +63,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("var fn = () => true;"); }); - test("replaceWith (for-in left expression to variable declaration)", function () { + it("replaceWith (for-in left expression to variable declaration)", function () { let expectCode = "for (KEY in right);"; let actualCode = transform(expectCode, { @@ -89,7 +89,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("for (var KEY in right);"); }); - test("replaceWith (for-in left variable declaration to expression)", function () { + it("replaceWith (for-in left variable declaration to expression)", function () { let expectCode = "for (var KEY in right);"; let actualCode = transform(expectCode, { @@ -108,7 +108,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("for (KEY in right);"); }); - test("replaceWith (for-loop left expression to variable declaration)", function () { + it("replaceWith (for-loop left expression to variable declaration)", function () { let expectCode = "for (KEY;;);"; let actualCode = transform(expectCode, { @@ -134,7 +134,7 @@ suite("traversal path", function () { chai.expect(actualCode).to.be.equal("for (var KEY;;);"); }); - test("replaceWith (for-loop left variable declaration to expression)", function () { + it("replaceWith (for-loop left variable declaration to expression)", function () { let expectCode = "for (var KEY;;);"; let actualCode = transform(expectCode, { diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index e541ea67f948..bdffce466d98 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -5,8 +5,8 @@ let fs = require("fs"); let path = require("path"); // Test that plugins & presets are resolved relative to `filename`. -suite("addon resolution", function () { - test("addon resolution", function (done) { +describe("addon resolution", function () { + it("addon resolution", function (done) { let fixtures = {}; let paths = {}; diff --git a/packages/babel-core/test/util.js b/packages/babel-core/test/util.js index 8601f6db0885..ae1e83e91399 100644 --- a/packages/babel-core/test/util.js +++ b/packages/babel-core/test/util.js @@ -2,8 +2,8 @@ let assert = require("assert"); let util = require("../lib/util"); let t = require("babel-types"); -suite("util", function () { - test("canCompile", function () { +describe("util", function () { + it("canCompile", function () { assert.ok(util.canCompile("test.js")); assert.ok(util.canCompile("/test.js")); assert.ok(util.canCompile("/scripts/test.js")); @@ -26,7 +26,7 @@ suite("util", function () { assert.ok(!util.canCompile("/scripts/test.css")); }); - test("list", function () { + it("list", function () { assert.deepEqual(util.list(undefined), []); assert.deepEqual(util.list(false), []); assert.deepEqual(util.list(null), []); @@ -40,7 +40,7 @@ suite("util", function () { assert.deepEqual(util.list(date), [date]); }); - test("arrayify", function () { + it("arrayify", function () { assert.deepEqual(util.arrayify(undefined), []); assert.deepEqual(util.arrayify(false), []); assert.deepEqual(util.arrayify(null), []); @@ -52,7 +52,7 @@ suite("util", function () { assert.deepEqual(util.arrayify(function () { return "foo"; })[0](), "foo"); }); - test("regexify", function () { + it("regexify", function () { assert.deepEqual(util.regexify(undefined), /.^/); assert.deepEqual(util.regexify(false), /.^/); assert.deepEqual(util.regexify(null), /.^/); @@ -73,17 +73,17 @@ suite("util", function () { }, /illegal type for regexify/); }); - test("booleanify", function () { + it("booleanify", function () { assert.strictEqual(util.booleanify("true"), true); assert.strictEqual(util.booleanify("false"), false); assert.strictEqual(util.booleanify("inline"), "inline"); }); - test("toIdentifier", function () { + it("toIdentifier", function () { assert.equal(t.toIdentifier("swag-lord"), "swagLord"); }); - test("shouldIgnore", function () { + it("shouldIgnore", function () { let reIgnore = /\-reIgnore\.js/; let fnIgnore = function (src) { if (src.indexOf("fnIgnore") > 0) { diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index f534f79865b4..92b4c5b3d274 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -7,8 +7,8 @@ let chai = require("chai"); let t = require("babel-types"); let _ = require("lodash"); -suite("generation", function () { - test("completeness", function () { +describe("generation", function () { + it("completeness", function () { _.each(t.VISITOR_KEYS, function (keys, type) { assert.ok(!!Printer.prototype[type], type + " should exist"); }); @@ -19,7 +19,7 @@ suite("generation", function () { }); }); - test("multiple sources", function () { + it("multiple sources", function () { let sources = { "a.js": "function hi (msg) { console.log(msg); }\n", "b.js": "hi('hello');\n" @@ -62,7 +62,7 @@ suite("generation", function () { ); }); - test("identifierName", function () { + it("identifierName", function () { let code = "function foo() { bar; }\n"; let ast = parse(code, { filename: "inline" }).program; @@ -98,14 +98,14 @@ suite("generation", function () { }); -suite("programmatic generation", function() { - test("numeric member expression", function() { +describe("programmatic generation", function() { + it("numeric member expression", function() { // Should not generate `0.foo` let mem = t.memberExpression(t.numericLiteral(60702), t.identifier("foo")); new Function(generate.default(mem).code); }); - test("nested if statements needs block", function() { + it("nested if statements needs block", function() { let ifStatement = t.ifStatement( t.stringLiteral("top cond"), t.whileStatement( @@ -122,7 +122,7 @@ suite("programmatic generation", function() { assert.equal(ast.program.body[0].consequent.type, "BlockStatement"); }); - test("flow object indentation", function() { + it("flow object indentation", function() { let objectStatement = t.objectTypeAnnotation( [ t.objectTypeProperty( @@ -143,8 +143,8 @@ suite("programmatic generation", function() { }); }); -suite("whitespace", function () { - test("empty token list", function () { +describe("whitespace", function () { + it("empty token list", function () { let w = new Whitespace([]); assert.equal(w.getNewlinesBefore(t.stringLiteral("1")), 0); }); @@ -153,9 +153,9 @@ suite("whitespace", function () { let suites = require("babel-helper-fixtures").default(__dirname + "/fixtures"); suites.forEach(function (testSuite) { - suite("generation/" + testSuite.title, function () { + describe("generation/" + testSuite.title, function () { _.each(testSuite.tests, function (task) { - test(task.title, !task.disabled && function () { + it(task.title, !task.disabled && function () { let expect = task.expect; let actual = task.actual; diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index f1361482ff65..dac7ffdf4299 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -1,6 +1,3 @@ -/* global test */ -/* global suite */ - import * as babel from "babel-core"; import { buildExternalHelpers } from "babel-core"; import getFixtures from "babel-helper-fixtures"; @@ -123,12 +120,12 @@ export default function ( for (let testSuite of suites) { if (_.includes(suiteOpts.ignoreSuites, testSuite.title)) continue; - suite(name + "/" + testSuite.title, function () { + describe(name + "/" + testSuite.title, function () { for (let task of testSuite.tests) { if (_.includes(suiteOpts.ignoreTasks, task.title) || _.includes(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) continue; - test(task.title, !task.disabled && function () { + it(task.title, !task.disabled && function () { function runTask() { run(task); } diff --git a/packages/babel-preset-es2015/test/index.js b/packages/babel-preset-es2015/test/index.js index 4b8740dcf3be..7653dbb6f97e 100644 --- a/packages/babel-preset-es2015/test/index.js +++ b/packages/babel-preset-es2015/test/index.js @@ -1,39 +1,39 @@ let es2015 = require("../lib"); let expect = require("chai").expect; -suite("es2015 preset", function () { - test("exposes an object", function () { +describe("es2015 preset", function () { + it("exposes an object", function () { // Changing this will break compatibility with babel-core < 6.13.x. expect(typeof es2015).to.equal("object"); }); - test("exposes a separate list of plugins", function () { + it("exposes a separate list of plugins", function () { expect(Array.isArray(es2015.plugins)).to.equal(true); }); - test("doesn't throw with no options passed", function () { + it("doesn't throw with no options passed", function () { expect(function () { es2015.buildPreset(null); }).not.to.throw(); }); - suite("options", function () { - suite("loose", function () { - test("throws on non-boolean value", function () { + describe("options", function () { + describe("loose", function () { + it("throws on non-boolean value", function () { expect(function () { es2015.buildPreset(null, { loose: 1}); }).to.throw(/must be a boolean/); }); }); - suite("modules", function () { - test("doesn't throw when passing one false", function () { + describe("modules", function () { + it("doesn't throw when passing one false", function () { expect(function () { es2015.buildPreset(null, { modules: false }); }).not.to.throw(); }); - test("doesn't throw when passing one of: 'commonjs', 'amd', 'umd', 'systemjs", function () { + it("doesn't throw when passing one of: 'commonjs', 'amd', 'umd', 'systemjs", function () { expect(function () { es2015.buildPreset(null, { modules: "commonjs" }); }).not.to.throw(); diff --git a/packages/babel-template/test/index.js b/packages/babel-template/test/index.js index aa4b3e4358eb..f64090e4a839 100644 --- a/packages/babel-template/test/index.js +++ b/packages/babel-template/test/index.js @@ -4,26 +4,26 @@ let chai = require("chai"); let comments = "// Sum two numbers\nconst add = (a, b) => a + b;"; -suite("templating", function () { - test("import statement will cause parser to throw by default", function () { +describe("templating", function () { + it("import statement will cause parser to throw by default", function () { chai.expect(function () { template("import foo from 'foo'")({}); }).to.throw(); }); - test("import statements are allowed with sourceType: module", function () { + it("import statements are allowed with sourceType: module", function () { chai.expect(function () { template("import foo from 'foo'", {sourceType: "module"})({}); }).not.to.throw(); }); - test("should strip comments by default", function () { + it("should strip comments by default", function () { let code = "const add = (a, b) => a + b;"; let output = template(comments)(); chai.expect(generator(output).code).to.be.equal(code); }); - test("should preserve comments with a flag", function () { + it("should preserve comments with a flag", function () { let output = template(comments, {preserveComments: true})(); chai.expect(generator(output).code).to.be.equal(comments); }); diff --git a/packages/babel-traverse/test/evaluation.js b/packages/babel-traverse/test/evaluation.js index 02ea68b5cb5a..97dc0c3df9dd 100644 --- a/packages/babel-traverse/test/evaluation.js +++ b/packages/babel-traverse/test/evaluation.js @@ -14,16 +14,16 @@ function getPath(code) { return path; } -suite("evaluation", function () { - suite("evaluateTruthy", function () { - test("it should work with null", function () { +describe("evaluation", function () { + describe("evaluateTruthy", function () { + it("it should work with null", function () { assert.strictEqual( getPath("false || a.length === 0;").get("body")[0].evaluateTruthy(), undefined ); }); - test("it should not mistake lack of confidence for falsy", function () { + it("it should not mistake lack of confidence for falsy", function () { assert.strictEqual( getPath("foo || 'bar'").get("body")[0].evaluate().value, undefined @@ -31,35 +31,35 @@ suite("evaluation", function () { }); }); - test("should bail out on recursive evaluation", function () { + it("should bail out on recursive evaluation", function () { assert.strictEqual( getPath("function fn(a) { var g = a ? 1 : 2, a = g * this.foo; }").get("body.0.body.body.0.declarations.1.init").evaluate().confident, false ); }); - test("should work with repeated, indeterminate identifiers", function () { + it("should work with repeated, indeterminate identifiers", function () { assert.strictEqual( getPath("var num = foo(); (num > 0 && num < 100);").get("body")[1].evaluateTruthy(), undefined ); }); - test("should work with repeated, determinate identifiers", function () { + it("should work with repeated, determinate identifiers", function () { assert.strictEqual( getPath("var num = 5; (num > 0 && num < 100);").get("body")[1].evaluateTruthy(), true ); }); - test("should deopt when var is redeclared in the same scope", function () { + it("should deopt when var is redeclared in the same scope", function () { assert.strictEqual( getPath("var x = 2; var y = x + 2; { var x = 3 }").get("body.1.declarations.0.init").evaluate().confident, false ); }); - test("it should not deopt vars in different scope", function () { + it("it should not deopt vars in different scope", function () { const input = "var a = 5; function x() { var a = 5; var b = a + 1; } var b = a + 2"; assert.strictEqual( getPath(input).get("body.1.body.body.1.declarations.0.init").evaluate().value, @@ -71,7 +71,7 @@ suite("evaluation", function () { ); }); - test("it should not deopt let/const inside blocks", function () { + it("it should not deopt let/const inside blocks", function () { assert.strictEqual( getPath("let x = 5; { let x = 1; } let y = x + 5").get("body.2.declarations.0.init").evaluate().value, 10 diff --git a/packages/babel-traverse/test/inference.js b/packages/babel-traverse/test/inference.js index 52520cc751d5..a89fbeca7a7b 100644 --- a/packages/babel-traverse/test/inference.js +++ b/packages/babel-traverse/test/inference.js @@ -14,9 +14,9 @@ function getPath(code) { return path; } -suite("inference", function () { - suite("baseTypeStrictlyMatches", function () { - test("it should work with null", function () { +describe("inference", function () { + describe("baseTypeStrictlyMatches", function () { + it("it should work with null", function () { let path = getPath("var x = null; x === null").get("body")[1].get("expression"); let left = path.get("left"); let right = path.get("right"); @@ -25,7 +25,7 @@ suite("inference", function () { assert.ok(strictMatch, "null should be equal to null"); }); - test("it should work with numbers", function () { + it("it should work with numbers", function () { let path = getPath("var x = 1; x === 2").get("body")[1].get("expression"); let left = path.get("left"); let right = path.get("right"); @@ -34,7 +34,7 @@ suite("inference", function () { assert.ok(strictMatch, "null should be equal to null"); }); - test("it should bail when type changes", function () { + it("it should bail when type changes", function () { let path = getPath("var x = 1; if (foo) x = null;else x = 3; x === 2").get("body")[2].get("expression"); let left = path.get("left"); let right = path.get("right"); @@ -44,7 +44,7 @@ suite("inference", function () { assert.ok(!strictMatch, "type might change in if statement"); }); - test("it should differentiate between null and undefined", function () { + it("it should differentiate between null and undefined", function () { let path = getPath("var x; x === null").get("body")[1].get("expression"); let left = path.get("left"); let right = path.get("right"); diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index 4e1185d43f68..0df9e8fbf251 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -14,28 +14,28 @@ function getPath(code) { return path; } -suite("scope", function () { - suite("binding paths", function () { - test("function declaration id", function () { +describe("scope", function () { + describe("binding paths", function () { + it("function declaration id", function () { assert.ok(getPath("function foo() {}").scope.getBinding("foo").path.type === "FunctionDeclaration"); }); - test("function expression id", function () { + it("function expression id", function () { assert.ok(getPath("(function foo() {})").get("body")[0].get("expression").scope.getBinding("foo").path.type === "FunctionExpression"); }); - test("function param", function () { + it("function param", function () { assert.ok(getPath("(function (foo) {})").get("body")[0].get("expression").scope.getBinding("foo").path.type === "Identifier"); }); - test("variable declaration", function () { + it("variable declaration", function () { assert.ok(getPath("var foo = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); assert.ok(getPath("var { foo } = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); assert.ok(getPath("var [ foo ] = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); assert.ok(getPath("var { bar: [ foo ] } = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); }); - test("purity", function () { + it("purity", function () { assert.ok(getPath("({ x: 1 })").get("body")[0].get("expression").isPure()); }); }); diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index b27f8a485e20..f8446a11aeb4 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -2,7 +2,7 @@ let traverse = require("../lib").default; let assert = require("assert"); let _ = require("lodash"); -suite("traverse", function () { +describe("traverse", function () { let ast = { type: "Program", body: [ @@ -52,7 +52,7 @@ suite("traverse", function () { let body = ast.body; - test("traverse replace", function () { + it("traverse replace", function () { let replacement = { type: "StringLiteral", value: "foo" @@ -68,7 +68,7 @@ suite("traverse", function () { assert.equal(ast2.body[1].expression.left.object, replacement); }); - test("traverse", function () { + it("traverse", function () { let expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, body[1], body[1].expression, body[1].expression.left, body[1].expression.left.object, body[1].expression.left.property, body[1].expression.right @@ -85,7 +85,7 @@ suite("traverse", function () { assert.deepEqual(actual, expect); }); - test("traverse falsy parent", function () { + it("traverse falsy parent", function () { traverse(null, { enter: function () { throw new Error("should not be ran"); @@ -93,7 +93,7 @@ suite("traverse", function () { }); }); - test("traverse blacklistTypes", function () { + it("traverse blacklistTypes", function () { let expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, body[1], body[1].expression, body[1].expression.right @@ -111,7 +111,7 @@ suite("traverse", function () { assert.deepEqual(actual, expect); }); - test("hasType", function () { + it("hasType", function () { assert.ok(traverse.hasType(ast, null, "ThisExpression")); assert.ok(!traverse.hasType(ast, null, "ThisExpression", ["AssignmentExpression"])); @@ -124,7 +124,7 @@ suite("traverse", function () { assert.ok(!traverse.hasType(ast, null, "ArrowFunctionExpression")); }); - test("clearCache", function () { + it("clearCache", function () { let paths = []; traverse(ast, { enter: function (path) {