-
-
Notifications
You must be signed in to change notification settings - Fork 35.1k
Expand file tree
/
Copy pathrun-worker.js
More file actions
19 lines (16 loc) · 666 Bytes
/
run-worker.js
File metadata and controls
19 lines (16 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
if (typeof require === 'undefined') {
console.log('1..0 # Skipped: Not being run as CommonJS');
process.exit(0);
}
const path = require('path');
const { Worker } = require('worker_threads');
// When --permission is enabled, the process
// aren't able to spawn any worker unless --allow-worker is passed.
// Therefore, we skip the permission tests for custom-suites-freestyle
if (process.permission && !process.permission.has('worker')) {
console.log('1..0 # Skipped: Not being run with worker_threads permission');
process.exit(0);
}
new Worker(path.resolve(process.cwd(), process.argv[2]))
.on('exit', (code) => process.exitCode = code);