mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import {
|
|
hookRequire,
|
|
hookCreateScript,
|
|
unhookCreateScript,
|
|
hookRunInThisContext,
|
|
unhookRunInThisContext,
|
|
hookRunInContext,
|
|
unhookRunInContext,
|
|
unloadRequireCache
|
|
} from 'istanbul-lib-hook';
|
|
|
|
const matcher = (filename: string) => true;
|
|
const transformer = (code: string, options: { filename: string }) => 'foo';
|
|
|
|
hookRequire(matcher, transformer);
|
|
hookRequire(matcher, transformer, {});
|
|
hookRequire(matcher, transformer, { verbose: true });
|
|
|
|
const retVal = hookRequire(matcher, transformer, {
|
|
extensions: ['.js'],
|
|
postLoadHook: (filename: string) => {}
|
|
});
|
|
retVal();
|
|
|
|
hookCreateScript(matcher, transformer, {});
|
|
hookCreateScript(matcher, transformer, { verbose: true });
|
|
|
|
unhookCreateScript();
|
|
|
|
hookRunInThisContext(matcher, transformer, {});
|
|
hookRunInThisContext(matcher, transformer, { verbose: true });
|
|
|
|
unhookRunInThisContext();
|
|
|
|
unloadRequireCache(matcher);
|
|
|
|
hookRunInContext(matcher, transformer, {});
|
|
hookRunInContext(matcher, transformer, { verbose: true, coverageVariable: '__cov__' });
|
|
|
|
unhookRunInContext();
|