-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
test.js
38 lines (32 loc) · 850 Bytes
/
test.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
import test from 'ava';
import {shellEnv, shellEnvSync} from './index.js';
test('async', async t => {
const env = await shellEnv();
t.true('HOME' in env);
t.false('' in env);
});
test('sync', t => {
const env = shellEnvSync();
t.true('HOME' in env);
t.false('' in env);
});
test('async - with custom shell', async t => {
const shell = '/bin/bash';
const env = await shellEnv(shell);
t.true('HOME' in env);
t.false('' in env);
});
test('sync - with custom shell', t => {
const shell = '/bin/bash';
const env = shellEnvSync(shell);
t.true('HOME' in env);
t.false('' in env);
});
test('async - with custom shell throws on non-executable', async t => {
await t.throwsAsync(shellEnv('non-executable'));
});
test('sync - with custom shell throws on non-executable', t => {
t.throws(() => {
shellEnv.sync('non-executable');
});
});