Migrate a few packages' tests to use Jest Expect (see below)
* Migrate the following packages' tests:
* babel-helper-annotate-as-pure
* babel-helper-module-imports
* babel-helper-transform-fixture-test-runner
* babel-highlight
* babel-node
* babel-plugin-transform-modules-commonjs
* babel-preset-env-standalone
* babel-preset-env
* babel-preset-es2015
* babel-preset-react
* babel-standalone
* babel-template
* babel-traverse
* babel-types
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
const assert = require("assert");
|
||||
const babel = require("@babel/core");
|
||||
|
||||
test("Doesn't use the same object for two different nodes in the AST", function() {
|
||||
@@ -9,26 +8,20 @@ test("Doesn't use the same object for two different nodes in the AST", function(
|
||||
plugins: [[require("../"), { loose: true }]],
|
||||
}).ast;
|
||||
|
||||
assert.equal(ast.program.body[0].declarations[0].id.type, "Identifier");
|
||||
assert.equal(ast.program.body[2].expression.type, "MemberExpression");
|
||||
assert.equal(ast.program.body[2].expression.object.type, "Identifier");
|
||||
assert.equal(ast.program.body[3].expression.type, "MemberExpression");
|
||||
assert.equal(ast.program.body[3].expression.object.type, "Identifier");
|
||||
expect(ast.program.body[0].declarations[0].id.type).toBe("Identifier");
|
||||
expect(ast.program.body[2].expression.type).toBe("MemberExpression");
|
||||
expect(ast.program.body[2].expression.object.type).toBe("Identifier");
|
||||
expect(ast.program.body[3].expression.type).toBe("MemberExpression");
|
||||
expect(ast.program.body[3].expression.object.type).toBe("Identifier");
|
||||
|
||||
assert.notStrictEqual(
|
||||
ast.program.body[2].expression.object,
|
||||
expect(ast.program.body[2].expression.object).not.toBe(
|
||||
ast.program.body[3].expression.object,
|
||||
"Expected different nodes in the AST to not be the same object (one)",
|
||||
);
|
||||
|
||||
assert.notStrictEqual(
|
||||
ast.program.body[0].declarations[0].id,
|
||||
expect(ast.program.body[0].declarations[0].id).not.toBe(
|
||||
ast.program.body[3].expression.object,
|
||||
"Expected different nodes in the AST to not be the same object (two)",
|
||||
);
|
||||
assert.notStrictEqual(
|
||||
ast.program.body[0].declarations[0].id,
|
||||
expect(ast.program.body[0].declarations[0].id).not.toBe(
|
||||
ast.program.body[2].expression.object,
|
||||
"Expected different nodes in the AST to not be the same object (three)",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const assert = require("assert");
|
||||
const babel = require("@babel/core");
|
||||
const vm = require("vm");
|
||||
|
||||
@@ -27,9 +26,5 @@ test("Re-export doesn't overwrite __esModule flag", function() {
|
||||
vm.runInNewContext(code, context);
|
||||
|
||||
// exports.__esModule shouldn't be overwritten.
|
||||
assert.equal(
|
||||
context.exports.__esModule,
|
||||
true,
|
||||
"Expected exports.__esModule === true",
|
||||
);
|
||||
expect(context.exports.__esModule).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user