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
Merged
Changes from 1 commit
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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -1,15 +1,45 @@ | ||
| module File exposing (readFile, writeFile, FileError(..)) | ||
| module File exposing (AbsolutePath, FileError(..), RelativePath, readFile, writeFile, writeTempFile) | ||
|
|
||
| import Elm.Kernel.Test | ||
|
|
||
|
|
||
| type FileError | ||
| = FileNotFound | ||
| | IsDirectory | ||
| | PathEscapesDirectory | ||
| | GeneralFileError String | ||
|
|
||
| readFile : String -> Result FileError String | ||
| readFile = Elm.Kernel.Test.readFile | ||
|
|
||
| writeFile : String -> String -> Result FileError () | ||
| writeFile = Elm.Kernel.Test.writeFile | ||
| 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 | ||
|
|
||
|
|
||
| {-| Write the contents of the second argument to the file path in the first argument relative to a temp directory | ||
|
|
||
| Returns the absolute file path if successful. | ||
|
|
||
| -} | ||
| writeTempFile : RelativePath -> String -> Result FileError AbsolutePath | ||
| writeTempFile = | ||
| Elm.Kernel.Test.writeTempFile |
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.
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.
Not sure how hard we're trying to make this cross-platform but
openis MacOS specific.On Linux I think it's
xdg-open. I don't know the command on Windows, but I think the path would have backslashes that would have to be converted to forward slashes for the URL.I think it's best not to worry about this for now though! If this ever gets upstreamed it would need to be tested and patched by someone on those platforms.