diff options
author | Richard Lau <riclau@uk.ibm.com> | 2018-10-16 13:28:52 -0400 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-10-19 07:22:54 +0200 |
commit | 23f8b7d334db86a78464f8694c015afab6dedfc3 (patch) | |
tree | 055d5d313cd090ce858100094a9620ea9f1ea870 /test/parallel/test-trace-events-binding.js | |
parent | 15c336684fd552e1f5cd256326ba33c81f43c825 (diff) | |
download | android-node-v8-23f8b7d334db86a78464f8694c015afab6dedfc3.tar.gz android-node-v8-23f8b7d334db86a78464f8694c015afab6dedfc3.tar.bz2 android-node-v8-23f8b7d334db86a78464f8694c015afab6dedfc3.zip |
test: enable trace-events tests for workers
Use the `cwd` option for `child_process` instead of `process.chdir()`
to enable the trace events tests to run on workers.
PR-URL: https://github.com/nodejs/node/pull/23698
Refs: https://github.com/nodejs/node/pull/23674#discussion_r225335819
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-trace-events-binding.js')
-rw-r--r-- | test/parallel/test-trace-events-binding.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/parallel/test-trace-events-binding.js b/test/parallel/test-trace-events-binding.js index 163d9c4cbd..a6994d47b3 100644 --- a/test/parallel/test-trace-events-binding.js +++ b/test/parallel/test-trace-events-binding.js @@ -3,9 +3,7 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); - -if (!common.isMainThread) - common.skip('process.chdir is not available in Workers'); +const path = require('path'); const CODE = ` const { internalBinding } = require('internal/test/binding'); @@ -18,17 +16,17 @@ const CODE = ` trace('b'.charCodeAt(0), 'missing', 'type-value', 10, {'extra-value': 20 }); `; -const FILE_NAME = 'node_trace.1.log'; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -process.chdir(tmpdir.path); +const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-event-categories', 'custom', '--no-warnings', '--expose-internals', - '-e', CODE ]); + '-e', CODE ], + { cwd: tmpdir.path }); proc.once('exit', common.mustCall(() => { assert(fs.existsSync(FILE_NAME)); |