generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `generateDiff` function now has a comprehensive test suite. It has been updated to ensure that the resulting diff displays a notice about whether or not the file has a trailing newline. I started this journey by trying to ensure we were trimming each line properly. I found that `diff.diffLines` always returned change sets that ended in a newline, except when returning the very last change to a file that didn't terminate in a newline. So in order to ensure we were correctly showing all changes, I needed to add special handling for end-of-file changes. We could display this differently than I've chosen to here, but I figured showing what `git` shows was a good start. The `generateDiff` function now also ensures the correct context is shown in between each change. The dependency `outdent` was added to help with writing inline test fixtures. This saves us from having to come up with a name for each fixture and cross-reference them in each test. When adding that dependency, an ESLint error brought to my attention that we were accidentally including test files in our `files` property in `package.json`. It was updated to exclude test files, which resolved the ESLint error.
- Loading branch information
Showing
4 changed files
with
398 additions
and
25 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
Oops, something went wrong.