migrate should to expect, part 1

used regexps:

([\(\)a-zA-Z0-9\."'/ +{}\[\]=\-,:?_!]+)\.should\.be\.eql
➡️
expect($1).toBe

expect\(([\(\)a-zA-Z0-9\."'/ +{}\[\]=\-,:?_!]+)\)\.toBe\(\[
➡️
expect($1).toEqual([

expect\(([\(\)a-zA-Z0-9\."'/ +{}\[\]=\-,:?_!]+)\)\.toBe\(\{
➡️
expect($1).toEqual({
This commit is contained in:
Bazyli Brzóska 2018-01-26 22:51:03 +01:00
parent 009772cb20
commit 5a8083a930
242 changed files with 923 additions and 923 deletions

View File

@ -60,7 +60,7 @@ describe("ExternalModule", () => {
expect(externalModule.getSource.callCount).toBe(1);
expect(externalModule.getSourceString.callCount).toBe(1);
expect(externalModule.getSource.args[0][0]).toBe(expectedString);
expect(result).toBe(expectedSource);
expect(result).toEqual(expectedSource);
});
});
@ -77,7 +77,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSource(someSourceString);
// check
expect(result).toBeInstanceOf(OriginalSource);
expect(result).toEqualInstanceOf(OriginalSource);
});
});
describe("given it does not use source maps", () => {
@ -92,7 +92,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSource(someSourceString);
// check
expect(result).toBeInstanceOf(RawSource);
expect(result).toEqualInstanceOf(RawSource);
});
});
});
@ -109,7 +109,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSourceForGlobalVariableExternal(varName, type);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
describe("given an single variable name", () => {
@ -123,7 +123,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSourceForGlobalVariableExternal(varName, type);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
});
@ -139,7 +139,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSourceForCommonJsExternal(varName, type);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
describe("given an single variable name", () => {
@ -153,7 +153,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSourceForCommonJsExternal(varName, type);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
});
@ -170,7 +170,7 @@ describe("ExternalModule", () => {
const result = externalModule.checkExternalVariable(variableToCheck, request);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
@ -185,7 +185,7 @@ describe("ExternalModule", () => {
const result = externalModule.getSourceForAmdOrUmdExternal(id, optional, request);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
describe("given an optinal check is set", () => {
it("ads a check for the existance of the variable before looking it up", () => {
@ -199,7 +199,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_someId__;`;
const result = externalModule.getSourceForAmdOrUmdExternal(id, optional, request);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
});
@ -214,7 +214,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_someId__;`;
const result = externalModule.getSourceForDefaultCase(optional, request);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
describe("given an optinal check is requested", () => {
it("checks for the existance of the request setting it", () => {
@ -227,7 +227,7 @@ module.exports = some/request;`;
const result = externalModule.getSourceForDefaultCase(optional, request);
// check
expect(result).toBe(expected);
expect(result).toEqual(expected);
});
});
});

View File

@ -263,7 +263,7 @@ describe("MultiStats", () => {
});
it("returns string representation", () => {
expect(result).toBe(
expect(result).toEqual(
"Hash: abc123xyz890\n" +
"Version: webpack 1.2.3\n" +
"Child abc123-compilation:\n" +

View File

@ -16,14 +16,14 @@ define("named4", [], function() {
define(["named1", "named2"], function(named1, named2) {
it("should load the named modules in defined dependencies", function() {
named1.should.be.eql("named1");
named2.should.be.eql("named2");
expect(named1).toBe("named1");
expect(named2).toBe("named2");
});
it("should load the named modules in require dependencies", function(done) {
require(["named3", "named4"], function (named3, named4) {
named3.should.be.eql("named3");
named4.should.be.eql("named4");
expect(named3).toBe("named3");
expect(named4).toBe("named4");
done();
});
});

View File

@ -16,14 +16,14 @@ define("named4", [], function() {
define("named1,named2".split(","), function(named1, named2) {
it("should load the named modules in const array defined dependencies", function() {
named1.should.be.eql("named1");
named2.should.be.eql("named2");
expect(named1).toBe("named1");
expect(named2).toBe("named2");
});
it("should load the named modules in const array require dependencies", function(done) {
require("named3,named4".split(","), function (named3, named4) {
named3.should.be.eql("named3");
named4.should.be.eql("named4");
expect(named3).toBe("named3");
expect(named4).toBe("named4");
done();
});
});

View File

@ -2,7 +2,7 @@ it("should handle circular chunks correctly", function(done) {
import(/* webpackChunkName: "a" */"./module-a").then(function(result) {
return result.default();
}).then(function(result2) {
result2.default().should.be.eql("x");
expect(result2.default()).toBe("x");
done();
}).catch(function(e) {
done(e);

View File

@ -7,12 +7,12 @@ it("should not bundle context requires with asyncMode === 'weak'", function() {
it("should find module with asyncMode === 'weak' when required elsewhere", function() {
var contextRequire = require.context(".", false, /.+/, "weak");
contextRequire("./three").should.be.eql(3);
expect(contextRequire("./three")).toBe(3);
require("./three"); // in a real app would be served as a separate chunk
});
it("should find module with asyncMode === 'weak' when required elsewhere (recursive)", function() {
var contextRequire = require.context(".", true, /.+/, "weak");
contextRequire("./dir/four").should.be.eql(4);
expect(contextRequire("./dir/four")).toBe(4);
require("./dir/four"); // in a real app would be served as a separate chunk
});

View File

@ -1,9 +1,9 @@
it("should also work in a chunk", function(done) {
require.ensure([], function(require) {
var contextRequire = require.context(".", false, /two/);
contextRequire("./two").should.be.eql(2);
expect(contextRequire("./two")).toBe(2);
var tw = "tw";
require("." + "/" + tw + "o").should.be.eql(2);
expect(require("." + "/" + tw + "o")).toBe(2);
done();
});
});

View File

@ -2,11 +2,11 @@ function testCase(load, done) {
load("two", 2, function() {
var sync = true;
load("one", 1, function() {
sync.should.be.eql(false);
expect(sync).toBe(false);
load("three", 3, function() {
var sync = true;
load("two", 2, function() {
sync.should.be.eql(true);
expect(sync).toBe(true);
done();
});
Promise.resolve().then(function() {}).then(function() {}).then(function() {
@ -23,7 +23,7 @@ function testCase(load, done) {
it("should be able to use expressions in import", function(done) {
function load(name, expected, callback) {
import("./dir/" + name).then(function(result) {
result.should.be.eql({ default: expected });
expect(result).toEqual({ default: expected });
callback();
}).catch(function(err) {
done(err);

View File

@ -1,6 +1,6 @@
it("should be able to use import", function(done) {
import("./two").then(function(two) {
two.should.be.eql({ default: 2 });
expect(two).toEqual({ default: 2 });
done();
}).catch(function(err) {
done(err);

View File

@ -106,16 +106,16 @@ function testChunkLoading(load, expectedSyncInitial, expectedSyncRequested) {
var sync = false;
var syncInitial = true;
var p = Promise.all([load("a"), load("b")]).then(function() {
syncInitial.should.be.eql(expectedSyncInitial);
expect(syncInitial).toBe(expectedSyncInitial);
sync = true;
var p = Promise.all([
load("a").then(function(a) {
a.should.be.eql({ default: "a" });
sync.should.be.eql(true);
expect(a).toEqual({ default: "a" });
expect(sync).toBe(true);
}),
load("c").then(function(c) {
c.should.be.eql({ default: "c" });
sync.should.be.eql(expectedSyncRequested);
expect(c).toEqual({ default: "c" });
expect(sync).toBe(expectedSyncRequested);
})
]);
Promise.resolve().then(function(){}).then(function(){}).then(function(){}).then(function(){

View File

@ -1,7 +1,7 @@
it("should be able to use expressions in import (directory)", function(done) {
function load(name, expected, callback) {
import("./dir/" + name + "/file.js").then(function(result) {
result.should.be.eql({ default: expected });
expect(result).toEqual({ default: expected });
callback();
}).catch(function(err) {
done(err);

View File

@ -2,11 +2,11 @@ var should = require("should");
it("should handle bound function expressions", function(done) {
require.ensure([], function(require) {
this.should.be.eql({ test: true });
expect(this).toEqual({ test: true });
require("./empty?test");
process.nextTick.should.have.type("function"); // check if injection still works
require.ensure([], function(require) {
this.should.be.eql({ test: true });
expect(this).toEqual({ test: true });
done();
}.bind(this));
}.bind({test: true}));
@ -21,7 +21,7 @@ it("should handle require.ensure without function expression", function(done) {
it("should parse expression in require.ensure, which isn't a function expression", function(done) {
require.ensure([], (function() {
require("./empty?require.ensure:test").should.be.eql({});
expect(require("./empty?require.ensure:test")).toEqual({});
return function f() {
done();
};
@ -36,7 +36,7 @@ it("should accept a require.include call", function(done) {
});
setImmediate(function() {
should.strictEqual(value, "require.include");
value.should.be.eql("require.include");
expect(value).toBe("require.include");
done();
});
});

View File

@ -1,3 +1,3 @@
require.ensure(["./a"], function(require) {
require("./a").should.be.eql("a");
expect(require("./a")).toBe("a");
})

View File

@ -1,3 +1,3 @@
require.ensure(["./b"], function(require) {
require("./b").should.be.eql("a");
expect(require("./b")).toBe("a");
})

View File

@ -21,7 +21,7 @@ it("should not load a chunk which is included in a already loaded one", function
var asyncFlag = false;
require.ensure(["./empty?x", "./empty?y", "./empty?z"], function(require) {
try {
asyncFlag.should.be.eql(true);
expect(asyncFlag).toBe(true);
loadChunk();
} catch(e) {
done(e);
@ -34,7 +34,7 @@ it("should not load a chunk which is included in a already loaded one", function
var sync = true;
require.ensure(["./empty?x", "./empty?y"], function(require) {
try {
sync.should.be.eql(true);
expect(sync).toBe(true);
done();
} catch(e) {
done(e);

View File

@ -18,7 +18,7 @@ it("should not include a module with a weak dependency using context", function(
resolveWeakB.should.exist;
resolveWeakC.should.exist;
a.should.be.eql(false);
b.should.be.eql(false);
c.should.be.eql(true);
expect(a).toBe(false);
expect(b).toBe(false);
expect(c).toBe(true);
});

View File

@ -6,8 +6,8 @@ it("should not include a module with a weak dependency", function() {
require(["./c"]);
require("./d");
a.should.be.eql(false);
b.should.be.eql(true);
c.should.be.eql(false);
d.should.be.eql(true);
expect(a).toBe(false);
expect(b).toBe(true);
expect(c).toBe(false);
expect(d).toBe(true);
});

View File

@ -1,6 +1,6 @@
it("should handle reference to entry chunk correctly", function(done) {
import(/* webpackChunkName: "main" */"./module-a").then(function(result) {
result.default.should.be.eql("ok");
expect(result.default).toBe("ok");
done();
}).catch(function(e) {
done(e);

View File

@ -1,12 +1,12 @@
it("should load a duplicate module with different dependencies correctly", function(done) {
var a = require("bundle-loader!./a/file");
var b = require("bundle-loader!./b/file");
(typeof a).should.be.eql("function");
(typeof b).should.be.eql("function");
expect((typeof a)).toBe("function");
expect((typeof b)).toBe("function");
a(function(ra) {
ra.should.be.eql("a");
expect(ra).toBe("a");
b(function(rb) {
rb.should.be.eql("b");
expect(rb).toBe("b");
done();
})
});

View File

@ -1,6 +1,6 @@
it("should load a duplicate module with different dependencies correctly", function() {
var dedupe1 = require("./dedupe1");
var dedupe2 = require("./dedupe2");
dedupe1.should.be.eql("dedupe1");
dedupe2.should.be.eql("dedupe2");
expect(dedupe1).toBe("dedupe1");
expect(dedupe2).toBe("dedupe2");
});

View File

@ -1,12 +1,12 @@
it("should resolve the alias in package.json", function() {
require("app/file").default.should.be.eql("file");
expect(require("app/file").default).toBe("file");
});
it("should resolve the alias and extensions in package.json", function() {
require("app/file2").default.should.be.eql("correct file2");
expect(require("app/file2").default).toBe("correct file2");
});
it("should resolve the alias in package.json", function() {
require("thing").default.should.be.eql("the thing");
expect(require("thing").default).toBe("the thing");
});

View File

@ -3,5 +3,5 @@ function get(name) {
}
it("should automatically infer the index.js file", function() {
get("module").should.be.eql("module");
expect(get("module")).toBe("module");
});

View File

@ -7,7 +7,7 @@ it("should support an empty context", function() {
(function() {
c("");
}).should.throw();
c.keys().should.be.eql([]);
expect(c.keys()).toEqual([]);
});
// This would be a useful testcase, but it requires an (really) empty directory.
@ -21,5 +21,5 @@ it("should support an empty context", function() {
(function() {
c("");
}).should.throw();
c.keys().should.be.eql([]);
expect(c.keys()).toEqual([]);
});*/

View File

@ -1,4 +1,4 @@
it("should not use regexps with the g flag", function() {
require.context("./folder", true, /a/).keys().length.should.be.eql(1);
require.context("./folder", true, /a/g).keys().length.should.be.eql(0);
expect(require.context("./folder", true, /a/).keys().length).toBe(1);
expect(require.context("./folder", true, /a/g).keys().length).toBe(0);
});

View File

@ -1,7 +1,7 @@
it("should emit valid code for dynamic require string with expr", function() {
var test = require("./folder/file");
test("file").should.be.eql({ a: false, b: false, c: true, d: true });
test("file.js").should.be.eql({ a: false, b: false, c: false, d: true });
test("./file").should.be.eql({ a: true, b: true, c: false, d: false });
test("./file.js").should.be.eql({ a: false, b: false, c: false, d: false });
expect(test("file")).toEqual({ a: false, b: false, c: true, d: true });
expect(test("file.js")).toEqual({ a: false, b: false, c: false, d: true });
expect(test("./file")).toEqual({ a: true, b: true, c: false, d: false });
expect(test("./file.js")).toEqual({ a: false, b: false, c: false, d: false });
});

View File

@ -1,8 +1,8 @@
it("should require json via require", function() {
({ data: require("./a.json") }).should.be.eql({ data: null });
({ data: require("./b.json") }).should.be.eql({ data: 123 });
({ data: require("./c.json") }).should.be.eql({ data: [1, 2, 3, 4] });
({ data: require("./e.json") }).should.be.eql({ data: {
({ data: require("./a.json") }expect()).toEqual({ data: null });
({ data: require("./b.json") }expect()).toEqual({ data: 123 });
({ data: require("./c.json") }expect()).toEqual({ data: [1, 2, 3, 4] });
({ data: require("./e.json") }expect()).toEqual({ data: {
"aa": 1,
"bb": 2,
"1": "x"

View File

@ -5,12 +5,12 @@ import f, { named } from "../data/f.json";
import g, { named as gnamed } from "../data/g.json";
it("should be possible to import json data", function() {
c[2].should.be.eql(3);
Object.keys(d).should.be.eql(["default"]);
aa.should.be.eql(1);
bb.should.be.eql(2);
named.should.be.eql("named");
({ f }).should.be.eql({
expect(c[2]).toBe(3);
expect(Object.keys(d)).toEqual(["default"]);
expect(aa).toBe(1);
expect(bb).toBe(2);
expect(named).toBe("named");
({ f }expect()).toEqual({
f: {
__esModule: true,
default: "default",

View File

@ -6,16 +6,16 @@ import e from "../data/e.json";
import f from "../data/f.json";
it("should be possible to import json data", function() {
({a}).should.be.eql({a: null});
b.should.be.eql(123);
c.should.be.eql([1, 2, 3, 4]);
d.should.be.eql({});
e.should.be.eql({
({a}expect()).toEqual({a: null});
expect(b).toBe(123);
expect(c).toEqual([1, 2, 3, 4]);
expect(d).toEqual({});
expect(e).toEqual({
aa: 1,
bb: 2,
"1": "x"
});
f.should.be.eql({
expect(f).toEqual({
named: "named",
"default": "default",
__esModule: true

View File

@ -1,14 +1,14 @@
it("should allow combinations of async and sync loaders", function() {
require("./loaders/syncloader!./a").should.be.eql("a");
require("./loaders/asyncloader!./a").should.be.eql("a");
expect(require("./loaders/syncloader!./a")).toBe("a");
expect(require("./loaders/asyncloader!./a")).toBe("a");
require("./loaders/syncloader!./loaders/syncloader!./a").should.be.eql("a");
require("./loaders/syncloader!./loaders/asyncloader!./a").should.be.eql("a");
require("./loaders/asyncloader!./loaders/syncloader!./a").should.be.eql("a");
require("./loaders/asyncloader!./loaders/asyncloader!./a").should.be.eql("a");
expect(require("./loaders/syncloader!./loaders/syncloader!./a")).toBe("a");
expect(require("./loaders/syncloader!./loaders/asyncloader!./a")).toBe("a");
expect(require("./loaders/asyncloader!./loaders/syncloader!./a")).toBe("a");
expect(require("./loaders/asyncloader!./loaders/asyncloader!./a")).toBe("a");
require("./loaders/asyncloader!./loaders/asyncloader!./loaders/asyncloader!./a").should.be.eql("a");
require("./loaders/asyncloader!./loaders/syncloader!./loaders/asyncloader!./a").should.be.eql("a");
require("./loaders/syncloader!./loaders/asyncloader!./loaders/syncloader!./a").should.be.eql("a");
require("./loaders/syncloader!./loaders/syncloader!./loaders/syncloader!./a").should.be.eql("a");
expect(require("./loaders/asyncloader!./loaders/asyncloader!./loaders/asyncloader!./a")).toBe("a");
expect(require("./loaders/asyncloader!./loaders/syncloader!./loaders/asyncloader!./a")).toBe("a");
expect(require("./loaders/syncloader!./loaders/asyncloader!./loaders/syncloader!./a")).toBe("a");
expect(require("./loaders/syncloader!./loaders/syncloader!./loaders/syncloader!./a")).toBe("a");
});

View File

@ -1,10 +1,10 @@
it("should handle the coffee loader correctly", function() {
require("!coffee-loader!../_resources/script.coffee").should.be.eql("coffee test");
require("../_resources/script.coffee").should.be.eql("coffee test");
expect(require("!coffee-loader!../_resources/script.coffee")).toBe("coffee test");
expect(require("../_resources/script.coffee")).toBe("coffee test");
});
it("should handle literate coffee script correctly", function() {
require("!coffee-loader?literate!./script.coffee.md").should.be.eql("literate coffee test");
expect(require("!coffee-loader?literate!./script.coffee.md")).toBe("literate coffee test");
});
it("should generate valid code with cheap-source-map", function() {

View File

@ -1,5 +1,5 @@
it("should be able to use a context with a loader", function() {
var abc = "abc", scr = "script.coffee";
require("../_resources/" + scr).should.be.eql("coffee test");
require("raw-loader!../_resources/" + abc + ".txt").should.be.eql("abc");
expect(require("../_resources/" + scr)).toBe("coffee test");
expect(require("raw-loader!../_resources/" + abc + ".txt")).toBe("abc");
});

View File

@ -1,4 +1,4 @@
it("should handle the jade loader correctly", function() {
require("!jade-loader?self!../_resources/template.jade")({abc: "abc"}).should.be.eql("<p>selfabc</p><h1>included</h1>");
require("../_resources/template.jade")({abc: "abc"}).should.be.eql("<p>abc</p><h1>included</h1>");
require("!jade-loader?self!../_resources/template.jade")({abc: "abc"}expect()).toBe("<p>selfabc</p><h1>included</h1>");
require("../_resources/template.jade")({abc: "abc"}expect()).toBe("<p>abc</p><h1>included</h1>");
});

View File

@ -1,12 +1,12 @@
it("should run a loader from package.json", function() {
require("testloader!../_resources/abc.txt").should.be.eql("abcwebpack");
require("testloader/lib/loader2!../_resources/abc.txt").should.be.eql("abcweb");
require("testloader/lib/loader3!../_resources/abc.txt").should.be.eql("abcloader");
require("testloader/lib/loader-indirect!../_resources/abc.txt").should.be.eql("abcwebpack");
expect(require("testloader!../_resources/abc.txt")).toBe("abcwebpack");
expect(require("testloader/lib/loader2!../_resources/abc.txt")).toBe("abcweb");
expect(require("testloader/lib/loader3!../_resources/abc.txt")).toBe("abcloader");
expect(require("testloader/lib/loader-indirect!../_resources/abc.txt")).toBe("abcwebpack");
});
it("should run a loader from .webpack-loader.js extension", function() {
require("testloader/lib/loader!../_resources/abc.txt").should.be.eql("abcwebpack");
expect(require("testloader/lib/loader!../_resources/abc.txt")).toBe("abcwebpack");
});
it("should be able to pipe loaders", function() {
require("testloader!./reverseloader!../_resources/abc.txt").should.be.eql("cbawebpack");
expect(require("testloader!./reverseloader!../_resources/abc.txt")).toBe("cbawebpack");
});

View File

@ -1,6 +1,6 @@
it("should pass query to loader", function() {
var result = require("./loaders/queryloader?query!./a?resourcequery");
result.should.be.eql({
expect(result).toEqual({
resourceQuery: "?resourcequery",
query: "?query",
prev: "module.exports = \"a\";"
@ -9,7 +9,7 @@ it("should pass query to loader", function() {
it("should pass query to loader without resource with resource query", function() {
var result = require("./loaders/queryloader?query!?resourcequery");
result.should.be.eql({
expect(result).toEqual({
resourceQuery: "?resourcequery",
query: "?query",
prev: null
@ -18,7 +18,7 @@ it("should pass query to loader without resource with resource query", function(
it("should pass query to loader without resource", function() {
var result = require("./loaders/queryloader?query!");
result.should.be.eql({
expect(result).toEqual({
query: "?query",
prev: null
});
@ -39,7 +39,7 @@ it("should pass query to multiple loaders", function() {
it("should pass query to loader over context", function() {
var test = "test";
var result = require("./loaders/queryloader?query!./context-query-test/" + test);
result.should.be.eql({
expect(result).toEqual({
resourceQuery: "",
query: "?query",
prev: "test content"

View File

@ -1,3 +1,3 @@
it("should handle the raw loader correctly", function() {
require("raw-loader!../_resources/abc.txt").should.be.eql("abc");
expect(require("raw-loader!../_resources/abc.txt")).toBe("abc");
});

View File

@ -5,26 +5,26 @@ import { ns, default as def1, def as def2, data as data2 } from "./reexport.mjs"
import * as reexport from "./reexport.mjs";
it("should get correct values when importing named exports from a CommonJs module from mjs", function() {
(typeof data).should.be.eql("undefined");
({ data }).should.be.eql({ data: undefined });
def.should.be.eql({
expect((typeof data)).toBe("undefined");
({ data }expect()).toEqual({ data: undefined });
expect(def).toEqual({
data: "ok",
default: "default"
});
({ def }).should.be.eql({
({ def }expect()).toEqual({
def: {
data: "ok",
default: "default"
}
});
const valueOf = "valueOf";
star[valueOf]().should.be.eql({
expect(star[valueOf]()).toEqual({
default: {
data: "ok",
default: "default"
}
});
({ star }).should.be.eql({
({ star }expect()).toEqual({
star: {
default: {
data: "ok",
@ -32,26 +32,26 @@ it("should get correct values when importing named exports from a CommonJs modul
}
}
});
star.default.should.be.eql({
expect(star.default).toEqual({
data: "ok",
default: "default"
});
ns.should.be.eql({
expect(ns).toEqual({
default: {
data: "ok",
default: "default"
}
});
def1.should.be.eql({
expect(def1).toEqual({
data: "ok",
default: "default"
});
def2.should.be.eql({
expect(def2).toEqual({
data: "ok",
default: "default"
});
(typeof data2).should.be.eql("undefined");
reexport[valueOf]().should.be.eql({
expect((typeof data2)).toBe("undefined");
expect(reexport[valueOf]()).toEqual({
ns: {
default: {
data: "ok",

View File

@ -1,13 +1,13 @@
it("should receive a namespace object when importing commonjs", function(done) {
import("./cjs.js").then(function(result) {
result.should.be.eql({ default: { named: "named", default: "default" } });
expect(result).toEqual({ default: { named: "named", default: "default" } });
done();
}).catch(done);
});
it("should receive a namespace object when importing commonjs with __esModule", function(done) {
import("./cjs-esmodule.js").then(function(result) {
result.should.be.eql({ default: { __esModule: true, named: "named", default: "default" } });
expect(result).toEqual({ default: { __esModule: true, named: "named", default: "default" } });
done();
}).catch(done);
});
@ -54,7 +54,7 @@ function contextMixed(name) {
function promiseTest(promise, equalsTo) {
return promise.then(function(results) {
for(const result of results)
result.should.be.eql(equalsTo);
expect(result).toEqual(equalsTo);
});
}

View File

@ -1,13 +1,13 @@
it("should receive a namespace object when importing commonjs", function(done) {
import("./cjs").then(function(result) {
result.should.be.eql({ default: { named: "named", default: "default" } });
expect(result).toEqual({ default: { named: "named", default: "default" } });
done();
}).catch(done);
});
it("should receive a namespace object when importing commonjs with __esModule", function(done) {
import("./cjs-esmodule").then(function(result) {
result.should.be.eql({ __esModule: true, named: "named", default: "default" });
expect(result).toEqual({ __esModule: true, named: "named", default: "default" });
done();
}).catch(done);
});
@ -54,7 +54,7 @@ function contextMixed(name) {
function promiseTest(promise, equalsTo) {
return promise.then(function(results) {
for(const result of results)
result.should.be.eql(equalsTo);
expect(result).toEqual(equalsTo);
});
}

View File

@ -7,7 +7,7 @@ it("should load script with nonce 'nonce1234'", function(done) {
// if in browser context, test that nonce was added.
if (typeof document !== 'undefined') {
var script = document.querySelector('script[src="js/chunk-with-nonce.web.js"]');
script.getAttribute('nonce').should.be.eql('nonce1234');
expect(script.getAttribute('nonce')).toBe('nonce1234');
}
__webpack_nonce__ = undefined;
done();
@ -21,7 +21,7 @@ it("should load script without nonce", function(done) {
// if in browser context, test that nonce was added.
if (typeof document !== 'undefined') {
var script = document.querySelector('script[src="js/chunk-without-nonce.web.js"]');
script.hasAttribute('nonce').should.be.eql(false);
expect(script.hasAttribute('nonce')).toBe(false);
}
__webpack_nonce__ = undefined;
done();

View File

@ -2,6 +2,6 @@ import { log } from "pmodule/tracker";
import { a } from "pmodule";
it("should not evaluate a chain of modules", function() {
a.should.be.eql("a");
log.should.be.eql(["a.js"]);
expect(a).toBe("a");
expect(log).toEqual(["a.js"]);
});

View File

@ -3,9 +3,9 @@ import { a, x, z } from "pmodule";
import def from "pmodule";
it("should evaluate all modules", function() {
def.should.be.eql("def");
a.should.be.eql("a");
x.should.be.eql("x");
z.should.be.eql("z");
log.should.be.eql(["a.js", "b.js", "c.js", "index.js"]);
expect(def).toBe("def");
expect(a).toBe("a");
expect(x).toBe("x");
expect(z).toBe("z");
expect(log).toEqual(["a.js", "b.js", "c.js", "index.js"]);
});

View File

@ -2,7 +2,7 @@ import { log } from "pmodule/tracker";
import { a, z } from "pmodule";
it("should not evaluate an immediate module", function() {
a.should.be.eql("a");
z.should.be.eql("z");
log.should.be.eql(["a.js", "c.js"]);
expect(a).toBe("a");
expect(z).toBe("z");
expect(log).toEqual(["a.js", "c.js"]);
});

View File

@ -2,5 +2,5 @@ import * as m from "m";
it("should handle unknown exports fine", function() {
var x = m;
x.should.be.eql({ foo: "foo" });
expect(x).toEqual({ foo: "foo" });
});

View File

@ -2,8 +2,8 @@ import { log } from "pmodule/tracker";
import { a, x, z } from "pmodule";
it("should evaluate all modules", function() {
a.should.be.eql("a");
x.should.be.eql("x");
z.should.be.eql("z");
log.should.be.eql(["a.js", "b.js", "c.js"]);
expect(a).toBe("a");
expect(x).toBe("x");
expect(z).toBe("z");
expect(log).toEqual(["a.js", "b.js", "c.js"]);
});

View File

@ -3,8 +3,8 @@ import { x, z } from "pmodule";
import def from "pmodule";
it("should not evaluate a simple unused module", function() {
def.should.be.eql("def");
x.should.be.eql("x");
z.should.be.eql("z");
log.should.be.eql(["b.js", "c.js", "index.js"]);
expect(def).toBe("def");
expect(x).toBe("x");
expect(z).toBe("z");
expect(log).toEqual(["b.js", "c.js", "index.js"]);
});

View File

@ -2,7 +2,7 @@ import { log } from "pmodule/tracker";
import { a, y } from "pmodule";
it("should not evaluate a reexporting transitive module", function() {
a.should.be.eql("a");
y.should.be.eql("y");
log.should.be.eql(["a.js", "b.js"]);
expect(a).toBe("a");
expect(y).toBe("y");
expect(log).toEqual(["a.js", "b.js"]);
});

View File

@ -1,5 +1,5 @@
import { test } from "./a";
it("should correctly tree shake star exports", function() {
test.should.be.eql(123);
expect(test).toBe(123);
});

View File

@ -2,7 +2,7 @@ import { test } from "./a";
import { func1, func3 } from "./x";
it("should correctly tree shake star exports", function() {
test.should.be.eql(123);
func1().should.be.eql("func1");
func3().should.be.eql("func3");
expect(test).toBe(123);
expect(func1()).toBe("func1");
expect(func3()).toBe("func3");
});

View File

@ -3,10 +3,10 @@ import { aa as aa2, d } from "./root3";
var root6 = require("./root6");
it("should correctly tree shake star exports", function() {
aa.should.be.eql("aa");
aa2.should.be.eql("aa");
d.should.be.eql("d");
root6.should.be.eql({
expect(aa).toBe("aa");
expect(aa2).toBe("aa");
expect(d).toBe("d");
expect(root6).toEqual({
aa: "aa",
c: "c"
});

View File

@ -1,5 +1,5 @@
it("should name require in define correctly", function() {
define(["require"], function(require) {
(typeof require).should.be.eql("function");
expect((typeof require)).toBe("function");
});
});

View File

@ -1,9 +1,9 @@
it("should load a utf-8 file with BOM", function() {
var result = require("./bomfile");
result.should.be.eql("ok");
expect(result).toEqual("ok");
});
it("should load a css file with BOM", function() {
var css = require("!css-loader!./bomfile.css") + "";
css.should.be.eql("body{color:#abc}");
expect(css).toBe("body{color:#abc}");
});

View File

@ -10,5 +10,5 @@ it("should be able to parse browserified modules (UMD)", function() {
},{}]},{},[1])
(1)
});
module.exports.should.be.eql(1234);
expect(module.exports).toBe(1234);
});

View File

@ -1,7 +1,7 @@
it("should parse a Coffeescript style function expression in require.ensure", function(done) {
require.ensure([], (function(_this) {
return function(require) {
require("./file").should.be.eql("ok");
expect(require("./file")).toBe("ok");
done();
};
}(this)));
@ -9,28 +9,28 @@ it("should parse a Coffeescript style function expression in require.ensure", fu
it("should parse a bound function expression in require.ensure", function(done) {
require.ensure([], function(require) {
require("./file").should.be.eql("ok");
expect(require("./file")).toBe("ok");
done();
}.bind(this));
});
it("should parse a string in require.ensure", function(done) {
require.ensure("./file", function(require) {
require("./file").should.be.eql("ok");
expect(require("./file")).toBe("ok");
done();
});
});
it("should parse a string in require.ensure with arrow function expression", function(done) {
require.ensure("./file", require => {
require("./file").should.be.eql("ok");
expect(require("./file")).toBe("ok");
done();
});
});
it("should parse a string in require.ensure with arrow function array expression", function(done) {
require.ensure("./file", require => (require("./file").should.be.eql("ok"), done()));
require.ensure("./file", require =>expect( (require("./file")).toBe("ok"), done()));
});

View File

@ -1,12 +1,12 @@
import X, { A, B } from "./module";
it("should parse classes", function() {
new X().a.should.be.eql("ok");
new A().a.should.be.eql("ok");
new B().a.should.be.eql("ok");
expect(new X().a).toBe("ok");
expect(new A().a).toBe("ok");
expect(new B().a).toBe("ok");
});
it("should parse methods", function() {
new X().b().should.be.eql("ok");
X.c().should.be.eql("ok");
expect(new X().b()).toBe("ok");
expect(X.c()).toBe("ok");
});

View File

@ -1,28 +1,28 @@
it("should be able to load a file with the require.context method", function() {
require.context("./templates")("./tmpl").should.be.eql("test template");
(require.context("./././templates"))("./tmpl").should.be.eql("test template");
(require.context("././templates/.")("./tmpl")).should.be.eql("test template");
require.context("./loaders/queryloader?dog=bark!./templates?cat=meow")("./tmpl").should.be.eql({
expect(require.context("./templates")("./tmpl")).toBe("test template");
expect((require.context("./././templates"))("./tmpl")).toBe("test template");
expect((require.context("././templates/.")("./tmpl"))).toBe("test template");
expect(require.context("./loaders/queryloader?dog=bark!./templates?cat=meow")("./tmpl")).toEqual({
resourceQuery: "?cat=meow",
query: "?dog=bark",
prev: "module.exports = \"test template\";"
});
require . context ( "." + "/." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" ).should.be.eql("subdir test template");
require.context("./templates", true, /./)("xyz").should.be.eql("xyz");
expect(require . context ( "." + "/." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" )).toBe("subdir test template");
expect(require.context("./templates", true, /./)("xyz")).toBe("xyz");
});
it("should automatically create contexts", function() {
var template = "tmpl", templateFull = "./tmpl.js";
var mp = "mp", tmp = "tmp", mpl = "mpl";
require("./templates/" + template).should.be.eql("test template");
require("./templates/" + tmp + "l").should.be.eql("test template");
require("./templates/t" + mpl).should.be.eql("test template");
require("./templates/t" + mp + "l").should.be.eql("test template");
expect(require("./templates/" + template)).toBe("test template");
expect(require("./templates/" + tmp + "l")).toBe("test template");
expect(require("./templates/t" + mpl)).toBe("test template");
expect(require("./templates/t" + mp + "l")).toBe("test template");
});
it("should be able to require.resolve with automatical context", function() {
var template = "tmpl";
require.resolve("./templates/" + template).should.be.eql(require.resolve("./templates/tmpl"));
expect(require.resolve("./templates/" + template)).toBe(require.resolve("./templates/tmpl"));
});
it("should be able to use renaming combined with a context", function() {
@ -30,7 +30,7 @@ it("should be able to use renaming combined with a context", function() {
require = function () {};
require("fail");
var template = "tmpl";
renamedRequire("./templates/" + template).should.be.eql("test template");
expect(renamedRequire("./templates/" + template)).toBe("test template");
});
it("should compile an empty context", function() {

View File

@ -19,21 +19,21 @@ it("should parse classes", function() {
var x = new MyClass();
x.a.should.be.eql("a");
x.func().should.be.eql("b");
x.c().should.be.eql("c");
expect(x.a).toBe("a");
expect(x.func()).toBe("b");
expect(x.c()).toBe("c");
});
it("should parse spread operator"/*, function() {
[0, ...require("./array")].should.be.eql([0, 1, 2, 3]);
({z: 0, ...require("./object")}).should.be.eql({z: 0, a: 1, b: 2, c: 3});
expect([0, ...require("./array")]).toEqual([0, 1, 2, 3]);
({z: 0, ...require("./object")}expect()).toEqual({z: 0, a: 1, b: 2, c: 3});
}*/);
it("should parse arrow function", function() {
(() => require("./a"))().should.be.eql("a");
(() =>expect( require("./a"))()).toBe("a");
(() => {
return require("./a");
})().should.be.eql("a");
}expect()()).toBe("a");
require.ensure([], () => {
require("./a");
});
@ -53,8 +53,8 @@ it("should parse template literals", function() {
}
var x = `a${require("./b")}c`;
var y = tag`a${require("./b")}c`;
x.should.be.eql("abc");
y.should.be.eql("b");
expect(x).toBe("abc");
expect(y).toBe("b");
})
it("should parse generators and yield", function() {
@ -63,7 +63,7 @@ it("should parse generators and yield", function() {
yield require("./b");
}
var x = gen();
x.next().value.should.be.eql("a");
x.next().value.should.be.eql("b");
x.next().done.should.be.eql(true);
expect(x.next().value).toBe("a");
expect(x.next().value).toBe("b");
expect(x.next().done).toBe(true);
})

View File

@ -7,7 +7,7 @@ it("should evaluate null", function() {
if("shouldn't evaluate expression", function() {
var value = "";
var x = (value + "") ? "fail" : "ok";
x.should.be.eql("ok");
expect(x).toBe("ok");
});
it("should short-circut evaluating", function() {
@ -18,5 +18,5 @@ it("should short-circut evaluating", function() {
it("should evaluate __dirname and __resourceQuery with replace and substr", function() {
var result = require("./resourceQuery/index?" + __dirname);
result.should.be.eql("?resourceQuery");
expect(result).toEqual("?resourceQuery");
});

View File

@ -20,36 +20,36 @@ it("should parse fancy function calls with arrow functions", function() {
it("should parse fancy AMD calls with arrow functions", function() {
require("./constructor ./a".split(" "));
require("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), (require, module, exports, constructor, a) => {
(typeof require).should.be.eql("function");
(typeof module).should.be.eql("object");
(typeof exports).should.be.eql("object");
(typeof require("./constructor")).should.be.eql("function");
(typeof constructor).should.be.eql("function");
a.should.be.eql("a");
expect((typeof require)).toBe("function");
expect((typeof module)).toBe("object");
expect((typeof exports)).toBe("object");
expect((typeof require("./constructor"))).toBe("function");
expect((typeof constructor)).toBe("function");
expect(a).toBe("a");
});
define("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), (require, module, exports, constructor, a) => {
(typeof require).should.be.eql("function");
(typeof module).should.be.eql("object");
(typeof exports).should.be.eql("object");
(typeof require("./constructor")).should.be.eql("function");
(typeof constructor).should.be.eql("function");
a.should.be.eql("a");
expect((typeof require)).toBe("function");
expect((typeof module)).toBe("object");
expect((typeof exports)).toBe("object");
expect((typeof require("./constructor"))).toBe("function");
expect((typeof constructor)).toBe("function");
expect(a).toBe("a");
});
});
it("should be able to use AMD-style require with arrow functions", function(done) {
var template = "b";
require(["./circular", "./templates/" + template, true ? "./circular" : "fail"], (circular, testTemplate, circular2) => {
circular.should.be.eql(1);
circular2.should.be.eql(1);
testTemplate.should.be.eql("b");
expect(circular).toBe(1);
expect(circular2).toBe(1);
expect(testTemplate).toBe("b");
done();
});
});
it("should be able to use require.js-style define with arrow functions", function(done) {
define("name", ["./circular"], (circular) => {
circular.should.be.eql(1);
expect(circular).toBe(1);
done();
});
});
@ -63,14 +63,14 @@ it("should be able to use require.js-style define, optional dependancies, not ex
it("should be able to use require.js-style define, special string, with arrow function", function(done) {
define(["require"], (require) => {
require("./circular").should.be.eql(1);
expect(require("./circular")).toBe(1);
done();
});
});
it("should be able to use require.js-style define, without name, with arrow function", function(done) {
true && define(["./circular"], (circular) => {
circular.should.be.eql(1);
expect(circular).toBe(1);
done();
});
});
@ -91,17 +91,17 @@ it("should offer AMD-style define for CommonJs with arrow function", function(do
var _test_exports = exports;
var _test_module = module;
define((require, exports, module) => {
(typeof require).should.be.eql("function");
expect((typeof require)).toBe("function");
exports.should.be.equal(_test_exports);
module.should.be.equal(_test_module);
require("./circular").should.be.eql(1);
expect(require("./circular")).toBe(1);
done();
});
});
it("should pull in all dependencies of an AMD module with arrow function", function(done) {
define((require) => {
require("./amdmodule").should.be.eql("a");
expect(require("./amdmodule")).toBe("a");
done();
});
});
@ -109,9 +109,9 @@ it("should pull in all dependencies of an AMD module with arrow function", funct
it("should create a chunk for require.js require, with arrow function", function(done) {
var sameTick = true;
require(["./c"], (c) => {
sameTick.should.be.eql(false);
c.should.be.eql("c");
require("./d").should.be.eql("d");
expect(sameTick).toBe(false);
expect(c).toBe("c");
expect(require("./d")).toBe("d");
done();
});
sameTick = false;

View File

@ -20,36 +20,36 @@ it("should parse fancy function calls", function() {
it("should parse fancy AMD calls", function() {
require("./constructor ./a".split(" "));
require("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), function(require, module, exports, constructor, a) {
(typeof require).should.be.eql("function");
(typeof module).should.be.eql("object");
(typeof exports).should.be.eql("object");
(typeof require("./constructor")).should.be.eql("function");
(typeof constructor).should.be.eql("function");
a.should.be.eql("a");
expect((typeof require)).toBe("function");
expect((typeof module)).toBe("object");
expect((typeof exports)).toBe("object");
expect((typeof require("./constructor"))).toBe("function");
expect((typeof constructor)).toBe("function");
expect(a).toBe("a");
});
define("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), function(require, module, exports, constructor, a) {
(typeof require).should.be.eql("function");
(typeof module).should.be.eql("object");
(typeof exports).should.be.eql("object");
(typeof require("./constructor")).should.be.eql("function");
(typeof constructor).should.be.eql("function");
a.should.be.eql("a");
expect((typeof require)).toBe("function");
expect((typeof module)).toBe("object");
expect((typeof exports)).toBe("object");
expect((typeof require("./constructor"))).toBe("function");
expect((typeof constructor)).toBe("function");
expect(a).toBe("a");
});
});
it("should be able to use AMD-style require", function(done) {
var template = "b";
require(["./circular", "./templates/" + template, true ? "./circular" : "fail"], function(circular, testTemplate, circular2) {
circular.should.be.eql(1);
circular2.should.be.eql(1);
testTemplate.should.be.eql("b");
expect(circular).toBe(1);
expect(circular2).toBe(1);
expect(testTemplate).toBe("b");
done();
});
});
it("should be able to use require.js-style define", function(done) {
define("name", ["./circular"], function(circular) {
circular.should.be.eql(1);
expect(circular).toBe(1);
done();
});
});
@ -63,14 +63,14 @@ it("should be able to use require.js-style define, optional dependancies, not ex
it("should be able to use require.js-style define, special string", function(done) {
define(["require"], function(require) {
require("./circular").should.be.eql(1);
expect(require("./circular")).toBe(1);
done();
});
});
it("should be able to use require.js-style define, without name", function(done) {
true && define(["./circular"], function(circular) {
circular.should.be.eql(1);
expect(circular).toBe(1);
done();
});
});
@ -120,10 +120,10 @@ it("should offer AMD-style define for CommonJs", function(done) {
var _test_exports = exports;
var _test_module = module;
define(function(require, exports, module) {
(typeof require).should.be.eql("function");
expect((typeof require)).toBe("function");
exports.should.be.equal(_test_exports);
module.should.be.equal(_test_module);
require("./circular").should.be.eql(1);
expect(require("./circular")).toBe(1);
done();
});
});
@ -140,7 +140,7 @@ it("should be able to use AMD require without function expression (empty array)"
it("should be able to use AMD require without function expression", function(done) {
require(["./circular"], fn);
function fn(c) {
c.should.be.eql(1);
expect(c).toBe(1);
done();
}
});
@ -148,9 +148,9 @@ it("should be able to use AMD require without function expression", function(don
it("should create a chunk for require.js require", function(done) {
var sameTick = true;
require(["./c"], function(c) {
sameTick.should.be.eql(false);
c.should.be.eql("c");
require("./d").should.be.eql("d");
expect(sameTick).toBe(false);
expect(c).toBe("c");
expect(require("./d")).toBe("d");
done();
});
sameTick = false;
@ -170,34 +170,34 @@ it("should not fail #138", function(done) {
it("should parse a bound function expression 1", function(done) {
define(function(a, require, exports, module) {
a.should.be.eql(123);
(typeof require).should.be.eql("function");
require("./a").should.be.eql("a");
expect(a).toBe(123);
expect((typeof require)).toBe("function");
expect(require("./a")).toBe("a");
done();
}.bind(null, 123));
});
it("should parse a bound function expression 2", function(done) {
define("name", function(a, require, exports, module) {
a.should.be.eql(123);
(typeof require).should.be.eql("function");
require("./a").should.be.eql("a");
expect(a).toBe(123);
expect((typeof require)).toBe("function");
expect(require("./a")).toBe("a");
done();
}.bind(null, 123));
});
it("should parse a bound function expression 3", function(done) {
define(["./a"], function(number, a) {
number.should.be.eql(123);
a.should.be.eql("a");
expect(number).toBe(123);
expect(a).toBe("a");
done();
}.bind(null, 123));
});
it("should parse a bound function expression 4", function(done) {
define("name", ["./a"], function(number, a) {
number.should.be.eql(123);
a.should.be.eql("a");
expect(number).toBe(123);
expect(a).toBe("a");
done();
}.bind(null, 123));
});
@ -205,21 +205,21 @@ it("should parse a bound function expression 4", function(done) {
it("should not fail issue #138 second", function() {
(function(define, global) { 'use strict';
define(function (require) {
(typeof require).should.be.eql("function");
require("./a").should.be.eql("a");
expect((typeof require)).toBe("function");
expect(require("./a")).toBe("a");
return "#138 2.";
});
})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, this);
module.exports.should.be.eql("#138 2.");
expect(module.exports).toBe("#138 2.");
});
it("should parse an define with empty array and object", function() {
var obj = {ok: 95476};
define([], obj);
module.exports.should.be.eql(obj);
expect(module.exports).toBe(obj);
});
it("should parse an define with object", function() {
var obj = {ok: 76243};
define(obj);
module.exports.should.be.eql(obj);
expect(module.exports).toBe(obj);
});

View File

@ -1,13 +1,13 @@
var should = require("should");
function testCase(number) {
require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule").should.be.eql("file" + number);
expect(require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule")).toBe("file" + number);
require(
number === 1 ? "./folder/file1" :
number === 2 ? "./folder/file2" :
number === 3 ? "./folder/file3" :
"./missingModule"
).should.be.eql("file" + number);
expect()).toBe("file" + number);
}
it("should parse complex require calls", function() {
@ -16,24 +16,24 @@ it("should parse complex require calls", function() {
});
it("should let the user hide the require function", function() {
(function(require) { return require; }(1234)).should.be.eql(1234);
(function(require) { return require; }expect((1234))).toBe(1234);
function testFunc(abc, require) {
return require;
}
testFunc(333, 678).should.be.eql(678);
expect(testFunc(333, 678)).toBe(678);
(function() {
var require = 123;
require.should.be.eql(123);
expect(require).toBe(123);
}());
(function() {
function require() {
return 123;
};
require("error").should.be.eql(123);
expect(require("error")).toBe(123);
}());
(function() {
var module = 1233;
module.should.be.eql(1233);
expect(module).toBe(1233);
}());
});

View File

@ -1,4 +1,4 @@
it("should result in a warning when using module.exports in harmony module", function() {
var x = require("./module1");
x.should.be.eql({default: 1234});
expect(x).toEqual({default: 1234});
});

View File

@ -4,9 +4,9 @@ import "./module";
module.exports = 1;
}).should.throw();
(typeof module.exports).should.be.eql("undefined");
expect((typeof module.exports)).toBe("undefined");
(typeof define).should.be.eql("undefined");
expect((typeof define)).toBe("undefined");
(function() {
define(function() {})
}).should.throw(/define is not defined/);
@ -15,5 +15,5 @@ export default 1234;
if(eval("typeof exports !== \"undefined\"")) {
// exports is node.js exports and not webpacks
Object.keys(exports).should.be.eql([]);
expect(Object.keys(exports)).toEqual([]);
}

View File

@ -2,7 +2,7 @@ import { x, y } from "./b";
it("should pass when required by CommonJS module", function () {
var test1 = require('./a').default;
test1().should.be.eql("OK");
expect(test1()).toBe("OK");
});
it("should pass when use babeljs transpiler", function() {
@ -13,18 +13,18 @@ it("should pass when use babeljs transpiler", function() {
var _test2 = _interopRequireDefault(_test);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var test2 = (0, _test2.default)();
test2.should.be.eql("OK");
expect(test2).toBe("OK");
});
it("should double reexport from non-harmony modules correctly", function() {
y.should.be.eql("y");
x.should.be.eql("x");
expect(y).toBe("y");
expect(x).toBe("x");
});
import { a, b } from "./reexport"
it("should be possible to reexport a module with unknown exports", function() {
a.should.be.eql("a");
b.should.be.eql("b");
expect(a).toBe("a");
expect(b).toBe("b");
});

View File

@ -15,21 +15,21 @@ var y6 = require("./6?b").x;
var y7 = require("./7?b").x;
it("should not overwrite when using star export (known exports)", function() {
x1.should.be.eql("1");
x2.should.be.eql("1");
x3.should.be.eql("a");
x4.should.be.eql("b");
x5.should.be.eql("c");
x6.should.be.eql("a");
x7.should.be.eql("d");
expect(x1).toBe("1");
expect(x2).toBe("1");
expect(x3).toBe("a");
expect(x4).toBe("b");
expect(x5).toBe("c");
expect(x6).toBe("a");
expect(x7).toBe("d");
});
it("should not overwrite when using star export (unknown exports)", function() {
y1.should.be.eql("1");
y2.should.be.eql("1");
y3.should.be.eql("a");
y4.should.be.eql("b");
y5.should.be.eql("c");
y6.should.be.eql("a");
y7.should.be.eql("d");
expect(y1).toBe("1");
expect(y2).toBe("1");
expect(y3).toBe("a");
expect(y4).toBe("b");
expect(y5).toBe("c");
expect(y6).toBe("a");
expect(y7).toBe("d");
});

View File

@ -3,9 +3,9 @@ import x, { b } from "./b";
import { c, d } from "./fake-reexport";
it("should be able to use exported function", function() {
a.should.be.eql("ok");
b.should.be.eql("ok");
x().should.be.eql("ok");
c.should.be.eql("ok");
d.should.be.eql("ok");
expect(a).toBe("ok");
expect(b).toBe("ok");
expect(x()).toBe("ok");
expect(c).toBe("ok");
expect(d).toBe("ok");
});

View File

@ -4,6 +4,6 @@ it("should hoist exports", function() {
var result = require("./foo").default;
(typeof result.foo).should.have.eql("function");
(typeof result.foo2).should.have.eql("function");
result.foo().should.be.eql("ok");
result.foo2().should.be.eql("ok");
expect(result.foo()).toBe("ok");
expect(result.foo2()).toBe("ok");
});

View File

@ -3,19 +3,19 @@ import { a, b, c, d, e } from "./a";
import defaultImport from "./a";
it("should prefer local exports", function() {
a().should.be.eql("a1");
e.should.be.eql("e1");
expect(a()).toBe("a1");
expect(e).toBe("e1");
});
it("should prefer indirect exports over star exports", function() {
b.should.be.eql("b2");
d.should.be.eql("d2");
expect(b).toBe("b2");
expect(d).toBe("d2");
});
it("should use star exports", function() {
c.should.be.eql("c3");
expect(c).toBe("c3");
});
it("should not export default via star export", function() {
(typeof defaultImport).should.be.eql("undefined");
expect((typeof defaultImport)).toBe("undefined");
});

View File

@ -3,8 +3,8 @@ it("should process imports of star exports in the correct order", function() {
tracker.list.length = 0;
delete require.cache[require.resolve("./c")];
var c = require("./c");
tracker.list.should.be.eql(["a", "b", "c"]);
c.ax.should.be.eql("ax");
c.bx.should.be.eql("ax");
c.cx.should.be.eql("ax");
expect(tracker.list).toEqual(["a", "b", "c"]);
expect(c.ax).toBe("ax");
expect(c.bx).toBe("ax");
expect(c.cx).toBe("ax");
});

View File

@ -1,9 +1,9 @@
import {x, f} from "./x";
it("should import into object literal", function() {
({ x: x }).should.be.eql({x: 1});
({ x: x }expect()).toEqual({x: 1});
var obj = { x: x };
obj.should.be.eql({x: 1});
expect(obj).toEqual({x: 1});
});
function func(z) {
@ -11,21 +11,21 @@ function func(z) {
}
it("should import into function argument", function() {
func(x).should.be.eql(1);
f(x).should.be.eql(1);
func({x:x}).should.be.eql({x:1});
f({x:x}).should.be.eql({x:1});
expect(func(x)).toBe(1);
expect(f(x)).toBe(1);
func({x:x}expect()).toEqual({x:1});
f({x:x}expect()).toEqual({x:1});
var y = f(x);
y.should.be.eql(1);
expect(y).toBe(1);
y = function() {
return x;
};
y().should.be.eql(1);
expect(y()).toBe(1);
});
it("should import into array literal", function() {
([x, f(2)]).should.be.eql([1, 2]);
expect(([x, f(2)])).toEqual([1, 2]);
([{
value: x
}]).should.be.eql([{ value: x }]);
}expect(])).toEqual([{ value: x }]);
});

View File

@ -1,3 +1,3 @@
it("should inject variables before exporting", function() {
require("./file").f().should.be.eql({});
expect(require("./file").f()).toEqual({});
});

View File

@ -6,33 +6,33 @@ import cycleValue from "./export-cycle-a";
import { data } from "./self-cycle";
it("should establish live binding of values", function() {
value.should.be.eql(0);
expect(value).toBe(0);
add(2);
value.should.be.eql(2);
expect(value).toBe(2);
});
it("should establish live binding of values with transpiled es5 module", function() {
value2.should.be.eql(0);
expect(value2).toBe(0);
add2(5);
value2.should.be.eql(5);
expect(value2).toBe(5);
});
it("should allow to use eval with exports", function() {
valueEval.should.be.eql(0);
expect(valueEval).toBe(0);
evalInModule("value = 5");
valueEval.should.be.eql(5);
expect(valueEval).toBe(5);
});
it("should execute modules in the correct order", function() {
getLog().should.be.eql(["a", "b", "c"]);
expect(getLog()).toEqual(["a", "b", "c"]);
});
it("should bind exports before the module executes", function() {
cycleValue.should.be.eql(true);
expect(cycleValue).toBe(true);
});
it("should allow to import live variables from itself", function() {
data.should.be.eql([undefined, 1, 2]);
expect(data).toEqual([undefined, 1, 2]);
});
import { value as valueEval, evalInModule } from "./eval";

View File

@ -1,8 +1,8 @@
import value, { exception } from "./module";
it("should have a TDZ for exported const values", function() {
(typeof exception).should.be.eql("object");
expect((typeof exception)).toBe("object");
exception.should.be.instanceof(Error);
exception.message.should.match(/ is not defined$/);
value.should.be.eql("value");
expect(value).toBe("value");
});

View File

@ -7,11 +7,11 @@ import * as abc from "./abc";
function x() { throw new Error("should not be executed"); }
it("should have this = undefined on imported non-strict functions", function() {
x
d().should.be.eql("undefined");
expect(d()).toBe("undefined");
x
a().should.be.eql("undefined");
expect(a()).toBe("undefined");
x
B().should.be.eql("undefined");
expect(B()).toBe("undefined");
});
import C2, { C } from "./new";

View File

@ -26,62 +26,62 @@ import "unused";
it("should import a default export from a module", function() {
defaultExport.should.be.eql("def");
expect(defaultExport).toBe("def");
});
it("should import an identifier from a module", function() {
a.should.be.eql("a");
B.should.be.eql("b");
expect(a).toBe("a");
expect(B).toBe("b");
});
it("should import a whole module", function() {
abc.a.should.be.eql("a");
abc.b.should.be.eql("b");
abc.c.should.be.eql("c");
abc.d.c.should.be.eql("c");
abc.e.should.be.eql("c");
expect(abc.a).toBe("a");
expect(abc.b).toBe("b");
expect(abc.c).toBe("c");
expect(abc.d.c).toBe("c");
expect(abc.e).toBe("c");
var copy = (function(a) { return a; }(abc));
copy.a.should.be.eql("a");
copy.b.should.be.eql("b");
copy.c.should.be.eql("c");
copy.d.c.should.be.eql("c");
copy.e.should.be.eql("c");
(typeof abc).should.be.eql("object");
expect(copy.a).toBe("a");
expect(copy.b).toBe("b");
expect(copy.c).toBe("c");
expect(copy.d.c).toBe("c");
expect(copy.e).toBe("c");
expect((typeof abc)).toBe("object");
});
it("should export functions", function() {
fn.should.have.type("function");
fn().should.be.eql("fn");
(fn === fn).should.be.eql(true);
expect(fn()).toBe("fn");
expect((fn === fn)).toBe(true);
});
it("should multiple variables with one statement", function() {
one.should.be.eql("one");
two.should.be.eql("two");
expect(one).toBe("one");
expect(two).toBe("two");
});
it("should still be able to use exported stuff", function() {
test1.should.be.eql("fn");
test2.should.be.eql("two");
expect(test1).toBe("fn");
expect(test2).toBe("two");
});
it("should reexport a module", function() {
rea.should.be.eql("a");
reb.should.be.eql("b");
rec.should.be.eql("c");
reo.should.be.eql("one");
retwo.should.be.eql("two");
rea2.should.be.eql("a");
expect(rea).toBe("a");
expect(reb).toBe("b");
expect(rec).toBe("c");
expect(reo).toBe("one");
expect(retwo).toBe("two");
expect(rea2).toBe("a");
});
it("should support circular dependencies", function() {
threeIsOdd.should.be.eql(true);
even(4).should.be.eql(true);
expect(threeIsOdd).toBe(true);
expect(even(4)).toBe(true);
});
it("should support export specifier", function() {
specA.should.be.eql(1);
specB.should.be.eql(2);
expect(specA).toBe(1);
expect(specB).toBe(2);
});
it("should be able to import commonjs", function() {
@ -90,25 +90,25 @@ it("should be able to import commonjs", function() {
x
Thing.should.have.type("function");
x
Thing().should.be.eql("thing");
expect(Thing()).toBe("thing");
x
Other.should.be.eql("other");
expect(Other).toBe("other");
Thing2.should.have.type("function");
new Thing2().value.should.be.eql("thing");
Other2.should.be.eql("other");
Thing3().should.be.eql("thing");
expect(new Thing2().value).toBe("thing");
expect(Other2).toBe("other");
expect(Thing3()).toBe("thing");
});
it("should be able to import commonjs with star import", function() {
var copyOfCommonjs = commonjs;
commonjs().should.be.eql("thing");
commonjs.Other.should.be.eql("other");
copyOfCommonjs().should.be.eql("thing");
copyOfCommonjs.Other.should.be.eql("other");
expect(commonjs()).toBe("thing");
expect(commonjs.Other).toBe("other");
expect(copyOfCommonjs()).toBe("thing");
expect(copyOfCommonjs.Other).toBe("other");
var copyOfCommonjsTrans = commonjsTrans;
new commonjsTrans.default().value.should.be.eql("thing");
commonjsTrans.Other.should.be.eql("other");
new copyOfCommonjsTrans.default().value.should.be.eql("thing");
copyOfCommonjsTrans.Other.should.be.eql("other");
expect(new commonjsTrans.default().value).toBe("thing");
expect(commonjsTrans.Other).toBe("other");
expect(new copyOfCommonjsTrans.default().value).toBe("thing");
expect(copyOfCommonjsTrans.Other).toBe("other");
});

View File

@ -1,18 +1,18 @@
it("should inject the module object into a chunk (AMD1)", function(done) {
require([], function() {
module.webpackPolyfill.should.be.eql(1);
expect(module.webpackPolyfill).toBe(1);
done();
});
});
it("should inject the module object into a chunk (AMD2)", function() {
require([module.webpackPolyfill ? "./x1" : "./fail"]);
module.webpackPolyfill.should.be.eql(1);
expect(module.webpackPolyfill).toBe(1);
});
it("should inject the module object into a chunk (ensure)", function(done) {
require.ensure([], function(require) {
module.webpackPolyfill.should.be.eql(1);
expect(module.webpackPolyfill).toBe(1);
done();
});
});

View File

@ -1,5 +1,5 @@
import fn from './file';
it("should compile correctly", function() {
fn().should.be.eql(1);
expect(fn()).toBe(1);
});

View File

@ -1,4 +1,4 @@
it("should not fail on default export before export", function() {
require("./file").default.should.be.eql("default");
require("./file").CONSTANT.should.be.eql("const");
expect(require("./file").default).toBe("default");
expect(require("./file").CONSTANT).toBe("const");
});

View File

@ -1,5 +1,5 @@
it("should support multiple reexports", function() {
require("./x").should.be.eql({
expect(require("./x")).toEqual({
xa: "a",
xb: "b",
xc: "c",

View File

@ -7,8 +7,8 @@ it("should bind this context on require callback", function(done) {
runWithThis({ok: true}, function() {
require([], function() {
try {
require("./file").should.be.eql("file");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(this));
@ -19,9 +19,9 @@ it("should bind this context on require callback (loaded)", function(done) {
runWithThis({ok: true}, function() {
require(["./load.js"], function(load) {
try {
require("./file").should.be.eql("file");
load.should.be.eql("load");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(load).toBe("load");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(this));
@ -32,8 +32,8 @@ it("should bind this context on require callback (foo)", function(done) {
var foo = {ok: true};
require([], function(load) {
try {
require("./file").should.be.eql("file");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(foo));
@ -43,9 +43,9 @@ it("should bind this context on require callback (foo, loaded)", function(done)
var foo = {ok: true};
require(["./load.js"], function(load) {
try {
require("./file").should.be.eql("file");
load.should.be.eql("load");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(load).toBe("load");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(foo));
@ -55,8 +55,8 @@ it("should bind this context on require callback (foo)", function(done) {
runWithThis({ok: true}, function() {
require([], function(load) {
try {
require("./file").should.be.eql("file");
this.should.be.eql({ok: {ok: true}});
expect(require("./file")).toBe("file");
expect(this).toEqual({ok: {ok: true}});
done();
} catch(e) { done(e); }
}.bind({ok: this}));
@ -67,8 +67,8 @@ it("should bind this context on require.ensure callback", function(done) {
runWithThis({ok: true}, function() {
require.ensure([], function(require) {
try {
require("./file").should.be.eql("file");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(this));
@ -79,8 +79,8 @@ it("should bind this context on require.ensure callback (loaded)", function(done
runWithThis({ok: true}, function() {
require.ensure(["./load.js"], function(require) {
try {
require("./file").should.be.eql("file");
this.should.be.eql({ok: true});
expect(require("./file")).toBe("file");
expect(this).toEqual({ok: true});
done();
} catch(e) { done(e); }
}.bind(this));

View File

@ -1,5 +1,5 @@
import {x} from './a' // named imported cases an errors
it("should be able to import a named export", function() {
x.should.be.eql(1);
expect(x).toBe(1);
});

View File

@ -9,7 +9,7 @@ it("should import into object shorthand", function() {
b,
c
};
o.should.be.eql({
expect(o).toEqual({
a: 123,
aa: 123,
b: 456,

View File

@ -3,7 +3,7 @@ import { B } from "./module";
import { c } from "./module";
it("should allow to export a class", function() {
(typeof A).should.be.eql("function");
(typeof B).should.be.eql("function");
c.should.be.eql("c");
expect((typeof A)).toBe("function");
expect((typeof B)).toBe("function");
expect(c).toBe("c");
})

View File

@ -51,7 +51,7 @@ import { count } from "./module";
it("should run async functions", function() {
var org = count;
notExportedAsync();
count.should.be.eql(org + 1);
expect(count).toBe(org + 1);
exportedAsync();
count.should.be.eql(org + 2);
expect(count).toBe(org + 2);
});

View File

@ -6,8 +6,8 @@ it("should generate valid code when calling a harmony import function with brack
var c = fn((3), (4));
var d = fn(5, (6));
a.should.be.eql([1]);
b.should.be.eql([2]);
c.should.be.eql([3, 4]);
d.should.be.eql([5, 6]);
expect(a).toEqual([1]);
expect(b).toEqual([2]);
expect(c).toEqual([3, 4]);
expect(d).toEqual([5, 6]);
});

View File

@ -1,9 +1,9 @@
import defaultValue, { value, value2, value3, value4 } from "./module";
it("should be possible to redefine Object in a module", function() {
value.should.be.eql(123);
value2.should.be.eql(123);
value3.should.be.eql(123);
value4.should.be.eql(123);
defaultValue.should.be.eql(123);
expect(value).toBe(123);
expect(value2).toBe(123);
expect(value3).toBe(123);
expect(value4).toBe(123);
expect(defaultValue).toBe(123);
});

View File

@ -9,8 +9,8 @@ var func2 = function(x = a, y = b) {
}
it("should import into default parameters", function() {
func().should.be.eql(["a", "b"]);
func2().should.be.eql(["a", "b"]);
func(1).should.be.eql([1, "b"]);
func2(2).should.be.eql([2, "b"]);
expect(func()).toEqual(["a", "b"]);
expect(func2()).toEqual(["a", "b"]);
expect(func(1)).toEqual([1, "b"]);
expect(func2(2)).toEqual([2, "b"]);
});

View File

@ -1,7 +1,7 @@
it("should require existing module with supplied error callback", function(done) {
require(['./file'], function(file){
try {
file.should.be.eql("file");
expect(file).toBe("file");
done();
} catch(e) { done(e); }
}, function(error) { done(error); });
@ -11,7 +11,7 @@ it("should call error callback on missing module", function(done) {
require(['./file', './missingModule'], function(file){}, function(error) {
try {
error.should.be.instanceOf(Error);
error.message.should.be.eql('Cannot find module "./missingModule"');
expect(error.message).toBe('Cannot find module "./missingModule"');
done();
} catch(e) {
done(e);
@ -24,7 +24,7 @@ it("should call error callback on missing module in context", function(done) {
require(['./' + module], function(file){}, function(error) {
try {
error.should.be.instanceOf(Error);
error.message.should.be.eql("Cannot find module \"./missingModule\".");
expect(error.message).toBe("Cannot find module \"./missingModule\".");
done();
} catch(e) { done(e); }
});
@ -35,7 +35,7 @@ it("should call error callback on exception thrown in loading module", function(
require(['./throwing'], function(){}, function(error) {
try {
error.should.be.instanceOf(Error);
error.message.should.be.eql('message');
expect(error.message).toBe('message');
done();
} catch(e) { done(e); }
});
@ -47,7 +47,7 @@ it("should not call error callback on exception thrown in require callback", fun
}, function(error) {
try {
error.should.be.instanceOf(Error);
error.message.should.be.eql('message');
expect(error.message).toBe('message');
done();
} catch(e) { done(e); }
});

View File

@ -1,6 +1,6 @@
import { a, b } from "./a";
it("should export a const value without semicolon", function() {
a.should.be.eql({x: 1});
b.should.be.eql({x: 2});
expect(a).toEqual({x: 1});
expect(b).toEqual({x: 2});
});

View File

@ -2,11 +2,11 @@ it("should polyfill System", function() {
if (typeof System === "object" && typeof System.register === "function") {
require("fail");
}
(typeof System).should.be.eql("object");
(typeof System.register).should.be.eql("undefined");
(typeof System.get).should.be.eql("undefined");
(typeof System.set).should.be.eql("undefined");
(typeof System.anyNewItem).should.be.eql("undefined");
expect((typeof System)).toBe("object");
expect((typeof System.register)).toBe("undefined");
expect((typeof System.get)).toBe("undefined");
expect((typeof System.set)).toBe("undefined");
expect((typeof System.anyNewItem)).toBe("undefined");
var x = System.anyNewItem;
(typeof x).should.be.eql("undefined");
expect((typeof x)).toBe("undefined");
})

View File

@ -2,12 +2,12 @@ import * as file from "./file";
import * as file2 from "./file2";
it("should translate indexed access to harmony import correctly", function() {
file["default"].should.be.eql("default");
file["abc"].should.be.eql("abc");
expect(file["default"]).toBe("default");
expect(file["abc"]).toBe("abc");
});
it("should translate dynamic indexed access to harmony import correctly", function() {
var fault = "fault";
file2["de" + fault].should.be.eql("default");
file2["abc"].should.be.eql("abc");
expect(file2["de" + fault]).toBe("default");
expect(file2["abc"]).toBe("abc");
});

View File

@ -2,37 +2,37 @@ import { test } from "./file";
it("should hide import by local var", function() {
var test = "ok";
test.should.be.eql("ok");
expect(test).toBe("ok");
});
it("should hide import by object pattern", function() {
var { test } = { test: "ok" };
test.should.be.eql("ok");
expect(test).toBe("ok");
});
it("should hide import by array pattern", function() {
var [test] = ["ok"];
test.should.be.eql("ok");
expect(test).toBe("ok");
});
it("should hide import by array pattern (nested)", function() {
var [[test]] = [["ok"]];
test.should.be.eql("ok");
expect(test).toBe("ok");
});
it("should hide import by pattern in function", function() {
(function({test}) {
test.should.be.eql("ok");
expect(test).toBe("ok");
}({ test: "ok" }));
});
it("should allow import in default (incorrect)", function() {
var { other = test, test } = { test: "ok" };
test.should.be.eql("ok");
(typeof other).should.be.eql("undefined");
expect(test).toBe("ok");
expect((typeof other)).toBe("undefined");
});
it("should allow import in default", function() {
var { other = test } = { test: "ok" };
other.should.be.eql("test");
expect(other).toBe("test");
});

View File

@ -1,7 +1,7 @@
it("should parse multiple expressions in a require", function(done) {
var name = "abc";
require(["./" + name + "/" + name + "Test"], function(x) {
x.should.be.eql("ok");
expect(x).toBe("ok");
done();
});
});

View File

@ -1,3 +1,3 @@
it("should generate valid code", function() {
require("./module").myTest.should.be.eql("test");
expect(require("./module").myTest).toBe("test");
});

View File

@ -10,7 +10,7 @@ it("should parse cujojs UMD modules", function() {
? define
: function (factory) { module.exports = factory(require); }
));
module.exports.should.be.eql(123);
expect(module.exports).toBe(123);
});
it("should parse cujojs UMD modules with deps", function() {
@ -30,7 +30,7 @@ it("should parse cujojs UMD modules with deps", function() {
module.exports = factory.apply(null, deps);
}
));
module.exports.should.be.eql(1234);
expect(module.exports).toBe(1234);
});
it("should parse cujojs UMD modules with inlinded deps", function() {
@ -45,5 +45,5 @@ it("should parse cujojs UMD modules with inlinded deps", function() {
? define
: function (factory) { module.exports = factory(require); }
));
module.exports.should.be.eql(4321);
expect(module.exports).toBe(4321);
});

View File

@ -8,7 +8,7 @@ it("should not find a free exports", function() {
if(typeof exports !== "undefined")
(x.default).should.be.equal(exports);
else
(x.default).should.be.eql(false);
expect((x.default)).toBe(false);
});
export {}

View File

@ -1,4 +1,4 @@
it("should be possible to export default an imported name", function() {
var x = require("./module");
x.should.be.eql({ default: 1234 });
expect(x).toEqual({ default: 1234 });
});

View File

@ -2,7 +2,7 @@ import def from "./module?harmony";
import * as mod from "./module?harmony-start"
it("should export a sequence expression correctly", function() {
require("./module?cjs").should.be.eql({ default: 2 });
def.should.be.eql(2);
mod.default.should.be.eql(2);
expect(require("./module?cjs")).toEqual({ default: 2 });
expect(def).toBe(2);
expect(mod.default).toBe(2);
});

View File

@ -5,7 +5,7 @@ it("should parse dynamic property names", function() {
[require("./a")]: "a",
[b]: "b"
};
o.should.be.eql({
expect(o).toEqual({
a: "a",
b: "b"
});
@ -21,7 +21,7 @@ it("should match dynamic property names", function() {
[b]: cc
}
}]] = [0, 1, {b: {b: "c"}}];
aa.should.be.eql("a");
bb.should.be.eql("b");
cc.should.be.eql("c");
expect(aa).toBe("a");
expect(bb).toBe("b");
expect(cc).toBe("c");
});

View File

@ -1,5 +1,5 @@
it("should find var declaration later in code", function() {
(typeof require).should.be.eql("undefined");
expect((typeof require)).toBe("undefined");
var require;
});
@ -10,7 +10,7 @@ it("should find var declaration in same statement", function() {
}), require;
require = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
fn();
});
@ -18,7 +18,7 @@ it("should find var declaration in same statement", function() {
it("should find a catch block declaration", function() {
try {
var f = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
throw f;
} catch(require) {
@ -28,7 +28,7 @@ it("should find a catch block declaration", function() {
it("should find var declaration in control statements", function() {
var f = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
(function() {
@ -83,7 +83,7 @@ it("should find var declaration in control statements", function() {
it("should find var declaration in control statements after usage", function() {
var f = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
(function() {

View File

@ -2,7 +2,7 @@
it("should find var declaration in control statements", function() {
var f = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
(function() {
@ -16,7 +16,7 @@ it("should find var declaration in control statements", function() {
it("should find var declaration in control statements after usage", function() {
var f = (function(x) {
x.should.be.eql("fail");
expect(x).toBe("fail");
});
(function() {

Some files were not shown because too many files have changed in this diff Show More