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: refactor test-worker · nodejs/node@4ffa138

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-worker.js
    • test-worker.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-worker.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-worker.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ const common = require('../common');
33
const assert = require('assert');
44
const { Worker, isMainThread, parentPort } = require('worker_threads');
55

6+
const kTestString = 'Hello, world!';
7+
68
if (isMainThread) {
79
const w = new Worker(__filename);
810
w.on('message', common.mustCall((message) => {
9-
assert.strictEqual(message, 'Hello, world!');
11+
assert.strictEqual(message, kTestString);
1012
}));
1113
} else {
1214
setImmediate(() => {
1315
process.nextTick(() => {
14-
parentPort.postMessage('Hello, world!');
16+
parentPort.postMessage(kTestString);
1517
});
1618
});
1719
}
Collapse file

‎test/parallel/test-worker.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-worker.mjs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { mustCall } from '../common/index.mjs';
22
import assert from 'assert';
33
import { Worker, isMainThread, parentPort } from 'worker_threads';
44

5-
const TEST_STRING = 'Hello, world!';
5+
const kTestString = 'Hello, world!';
66

77
if (isMainThread) {
88
const w = new Worker(new URL(import.meta.url));
99
w.on('message', mustCall((message) => {
10-
assert.strictEqual(message, TEST_STRING);
10+
assert.strictEqual(message, kTestString);
1111
}));
1212
} else {
1313
setImmediate(() => {
1414
process.nextTick(() => {
15-
parentPort.postMessage(TEST_STRING);
15+
parentPort.postMessage(kTestString);
1616
});
1717
});
1818
}

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.