brittle-jobs 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,8 +35,8 @@ brittle-jobs [globs|files...] [flags]
|
|
|
35
35
|
-b, --bail stop on first failure
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Each file runs as `<runtime> <file>`; a brittle test file runs itself. `bare`
|
|
39
|
-
`bare-runtime
|
|
38
|
+
Each file runs as `<runtime> <file>`; a brittle test file runs itself. `bare` is spawned through the project's own
|
|
39
|
+
`bare-runtime/spawn`, then from `PATH`. Pin `bare-runtime` exactly: that API is not covered by semver.
|
|
40
40
|
|
|
41
41
|
Output is one line per file as it finishes, the full output of any file that fails, the ten slowest files, and a
|
|
42
42
|
summary. Exit code is 1 when any file fails or hangs.
|
package/bin.js
CHANGED
|
@@ -47,14 +47,13 @@ const idleMs = Number(opts['idle-timeout'])
|
|
|
47
47
|
const retries = Number(opts.retries)
|
|
48
48
|
const minFree = Number(opts['min-free-mb']) * 1024 * 1024
|
|
49
49
|
const gha = !!process.env.GITHUB_ACTIONS
|
|
50
|
-
const [runtime, ...runtimeArgs] = (opts.runtime ||
|
|
50
|
+
const [runtime, ...runtimeArgs] = (opts.runtime || 'bare').split(' ')
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
let spawnBare = null
|
|
53
|
+
if (!opts.runtime) {
|
|
53
54
|
try {
|
|
54
|
-
|
|
55
|
-
} catch {
|
|
56
|
-
return 'bare'
|
|
57
|
-
}
|
|
55
|
+
spawnBare = createRequire(path.join(process.cwd(), 'package.json'))('bare-runtime/spawn')
|
|
56
|
+
} catch {}
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
let files = [
|
|
@@ -133,7 +132,7 @@ function runOnce(file, slot) {
|
|
|
133
132
|
return new Promise((resolve) => {
|
|
134
133
|
const tmp = fs.mkdtempSync(path.join(tmpRoot, 'bb-'))
|
|
135
134
|
const started = Date.now()
|
|
136
|
-
const
|
|
135
|
+
const spawnOpts = {
|
|
137
136
|
detached: true,
|
|
138
137
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
139
138
|
env: {
|
|
@@ -144,7 +143,10 @@ function runOnce(file, slot) {
|
|
|
144
143
|
BRITTLE_JOBS_WORKER_ID: String(slot),
|
|
145
144
|
JEST_WORKER_ID: String(slot)
|
|
146
145
|
}
|
|
147
|
-
}
|
|
146
|
+
}
|
|
147
|
+
const child = spawnBare
|
|
148
|
+
? spawnBare('bare', { ...spawnOpts, args: [file] })
|
|
149
|
+
: spawn(runtime, [...runtimeArgs, file], spawnOpts)
|
|
148
150
|
const pid = child.pid
|
|
149
151
|
if (pid) active.add(pid)
|
|
150
152
|
|
|
@@ -237,7 +239,9 @@ function report(file, res) {
|
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
const started = Date.now()
|
|
240
|
-
console.log(
|
|
242
|
+
console.log(
|
|
243
|
+
`brittle-jobs: ${files.length} files, ${jobs} jobs, runtime ${spawnBare ? 'bare-runtime' : runtime}`
|
|
244
|
+
)
|
|
241
245
|
|
|
242
246
|
let next = 0
|
|
243
247
|
await Promise.all(
|