shift-interpreter
Version:
Shift-interpreter is an experimental JavaScript meta-interpreter useful for reverse engineering and analysis. One notable difference from other projects is that shift-interpreter retains state over an entire script but can be fed expressions and statement
28 lines (23 loc) • 565 B
text/typescript
import { assertResult, compare } from '../util';
import chai, { expect } from 'chai';
import spies from 'chai-spies';
chai.use(spies);
describe('External context', () => {
it('should call functions defined on the context', () => {
const console = {
log: function(msg: string) {
return undefined;
},
};
chai.spy.on(console, 'log');
assertResult(
compare(
`
console.log("Hello world");
`,
{ console },
),
);
expect(console.log).to.have.been.called.with('Hello world');
});
});