forked from elm-explorations/test
-
Notifications
You must be signed in to change notification settings - Fork 0
Add equalToFile to Expect
#1
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
+285
−2
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ac0a8d1
Add `equalToFile` to Expect
micahhahn f90579b
Harden our file access API
micahhahn 1ec5b4d
Add pretty printer to query
micahhahn a84a18b
No need to check `existsSync`, `mkdirSync` works just fine if the dir…
micahhahn c9e645c
Add "node:" prefix to imports
micahhahn d7bac45
Write to a temp file if there are diffs and output instructions for h…
micahhahn d8fa6ea
Add OVERWRITE_GOLDEN_FILES behavior
micahhahn dd21c67
Write a ".failed" file next to the golden file instead of in temp
micahhahn 5f2caf6
Bring the file deletion into Elm land
micahhahn 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
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,46 @@ | ||
| module File exposing (AbsolutePath, FileError(..), RelativePath, overwriteGoldenFiles, readFile, writeFile, deleteFile) | ||
|
|
||
| import Elm.Kernel.Test | ||
|
|
||
|
|
||
| type FileError | ||
| = FileNotFound | ||
| | IsDirectory | ||
| | PathEscapesDirectory | ||
| | GeneralFileError String | ||
|
|
||
|
|
||
| type alias RelativePath = | ||
| String | ||
|
|
||
|
|
||
| type alias AbsolutePath = | ||
| String | ||
|
|
||
|
|
||
| {-| Read the contents of the filePath relative to "tests/" | ||
| -} | ||
| readFile : RelativePath -> Result FileError ( AbsolutePath, String ) | ||
| readFile = | ||
| Elm.Kernel.Test.readFile | ||
|
|
||
|
|
||
| {-| Write the contents of the second argument to the file path in the first argument relative to "tests/" | ||
|
|
||
| Returns the absolute file path if successful. | ||
|
|
||
| -} | ||
| writeFile : RelativePath -> String -> Result FileError AbsolutePath | ||
| writeFile = | ||
| Elm.Kernel.Test.writeFile | ||
|
|
||
| {-| Delete the file specified in filePath relative to "tests/" -} | ||
| deleteFile : RelativePath -> Result FileError () | ||
| deleteFile = | ||
| Elm.Kernel.Test.deleteFile | ||
|
|
||
| {-| Checks the OVERWRITE\_GOLDEN\_FILES environment variable | ||
| -} | ||
| overwriteGoldenFiles : () -> Bool | ||
| overwriteGoldenFiles = | ||
| Elm.Kernel.Test.overwriteGoldenFiles |
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
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.