/
cli.js
80 lines (67 loc) · 2.51 KB
/
cli.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
'use strict'
const common = require('../common')
const test = require('tape')
test('CLI argument test: --electron-version populates opts.electronVersion', (t) => {
let args = common.parseCLIArgs([])
t.equal(args.electronVersion, undefined)
args = common.parseCLIArgs(['--electron-version=1.2.3'])
t.equal(args.electronVersion, '1.2.3')
t.end()
})
test('CLI argument test: --download.strictSSL default', function (t) {
var args = common.parseCLIArgs([])
t.true(args.download.strictSSL, 'default for --download.strictSSL is true')
t.end()
})
test('CLI argument test: --asar=true', function (t) {
var args = common.parseCLIArgs(['--asar=true'])
t.equal(args.asar, true)
t.end()
})
test('CLI argument test: using --asar overrides other --asar.options', (t) => {
let args = common.parseCLIArgs(['--asar', '--asar.unpack=*.node'])
t.equal(args.asar, true)
args = common.parseCLIArgs(['--asar.unpack=*.node', '--asar'])
t.equal(args.asar, true)
t.end()
})
test('CLI argument test: --osx-sign=true', function (t) {
var args = common.parseCLIArgs(['--osx-sign=true'])
t.equal(args.osxSign, true)
t.end()
})
test('CLI argument test: --tmpdir=false', function (t) {
var args = common.parseCLIArgs(['--tmpdir=false'])
t.equal(args.tmpdir, false)
t.end()
})
test('CLI argument test: --deref-symlinks default', function (t) {
var args = common.parseCLIArgs([])
t.equal(args.derefSymlinks, true)
t.end()
})
test('CLI argument test: --out always resolves to a string', (t) => {
var args = common.parseCLIArgs(['--out=1'])
t.equal(args.out, '1')
t.end()
})
test('CLI argument test: --out without a value is the same as not passing --out', (t) => {
var args = common.parseCLIArgs(['--out'])
t.equal(args.out, null)
t.end()
})
test('CLI argument test: --protocol with a corresponding --protocol-name', (t) => {
var args = common.parseCLIArgs(['--protocol=foo', '--protocol-name=Foo'])
t.deepEqual(args.protocols, [{schemes: ['foo'], name: 'Foo'}])
t.end()
})
test('CLI argument test: --protocol without a corresponding --protocol-name', (t) => {
var args = common.parseCLIArgs(['--protocol=foo'])
t.deepEqual(args.protocols, undefined, 'no protocols have been fully defined')
t.end()
})
test('CLI argument test: multiple --protocol/--protocol-name argument pairs', (t) => {
var args = common.parseCLIArgs(['--protocol=foo', '--protocol-name=Foo', '--protocol=bar', '--protocol-name=Bar'])
t.deepEqual(args.protocols, [{schemes: ['foo'], name: 'Foo'}, {schemes: ['bar'], name: 'Bar'}])
t.end()
})