Skip to content

Commit c1dc9d9

Browse files
RReverserhashseed
authored andcommitted
test: fix scriptParsed event expectations
As per Node.js docs, vm.Script instance is not bound to any context. However, this test was expecting otherwise and depended on implementation details which are going to change. Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1013581
1 parent 2cc9722 commit c1dc9d9

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

test/sequential/test-inspector-scriptparsed-context.js

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@ const script = `
1717
outer: false,
1818
inner: true
1919
});
20+
const script = new vm.Script("outer");
2021
debugger;
2122
22-
const scriptMain = new vm.Script("outer");
23-
debugger;
24-
25-
const scriptContext = new vm.Script("inner", {
26-
[kParsingContext]: context
27-
});
28-
debugger;
29-
30-
assert.strictEqual(scriptMain.runInThisContext(), true);
31-
assert.strictEqual(scriptMain.runInContext(context), false);
32-
assert.strictEqual(scriptContext.runInThisContext(), false);
33-
assert.strictEqual(scriptContext.runInContext(context), true);
23+
assert.strictEqual(script.runInThisContext(), true);
24+
assert.strictEqual(script.runInContext(context), false);
3425
debugger;
3526
3627
vm.runInContext('inner', context);
@@ -68,32 +59,22 @@ async function runTests() {
6859
const topContext = await getContext(session);
6960
await session.send({ 'method': 'Debugger.resume' });
7061
const childContext = await getContext(session);
71-
await session.waitForBreakOnLine(13, '[eval]');
72-
73-
console.error('[test]', 'Script associated with current context by default');
74-
await session.send({ 'method': 'Debugger.resume' });
75-
await checkScriptContext(session, topContext);
76-
await session.waitForBreakOnLine(16, '[eval]');
77-
78-
console.error('[test]', 'Script associated with selected context');
79-
await session.send({ 'method': 'Debugger.resume' });
80-
await checkScriptContext(session, childContext);
81-
await session.waitForBreakOnLine(21, '[eval]');
62+
await session.waitForBreakOnLine(14, '[eval]');
8263

8364
console.error('[test]', 'Script is unbound');
8465
await session.send({ 'method': 'Debugger.resume' });
85-
await session.waitForBreakOnLine(27, '[eval]');
66+
await session.waitForBreakOnLine(18, '[eval]');
8667

8768
console.error('[test]', 'vm.runInContext associates script with context');
8869
await session.send({ 'method': 'Debugger.resume' });
8970
await checkScriptContext(session, childContext);
90-
await session.waitForBreakOnLine(30, '[eval]');
71+
await session.waitForBreakOnLine(21, '[eval]');
9172

9273
console.error('[test]', 'vm.runInNewContext associates script with context');
9374
await session.send({ 'method': 'Debugger.resume' });
9475
const thirdContext = await getContext(session);
9576
await checkScriptContext(session, thirdContext);
96-
await session.waitForBreakOnLine(33, '[eval]');
77+
await session.waitForBreakOnLine(24, '[eval]');
9778

9879
console.error('[test]', 'vm.runInNewContext can contain debugger statements');
9980
await session.send({ 'method': 'Debugger.resume' });

0 commit comments

Comments
 (0)