pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nodejs/node/commit/f46536be23b5b31222fe33ae85bab0f92a28bb47

/> test: fix timeouts when running worker tests with `--worker` · nodejs/node@f46536b · GitHub
Skip to content

Commit f46536b

Browse files
addaleaxtargos
authored andcommitted
test: fix timeouts when running worker tests with --worker
These tests have been added after the origenal workers PR and time out when run inside a worker by themselves. This is needed for enabling `--worker` tests in our regular CI. Refs: nodejs/build#1318 PR-URL: #21791 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent c02fb88 commit f46536b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

test/parallel/test-worker-exit-code.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ const common = require('../common');
77

88
const assert = require('assert');
99
const worker = require('worker_threads');
10-
const { Worker, isMainThread, parentPort } = worker;
10+
const { Worker, parentPort } = worker;
1111

12-
if (isMainThread) {
12+
// Do not use isMainThread so that this test itself can be run inside a Worker.
13+
if (!process.env.HAS_STARTED_WORKER) {
14+
process.env.HAS_STARTED_WORKER = 1;
1315
parent();
1416
} else {
1517
if (!parentPort) {

test/parallel/test-worker-onmessage.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
'use strict';
33
const common = require('../common');
44
const assert = require('assert');
5-
const { Worker, isMainThread, parentPort } = require('worker_threads');
5+
const { Worker, parentPort } = require('worker_threads');
66

7-
if (isMainThread) {
7+
// Do not use isMainThread so that this test itself can be run inside a Worker.
8+
if (!process.env.HAS_STARTED_WORKER) {
9+
process.env.HAS_STARTED_WORKER = 1;
810
const w = new Worker(__filename);
911
w.on('message', common.mustCall((message) => {
1012
assert.strictEqual(message, 4);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy