-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit a warning and exit with status code 1. Based on tj/commander.js#1088 (comment)
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import chai, { expect } from 'chai'; | ||
import chaiAsPromised from 'chai-as-promised'; | ||
import path from 'path'; | ||
import spawnPromise from 'cross-spawn-promise'; | ||
|
||
chai.use(chaiAsPromised); | ||
|
||
describe('cli', () => { | ||
it('should fail on unknown subcommands', async () => { | ||
const error = await expect(spawnPromise(path.resolve(__dirname, '../../../../node_modules/.bin/ts-node'), [path.resolve(__dirname, '../src/electron-forge.ts'), 'nonexistent'])).to.eventually.be.rejected; | ||
expect(error.exitStatus).to.equal(1); | ||
expect(error.stderr.toString()).to.match(/Unknown command "nonexistent"/); | ||
}); | ||
}); |