How to use the lolex.createClock function in lolex

To help you get started, we’ve selected a few lolex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github szmarczak / http2-wrapper / test / helpers / server.js View on Github external
return async (t, run) => {
		const create = (options && options.createServer) || createServer;

		const clock = options && options.lolex ? lolex.install() : lolex.createClock();

		const server = await create(options);
		await server.listen();

		// Useful to fix uncaught exceptions:
		// console.log(`${server.options.port} - ${t.title}`);

		try {
			await run(t, server, clock);
		} finally {
			if (options && options.beforeServerClose) {
				options.beforeServerClose();
			}

			clock.runAll();
github jamesshore / lets_code_javascript / src / server / clock.js View on Github external
static createFake() {
			var clock = new Clock(true);
			clock._clock = lolex.createClock(FAKE_START_TIME);
			return clock;
		}
github sinonjs / sinon / lib / sinon / util / fake-timers.js View on Github external
create: function(now) {
        return llx.createClock(now);
    }
};

lolex

Fake JavaScript timers

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis