-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow empty lists on command line #9090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,10 +216,24 @@ namespace ts { | |
| file: undefined, | ||
| start: undefined, | ||
| length: undefined, | ||
| }, { | ||
| messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'", | ||
| category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, | ||
| code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, | ||
| }], | ||
| fileNames: ["0.ts"], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't all 3 cases be errors? I don't think
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I learned in offline discussion with @weswigham that |
||
| options: { | ||
| lib: [] | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
| it("Parse empty string of --lib ", () => { | ||
| // 0.ts --lib | ||
| // This test is an error because the empty string is falsey | ||
| assertParseResult(["0.ts", "--lib", ""], | ||
| { | ||
| errors: [{ | ||
| messageText: "Compiler option 'lib' expects an argument.", | ||
| category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, | ||
| code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, | ||
|
|
||
| file: undefined, | ||
| start: undefined, | ||
|
|
@@ -232,6 +246,31 @@ namespace ts { | |
| }); | ||
| }); | ||
|
|
||
| it("Parse single comma of --lib ", () => { | ||
| // 0.ts --lib | ||
| assertParseResult(["0.ts", "--lib", ","], | ||
| { | ||
| errors: [], | ||
| fileNames: ["0.ts"], | ||
| options: { | ||
| lib: [] | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| it("Parse immediately following command line argument of --lib ", () => { | ||
| // 0.ts --lib | ||
| assertParseResult(["0.ts", "--lib", "--sourcemap"], | ||
| { | ||
| errors: [], | ||
| fileNames: ["0.ts"], | ||
| options: { | ||
| lib: [], | ||
| sourceMap: true | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| it("Parse --lib option with extra comma ", () => { | ||
| // --lib es5, es7 0.ts | ||
| assertParseResult(["--lib", "es5,", "es7", "0.ts"], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the
--libpart but the comma seems wierd though. not sure there is much value.