Update chai to 4.x (#6002)

This commit is contained in:
Daniel Tschinder
2017-07-24 21:19:32 +02:00
committed by Henry Zhu
parent 2225892348
commit 19c4dd2d8c
4 changed files with 43 additions and 18 deletions

View File

@@ -21,7 +21,7 @@
"babel-register": "7.0.0-alpha.12",
"browserify": "^13.1.1",
"bundle-collapser": "^1.2.1",
"chai": "^3.5.0",
"chai": "^4.1.0",
"chalk": "^2.0.0",
"derequire": "^2.0.2",
"eslint": "^3.14.1",

View File

@@ -12,7 +12,7 @@
"babel-core": "7.0.0-alpha.15",
"babel-helper-fixtures": "7.0.0-alpha.15",
"babel-polyfill": "7.0.0-alpha.15",
"chai": "^3.0.0",
"chai": "^4.1.0",
"lodash": "^4.2.0",
"resolve": "^1.3.2",
"source-map": "^0.5.0"

View File

@@ -18,7 +18,6 @@ import vm from "vm";
const moduleCache = {};
const testContext = vm.createContext({
...helpers,
assert: chai.assert,
process: process,
transform: babel.transform,
setTimeout: setTimeout,
@@ -26,6 +25,17 @@ const testContext = vm.createContext({
});
testContext.global = testContext;
// Add chai's assert to the global context
// It has to be required inside the testContext as otherwise some assertions do not
// work as chai would reference globals (RegExp, Array, ...) from this context
vm.runInContext(
"(function(require) { global.assert=require('chai').assert; });",
testContext,
{
displayErrors: true,
},
)(id => runModuleInTestContext(id, __filename));
// Initialize the test context with the polyfill, and then freeze the global to prevent implicit
// global creation in tests, which could cause things to bleed between tests.
runModuleInTestContext("babel-polyfill", __filename);

View File

@@ -1376,13 +1376,16 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"
chai@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
chai@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.0.tgz#331a0391b55c3af8740ae9c3b7458bc1c3805e6d"
dependencies:
assertion-error "^1.0.1"
deep-eql "^0.1.3"
type-detect "^1.0.0"
check-error "^1.0.1"
deep-eql "^2.0.1"
get-func-name "^2.0.0"
pathval "^1.0.0"
type-detect "^4.0.0"
chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
@@ -1402,6 +1405,10 @@ chalk@^2.0.0:
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
check-error@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
chokidar@^1.6.1:
version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
@@ -1920,11 +1927,11 @@ dedent@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
deep-eql@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
deep-eql@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-2.0.2.tgz#b1bac06e56f0a76777686d50c9feb75c2ed7679a"
dependencies:
type-detect "0.1.1"
type-detect "^3.0.0"
deep-extend@~0.4.0:
version "0.4.2"
@@ -2612,6 +2619,10 @@ get-caller-file@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5"
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
get-pkg-repo@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d"
@@ -4517,6 +4528,10 @@ path-type@^2.0.0:
dependencies:
pify "^2.0.0"
pathval@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
pbkdf2@^3.0.3:
version "3.0.12"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.12.tgz#be36785c5067ea48d806ff923288c5f750b6b8a2"
@@ -5496,13 +5511,13 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"
type-detect@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
type-detect@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-3.0.0.tgz#46d0cc8553abb7b13a352b0d6dea2fd58f2d9b55"
type-detect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
type-detect@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.3.tgz#0e3f2670b44099b0b46c284d136a7ef49c74c2ea"
typedarray@^0.0.6, typedarray@~0.0.5:
version "0.0.6"