GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix scriptParsed event expectations · nodejs/node@16a929b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/sequential
    • test-inspector-scriptparsed-context.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/sequential/test-inspector-scriptparsed-context.js
+7-27Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,17 @@ const script = `
99
'use strict';
1010
const assert = require('assert');
1111
const vm = require('vm');
12-
const { kParsingContext } = process.binding('contextify');
1312
global.outer = true;
1413
global.inner = false;
1514
const context = vm.createContext({
1615
outer: false,
1716
inner: true
1817
});
18+
const script = new vm.Script("outer");
1919
debugger;
2020
21-
const scriptMain = new vm.Script("outer");
22-
debugger;
23-
24-
const scriptContext = new vm.Script("inner", {
25-
[kParsingContext]: context
26-
});
27-
debugger;
28-
29-
assert.strictEqual(scriptMain.runInThisContext(), true);
30-
assert.strictEqual(scriptMain.runInContext(context), false);
31-
assert.strictEqual(scriptContext.runInThisContext(), false);
32-
assert.strictEqual(scriptContext.runInContext(context), true);
21+
assert.strictEqual(script.runInThisContext(), true);
22+
assert.strictEqual(script.runInContext(context), false);
3323
debugger;
3424
3525
vm.runInContext('inner', context);
@@ -64,35 +54,25 @@ async function runTests() {
6454
await session.waitForBreakOnLine(0, '[eval]');
6555

6656
await session.send({ 'method': 'Runtime.enable' });
67-
const topContext = await getContext(session);
57+
await getContext(session);
6858
await session.send({ 'method': 'Debugger.resume' });
6959
const childContext = await getContext(session);
7060
await session.waitForBreakOnLine(13, '[eval]');
7161

72-
console.error('[test]', 'Script associated with current context by default');
73-
await session.send({ 'method': 'Debugger.resume' });
74-
await checkScriptContext(session, topContext);
75-
await session.waitForBreakOnLine(16, '[eval]');
76-
77-
console.error('[test]', 'Script associated with selected context');
78-
await session.send({ 'method': 'Debugger.resume' });
79-
await checkScriptContext(session, childContext);
80-
await session.waitForBreakOnLine(21, '[eval]');
81-
8262
console.error('[test]', 'Script is unbound');
8363
await session.send({ 'method': 'Debugger.resume' });
84-
await session.waitForBreakOnLine(27, '[eval]');
64+
await session.waitForBreakOnLine(17, '[eval]');
8565

8666
console.error('[test]', 'vm.runInContext associates script with context');
8767
await session.send({ 'method': 'Debugger.resume' });
8868
await checkScriptContext(session, childContext);
89-
await session.waitForBreakOnLine(30, '[eval]');
69+
await session.waitForBreakOnLine(20, '[eval]');
9070

9171
console.error('[test]', 'vm.runInNewContext associates script with context');
9272
await session.send({ 'method': 'Debugger.resume' });
9373
const thirdContext = await getContext(session);
9474
await checkScriptContext(session, thirdContext);
95-
await session.waitForBreakOnLine(33, '[eval]');
75+
await session.waitForBreakOnLine(23, '[eval]');
9676

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

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.