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: testcase demonstrating issue 59541 · nodejs/node@ce8435b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-vm-module-after-evaluate.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-vm-module-after-evaluate.js‎

Copy file name to clipboard
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Flags: --experimental-vm-modules
2+
'use strict';
3+
4+
// https://github.com/nodejs/node/issues/59541
5+
//
6+
// Promises created in a context using microtaskMode: "aferEvaluate" (meaning it
7+
// has its own microtask queue), when resolved in the surrounding context, will
8+
// schedule a task back onto the inner context queue.
9+
10+
const common = require('../common');
11+
const vm = require('vm');
12+
13+
const microtaskMode = 'afterEvaluate';
14+
15+
(async () => {
16+
const mustNotCall1 = common.mustNotCall();
17+
const mustNotCall2 = common.mustNotCall();
18+
19+
const inner = {};
20+
21+
const context = vm.createContext({ inner }, { microtaskMode });
22+
23+
const module = new vm.SourceTextModule(
24+
'inner.promise = Promise.resolve();',
25+
{ context },
26+
);
27+
28+
await module.link(mustNotCall1);
29+
await module.evaluate();
30+
31+
// This is Issue 59541, the next statement is not executed, of course
32+
// it should be.
33+
mustNotCall2();
34+
})().then(common.mustNotCall());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.