Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1) "before all" hook
- 0 passing (2s)
- 1 failing
- 1) "before all" hook:
- Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
- const rewiremock = require("rewiremock").default;
- const sinon = require("sinon");
- // Some more imports
- let readFileSync;
- let serverConfiguration;
- let testingModule;
- before(
- function ()
- {
- // Some mocking of the form:
- rewiremock(
- "fs"
- ).by(
- (
- mock
- ) =>
- {
- const realFs = mock.requireActual("fs");
- readFileSync = sinon.spy(realFs, "readFileSync");
- return realFs;
- }
- );
- const originalModule = require("./path/to/my/mod");
- const fakeModule = {
- myMethod() {
- // Some behaviour-altering code and then:
- originalModule.myMethod();
- }
- };
- testingModule = rewiremock.proxy(
- "./path/to/testing/module",
- {
- "./path/to/my/mod" : fakeHttpUiServerFactory
- }
- );
- console.log("one");
- // Some more mocking
- console.log("two");
- // Aaaand more mocking
- console.log("three");
- // Initialization of a configuration object
- serverConfiguration = {
- "nothing" : "special here"
- };
- console.log("four");
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement