Skip to content

Commit

Permalink
Merge pull request #368 from KhalitovAdel/hotfix-367
Browse files Browse the repository at this point in the history
fix: Program unknown argument
  • Loading branch information
soulteary committed Mar 23, 2022
2 parents 01f7ca3 + 0956d5f commit ba4031d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function (config) {

if (!config) {
// CLI
config = appendOptions(program.version(version), options)
config = appendOptions(program.version(version).allowUnknownOption(true), options)
.parse(process.argv)
.opts()
}
Expand Down
11 changes: 11 additions & 0 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const spawn = require('child_process').spawn
const path = require('path')
const expect = require('expect')
const utils = require('../lib/utils')

const bin = path.join(__dirname, '../bin/maildev')

Expand All @@ -24,4 +25,14 @@ describe('cli', () => {
})
maildev.kill('SIGINT')
})

it('should works with unknown arguments', (done) => {
const maildev = spawn(bin, [`--${utils.makeId()}`])
setTimeout(() => {
maildev.kill(0)
done()
}, 1000)
maildev.on('error', (err) => done(err))
maildev.on('close', (code, signal) => done(new Error(`Exit with code: ${code || signal}`)))
})
})

0 comments on commit ba4031d

Please sign in to comment.