-
-
Notifications
You must be signed in to change notification settings - Fork 838
/
test-cli-options.js
33 lines (24 loc) · 935 Bytes
/
test-cli-options.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
/* @flow */
const t = require('tap')
const options = require('../lib/cli-options')
t.plan(6)
// matches encoding option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_encoding=utf8']), {
encoding: 'utf8'
})
// matches path option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_path=/custom/path/to/your/env/vars']), {
path: '/custom/path/to/your/env/vars'
})
// matches debug option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_debug=true']), {
debug: 'true'
})
// matches multiline option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_multiline=line-breaks']), {
multiline: 'line-breaks'
})
// ignores empty values
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_path=']), {})
// ignores unsupported options
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_foo=bar']), {})