Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use command-line arguments to configure nwb new; added jsNext config
The ES6 modules build is now optional - jsNext defaults to true. Closes #27
- Loading branch information
Showing
16 changed files
with
295 additions
and
103 deletions.
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
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
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
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
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
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
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,62 @@ | ||
import expect from 'expect' | ||
import parseArgs from 'minimist' | ||
|
||
let {getWebModulePrefs} = require('../src/commands/new') | ||
|
||
let moduleArgs = (args, cb) => { | ||
args.push('-f') | ||
getWebModulePrefs(parseArgs(args), cb) | ||
} | ||
|
||
describe('nwb new', () => { | ||
describe('command-line arguments', () => { | ||
it('set umd=false by default', done => { | ||
moduleArgs([], settings => { | ||
expect(settings).toEqual({ | ||
globalVariable: '', | ||
jsNext: true, | ||
umd: false | ||
}) | ||
done() | ||
}) | ||
}) | ||
it('implicitly set umd=true with a --global variable', done => { | ||
moduleArgs(['--global=Test'], settings => { | ||
expect(settings).toEqual({ | ||
globalVariable: 'Test', | ||
jsNext: true, | ||
umd: true | ||
}) | ||
done() | ||
}) | ||
}) | ||
it('implicitly set umd=true with a -g variable', done => { | ||
moduleArgs(['-g', 'Test'], settings => { | ||
expect(settings).toEqual({ | ||
globalVariable: 'Test', | ||
jsNext: true, | ||
umd: true | ||
}) | ||
done() | ||
}) | ||
}) | ||
it('set umd=false with --no-umd', done => { | ||
moduleArgs(['--no-umd'], settings => { | ||
expect(settings.umd).toBe(false) | ||
done() | ||
}) | ||
}) | ||
it('set umd=false with --umd=false', done => { | ||
moduleArgs(['--no-umd'], settings => { | ||
expect(settings.umd).toBe(false) | ||
done() | ||
}) | ||
}) | ||
it('set jsNext=false with --no-jsnext', done => { | ||
moduleArgs(['--no-jsnext'], settings => { | ||
expect(settings.jsNext).toBe(false) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.