Skip to content

Commit

Permalink
add global clearTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateus Pontes committed Nov 30, 2018
1 parent d35fe0b commit f5f6ae7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Sandbox {
exports: null,
module: null,
setTimeout: null,
clearTimeout: null,
require: null,
relativeRequire: null,
}, errors);
Expand Down Expand Up @@ -94,6 +95,7 @@ class Sandbox {

this.context.Buffer = Buffer;
this.context.setTimeout = setTimeout;
this.context.clearTimeout = clearTimeout;
this.context.exports = exports;
this.context.module = { exports };
this.context.require = sandboxRequire.require;
Expand Down
4 changes: 4 additions & 0 deletions test/Sandbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ describe('Sandbox', () => {
expect(context.setTimeout).to.equal(setTimeout);
});

it('should return context with clearTimeout', () => {
expect(context.clearTimeout).to.equal(clearTimeout);
});

it('should return context with Buffer', () => {
expect(context.Buffer).to.equal(Buffer);
});
Expand Down

0 comments on commit f5f6ae7

Please sign in to comment.