File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,17 @@ const common = require('../common');
33const assert = require ( 'assert' ) ;
44const { Worker, isMainThread, parentPort } = require ( 'worker_threads' ) ;
55
6+ const kTestString = 'Hello, world!' ;
7+
68if ( 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}
Original file line number Diff line number Diff line change @@ -2,17 +2,17 @@ import { mustCall } from '../common/index.mjs';
22import assert from 'assert' ;
33import { Worker , isMainThread , parentPort } from 'worker_threads' ;
44
5- const TEST_STRING = 'Hello, world!' ;
5+ const kTestString = 'Hello, world!' ;
66
77if ( 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}
You can’t perform that action at this time.
0 commit comments