summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/common/tmpdir.js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-05-24 03:56:29 +0900
committerGitHub <noreply@github.com>2023-05-23 20:56:29 +0200
commit26f42a248f4764f85c1c3c3c511b82a990e4b651 (patch)
tree04281d6d58fa0f5fba8946481dd13fcd4becf4b2 /cli/tests/node_compat/test/common/tmpdir.js
parent3d865949c2f9f0cb61031bcc2b9e81a4ca623109 (diff)
fix(ext/node): add basic node:worker_threads support (#19192)
This PR restores `node:worker_threads` implementation and test cases from [`std@0.175.0/node`](https://github.com/denoland/deno_std/blob/0.175.0/node/worker_threads.ts). --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/node_compat/test/common/tmpdir.js')
-rw-r--r--cli/tests/node_compat/test/common/tmpdir.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/cli/tests/node_compat/test/common/tmpdir.js b/cli/tests/node_compat/test/common/tmpdir.js
index d3ce98e45..dbc945c13 100644
--- a/cli/tests/node_compat/test/common/tmpdir.js
+++ b/cli/tests/node_compat/test/common/tmpdir.js
@@ -2,14 +2,14 @@
// deno-lint-ignore-file
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
-// Taken from Node 16.13.0
+// Taken from Node 18.12.1
// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
'use strict';
const fs = require('fs');
const path = require('path');
-// const { isMainThread } = require('worker_threads');
+const { isMainThread } = require('worker_threads');
function rmSync(pathname) {
fs.rmSync(pathname, { maxRetries: 3, recursive: true, force: true });
@@ -26,8 +26,8 @@ const tmpPath = path.join(testRoot, tmpdirName);
let firstRefresh = true;
function refresh() {
- rmSync(this.path);
- fs.mkdirSync(this.path);
+ rmSync(tmpPath);
+ fs.mkdirSync(tmpPath);
if (firstRefresh) {
firstRefresh = false;
@@ -39,9 +39,8 @@ function refresh() {
function onexit() {
// Change directory to avoid possible EBUSY
- // TODO(f3n67u): uncomment when `worker_thread.isMainThread` implemented
- // if (isMainThread)
- // process.chdir(testRoot);
+ if (isMainThread)
+ process.chdir(testRoot);
try {
rmSync(tmpPath);