Spaces:
Sleeping
Sleeping
File size: 928 Bytes
be5030f |
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 |
'use strict'
const TestRunner = require('test-runner')
const commandLineArgs = require('../')
const a = require('assert')
const runner = new TestRunner()
runner.test('detect process.argv: should automatically remove first two argv items', function () {
process.argv = [ 'node', 'filename', '--one', 'eins' ]
a.deepStrictEqual(commandLineArgs({ name: 'one' }), {
one: 'eins'
})
})
runner.test('detect process.argv: should automatically remove first two argv items 2', function () {
process.argv = [ 'node', 'filename', '--one', 'eins' ]
a.deepStrictEqual(commandLineArgs({ name: 'one' }, { argv: process.argv }), {
one: 'eins'
})
})
runner.test('process.argv is left untouched', function () {
process.argv = [ 'node', 'filename', '--one', 'eins' ]
a.deepStrictEqual(commandLineArgs({ name: 'one' }), {
one: 'eins'
})
a.deepStrictEqual(process.argv, [ 'node', 'filename', '--one', 'eins' ])
})
|