Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions test/sequential/test-vm-timeout-rethrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ const spawn = require('child_process').spawn;

if (process.argv[2] === 'child') {
const code = 'let j = 0;\n' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reduce the whole block to while(true); while you're at it? I.e. no need for declaring j either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it intentionally so it can be used in return, but with while(true); won't be necessary. Will remove it.

'for (let i = 0; i < 1000000; i++) j += add(i, i + 1);\n' +
'while(true);\n' +
'j;';

const ctx = vm.createContext({
add: function(x, y) {
return x + y;
}
});
const ctx = vm.createContext();

vm.runInContext(code, ctx, { timeout: 1 });
} else {
Expand Down