-
Notifications
You must be signed in to change notification settings - Fork 82
Improve elm-test.js #465
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
Merged
Merged
Improve elm-test.js #465
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
23629ec
elm-test.js: Organize `require`s
lydell 6f1612f
elm-test.js: Remove dead code
lydell c13377b
elm-test.js: Remove unnecessary uncaughtException handler
lydell e4cdcd5
elm-test.js: Replace `var` with `let` and `const`
lydell e3bd626
elm-test.js: Use arrow functions
lydell ba9d21d
elm-test.js: Remove unused CLI flag
lydell 5419e73
elm-test.js: WIP Parse CLI arguments in a more structured way
lydell 6572e92
Remove undocumented and rather useless --verbose option
lydell 469482e
Hide compiler Success print
lydell c7cb303
Fix option parsing
lydell 10e60b7
Parse --flag=value
lydell 937827b
Tests
lydell d735086
Add some type annotations
lydell 3dd8c8a
Remove unnecessary globifyWithRoot function
lydell 62081dc
Type Report
lydell 9ae34c7
Use type for Report everyhere
lydell 8e83f1f
Don’t require elm to exist in PATH to be able to show help
lydell b30f848
Improve help text
lydell 53e68a1
Improve error messages
lydell 7bd27a7
Convert to async/await where it improves readability
lydell d56ef96
Reorder functions slightly for better readability
lydell 8b56a06
Various cleanups
lydell df6d286
Better description for --compiler
lydell 322b832
Show defaults for all options
lydell d3c3ade
Fix accidentally flipped condition
lydell dda50af
Better data field for Error
lydell ab65696
Move flags parsing to its own file
lydell 1c45531
Reorder and better parameter name
lydell 02aa8c2
Exhaustive check switch:es in elm-test.js
lydell 263f671
Add some more type annotations
lydell bc3599a
Test negative integers
lydell 9199b63
Comment Prettier/Flow shenanigans
lydell 77110d0
Remove defunct Node.js version check
lydell 814e814
Disallow `--watch=some-value`
lydell 934e029
Use commander instead of custom parsing
lydell d96a08f
Remove dead code
lydell b18458e
Consistent error message
lydell 446ff1a
Apply suggestions from code review
lydell 1d2dea5
Post "Apply suggestions from code review" fixes
lydell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| elm-stuff | ||
| fixtures | ||
| templates | ||
| flow-typed |
This file contains hidden or 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 hidden or 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,18 @@ | ||
| // @flow | ||
|
|
||
| // We can’t use /*:: type Result<Error, Value> = ... */ because of: | ||
| // https://github.com/prettier/prettier/issues/2597 | ||
| // | ||
| // Because of the type arguments we can’t use the regular trick of making a type | ||
| // annotation instead and then use `typeof Result`. The workaround is to define | ||
| // `Result` globally – this file is not included during runtime. | ||
| // | ||
| // This also lets us use `Result` in several files without having to define it | ||
| // multiple times or figure out some way to import types. | ||
| // | ||
| // If you wonder why we use a weird mix of “real” syntax and comment syntax here | ||
| // – it’s because of Prettier again. If you “uncomment” the `<Error, Value>` | ||
| // part, Prettier adds `/*::` and `*/` back. | ||
| type Result/*:: <Error, Value> */ = | ||
| | { tag: 'Ok', value: Value } | ||
| | { tag: 'Error', error: Error }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,35 @@ | ||
| // @flow | ||
|
|
||
| // Poor man’s type alias. We can’t use /*:: type Report = ... */ because of: | ||
| // https://github.com/prettier/prettier/issues/2597 | ||
| const Report /*: 'console' | 'json' | 'junit' */ = 'console'; | ||
harrysarson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| function parse(string /*: string */) /*: Result<string, typeof Report> */ { | ||
| switch (string) { | ||
| case 'console': | ||
| case 'json': | ||
| case 'junit': | ||
| return { tag: 'Ok', value: string }; | ||
| default: | ||
| return { | ||
| tag: 'Error', | ||
| error: `unknown reporter: ${string}`, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| function isMachineReadable(report /*: typeof Report */) /*: boolean */ { | ||
| switch (report) { | ||
| case 'json': | ||
| case 'junit': | ||
| return true; | ||
| case 'console': | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| module.exports = { | ||
| Report, | ||
| parse, | ||
| isMachineReadable, | ||
| }; | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.