File tree 2 files changed +7
-5
lines changed
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');
3
3
const assert = require ( 'assert' ) ;
4
4
const { Worker, isMainThread, parentPort } = require ( 'worker_threads' ) ;
5
5
6
+ const kTestString = 'Hello, world!' ;
7
+
6
8
if ( isMainThread ) {
7
9
const w = new Worker ( __filename ) ;
8
10
w . on ( 'message' , common . mustCall ( ( message ) => {
9
- assert . strictEqual ( message , 'Hello, world!' ) ;
11
+ assert . strictEqual ( message , kTestString ) ;
10
12
} ) ) ;
11
13
} else {
12
14
setImmediate ( ( ) => {
13
15
process . nextTick ( ( ) => {
14
- parentPort . postMessage ( 'Hello, world!' ) ;
16
+ parentPort . postMessage ( kTestString ) ;
15
17
} ) ;
16
18
} ) ;
17
19
}
Original file line number Diff line number Diff line change @@ -2,17 +2,17 @@ import { mustCall } from '../common/index.mjs';
2
2
import assert from 'assert' ;
3
3
import { Worker , isMainThread , parentPort } from 'worker_threads' ;
4
4
5
- const TEST_STRING = 'Hello, world!' ;
5
+ const kTestString = 'Hello, world!' ;
6
6
7
7
if ( isMainThread ) {
8
8
const w = new Worker ( new URL ( import . meta. url ) ) ;
9
9
w . on ( 'message' , mustCall ( ( message ) => {
10
- assert . strictEqual ( message , TEST_STRING ) ;
10
+ assert . strictEqual ( message , kTestString ) ;
11
11
} ) ) ;
12
12
} else {
13
13
setImmediate ( ( ) => {
14
14
process . nextTick ( ( ) => {
15
- parentPort . postMessage ( TEST_STRING ) ;
15
+ parentPort . postMessage ( kTestString ) ;
16
16
} ) ;
17
17
} ) ;
18
18
}
You can’t perform that action at this time.
0 commit comments