-
Notifications
You must be signed in to change notification settings - Fork 79
/
issue-171.js
45 lines (36 loc) · 985 Bytes
/
issue-171.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const path = require('node:path');
const { SHARE_ENV } = require('node:worker_threads');
const test = require('ava');
const Bree = require('../../src');
const root = path.join(__dirname, '../jobs');
test('works with SHARE_ENV using top-level', async (t) => {
const bree = new Bree({
root,
worker: {
env: SHARE_ENV
},
jobs: [{ name: 'long', closeWorkerAfterMs: 2000 }]
});
await t.notThrowsAsync(bree.run('long'));
});
test('works with SHARE_ENV using job-specific', async (t) => {
const bree = new Bree({
root,
jobs: [
{ name: 'long', closeWorkerAfterMs: 2000, worker: { env: SHARE_ENV } }
]
});
await t.notThrowsAsync(bree.run('long'));
});
test('works with SHARE_ENV using both', async (t) => {
const bree = new Bree({
root,
worker: {
env: SHARE_ENV
},
jobs: [
{ name: 'long', closeWorkerAfterMs: 2000, worker: { env: SHARE_ENV } }
]
});
await t.notThrowsAsync(bree.run('long'));
});