Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(config) {
// lazy require
const {JSDOM} = require('jsdom');
this.document = new JSDOM('', {
url: config.testURL,
runScripts: 'dangerously'
});
const global = (this.global = this.document.window.document.defaultView);
// Node's error-message stack size is limited at 10, but it's pretty useful
// to see more than that when a test fails.
global.Error.stackTraceLimit = 100;
installCommonGlobals(global, config.globals);
this.moduleMocker = new mock.ModuleMocker(global);
this.fakeTimers = new FakeTimers(global, this.moduleMocker, config);
}
constructor(config) {
// jest doesn't need full global before runScript, but to reduce possible issues we create full copy here
this.global = assign({}, global, deepCopy(config.globals));
this.moduleMocker = new ModuleMocker(global);
this.fakeTimers = new FakeTimers(this.global, this.moduleMocker, config);
}
constructor(config) {
const global = (this.global = window);
installCommonGlobals(global, config.globals);
this.moduleMocker = new mock.ModuleMocker(global);
this.fakeTimers = new FakeTimers(global, this.moduleMocker, config);
}
global.removeEventListener = function (name) {
if (name === 'error') {
userErrorListenerCount--;
}
return originalRemoveListener.apply(this, arguments);
};
}
this.moduleMocker = new mock.ModuleMocker(global);
const timerConfig = {
idToRef: id => id,
refToId: ref => ref,
};
this.fakeTimers = new FakeTimers({
config: this._config,
global,
moduleMocker: this.moduleMocker,
timerConfig,
});
}
global.removeEventListener = function (name) {
if (name === 'error') {
userErrorListenerCount--;
}
return originalRemoveListener.apply(this, arguments);
};
}
this.moduleMocker = new mock.ModuleMocker(global);
const timerConfig = {
idToRef: id => id,
refToId: ref => ref,
};
this.fakeTimers = new FakeTimers({
config: this._config,
global,
moduleMocker: this.moduleMocker,
timerConfig,
});
}
constructor(config) {
const global = (this.global = window);
installCommonGlobals(global, config.globals);
this.moduleMocker = new mock.ModuleMocker(global);
this.fakeTimers = new FakeTimers({
config,
global,
moduleMocker: this.moduleMocker,
});
}