Skip to content

Commit

Permalink
fix windows-only ci issues due to crlf
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Aug 10, 2020
1 parent 71a7910 commit 63042e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/bundler/bundler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ func (s *suite) compareSnapshot(t *testing.T, testName string, generated string)
s.generatedSnapshots = make(map[string]string)
s.expectedSnapshots = make(map[string]string)
if contents, err := ioutil.ReadFile(s.path); err == nil {
for _, part := range strings.Split(string(contents), snapshotSplitter) {
// Replacing CRLF with LF is necessary to fix tests in GitHub actions,
// which for some reason check out the source code in CLRF mode
for _, part := range strings.Split(strings.ReplaceAll(string(contents), "\r\n", "\n"), snapshotSplitter) {
if newline := strings.IndexByte(part, '\n'); newline != -1 {
key := part[:newline]
value := part[newline+1:]
Expand Down

0 comments on commit 63042e0

Please sign in to comment.