Remove global chai.assert in fixture runner's test context

This commit is contained in:
Deven Bansod
2018-04-13 19:14:30 +05:30
parent c62b202e6a
commit 4f1473da3d

View File

@@ -28,17 +28,6 @@ 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);