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 — async_hooks: add an InactiveAsyncContextFrame class · nodejs/node@027b0ff

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • async_context_frame.js
  • test/parallel
    • test-async-context-frame.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/async_context_frame.js‎

Copy file name to clipboardExpand all lines: lib/internal/async_context_frame.js
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111

1212
let enabled_;
1313

14-
class ActiveAsyncContextFrame {
14+
class ActiveAsyncContextFrame extends Map {
1515
static get enabled() {
1616
return true;
1717
}
@@ -50,12 +50,7 @@ function checkEnabled() {
5050
return enabled;
5151
}
5252

53-
class AsyncContextFrame extends Map {
54-
constructor(store, data) {
55-
super(AsyncContextFrame.current());
56-
this.set(store, data);
57-
}
58-
53+
class InactiveAsyncContextFrame extends Map {
5954
static get enabled() {
6055
enabled_ ??= checkEnabled();
6156
return enabled_;
@@ -65,6 +60,13 @@ class AsyncContextFrame extends Map {
6560
static set(frame) {}
6661
static exchange(frame) {}
6762
static disable(store) {}
63+
}
64+
65+
class AsyncContextFrame extends InactiveAsyncContextFrame {
66+
constructor(store, data) {
67+
super(AsyncContextFrame.current());
68+
this.set(store, data);
69+
}
6870

6971
disable(store) {
7072
this.delete(store);
Collapse file

‎test/parallel/test-async-context-frame.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-async-context-frame.mjs
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { opendir } from 'node:fs/promises';
55
import { fileURLToPath } from 'node:url';
66
import { describe, it } from 'node:test';
77
import { sep } from 'node:path';
8+
import { strictEqual } from 'node:assert';
89

910
const python = process.env.PYTHON || (isWindows ? 'python' : 'python3');
1011

@@ -53,7 +54,8 @@ describe('AsyncContextFrame', {
5354
stdio: ['ignore', 'ignore', 'inherit'],
5455
});
5556

56-
await once(proc, 'exit');
57+
const [code] = await once(proc, 'exit');
58+
strictEqual(code, 0, `Test ${test} failed with exit code ${code}`);
5759
});
5860
}
5961
});

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.