mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
25 lines
735 B
TypeScript
25 lines
735 B
TypeScript
import * as mocha from 'mocha';
|
|
import * as sinon from 'sinon';
|
|
|
|
import { INodeTransformer } from '../../src/interfaces/node-transformers/INodeTransformer';
|
|
|
|
export function stubNodeTransformers (nodeTransformers: (new (...args: any[]) => INodeTransformer)[]): void {
|
|
const transformerStubs: sinon.SinonStub[] = [];
|
|
|
|
mocha.before(() => {
|
|
for (const nodeTransformer of nodeTransformers) {
|
|
const stub: sinon.SinonStub = sinon
|
|
.stub(nodeTransformer.prototype, 'getVisitor')
|
|
.callsFake(() => null);
|
|
|
|
transformerStubs.push(stub);
|
|
}
|
|
});
|
|
|
|
mocha.after(() => {
|
|
for (const stub of transformerStubs) {
|
|
stub.restore();
|
|
}
|
|
});
|
|
}
|