We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ec5c25 commit 4218f07Copy full SHA for 4218f07
tests/index.test.js
@@ -36,18 +36,21 @@ it('should handles module not exist', async () => {
36
})
37
38
it('should throw error on timeout', async () => {
39
+ jest.useRealTimers()
40
const VM = (await import('../src')).default
41
- const vm = VM({ timeout: 10 })
42
+ const vm = VM({ timeout: 20 })
43
44
await vm.require([
45
{
46
path: 'timeout.js',
- src: 'module.exports = () => new Promise((resolve) => setTimeout(resolve, 30))',
47
+ src: 'module.exports = () => new Promise((resolve) => {})',
48
},
49
])
50
51
expect(vm.exec('timeout.js')).rejects.toThrow()
52
+ // eslint-disable-next-line no-promise-executor-return
53
+ await new Promise((resolve) => setTimeout(resolve, 30))
54
55
vm.terminate()
56
0 commit comments