You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. Today, I tried to run Danger tests for the first time. My Git installation is very stock and has core.autocrlf set to true (as is default on Windows.)
These problems can reliably be resolved by switching off autocrlf like this:
The failures mainly seem to result from code that does not strip \r. Therefore errant \rs appear at the beginning of lines sometimes, causing diffs to mismatch.
The problem can be solved from two angles:
Handling the carriage return more gracefully where possible. In this case, the bug is specifically from loading a fixture, not something that would ever come up in practice, but the test could be fixed to strip carriage returns.
Forcing danger-js to always checkout as UNIX line-endings by specifying it should be so in the .gitattributes file:
* text eol=lf
The latter would normalize things better across platforms, but personally seems like a bad idea.
The tests failed with the following results:
FAIL source\platforms\github\_tests\_github_git.test.ts
● the dangerfile gitDSL › sets the modified/created/deleted
Error
69 | it("sets the modified/created/deleted", async () => {
70 | const gitJSONDSL = await github.getPlatformGitRepresentation()
> 71 | expect(gitJSONDSL.modified_files).toEqual([
72 | "CHANGELOG.md",
73 | "data/schema.graphql",
74 | "data/schema.json",
Error: expect(received).toEqual(expected)
Expected value to equal:
["CHANGELOG.md", "data/schema.graphql", "data/schema.json", "externals/metaphysics", "lib/__mocks__/react-relay.js", "lib/components/artist/about.js", "lib/components/gene/header.js", "lib/containers/__tests__/__snapshots__/gene-tests.js.snap", "lib/containers/__tests__/gene-tests.js", "lib/containers/gene.js", "tsconfig.json"]
Received:
["CHANGELOG.md", "data/schema.graphql", "data/schema.json", "externals/metaphysics", "lib/__mocks__/react-relay.js", "lib/components/artist/", "lib/components/gene/biography.js", "lib/components/gene/header.js", "lib/components/related_artists/index.js", "lib/components/related_artists/related_artist.js", "lib/containers/__tests__/__snapshots__/gene-tests.js.snap", "lib/containers/__tests__/gene-tests.js", "lib/containers/gene.js", "tsconfig.json"]
Difference:
- Expected
+ Received
@@ -3,11 +3,18 @@
"data/schema.graphql",
"data/schema.json",
"externals/metaphysics",
"lib/__mocks__/react-relay.js",
"lib/components/artist/about.js",
+ "/dev/null",
+ "/dev/null",
+ "lib/components/gene/about.js",
", + "lib/components/gene/about_gene.js
+ "lib/components/gene/biography.js",
"lib/components/gene/header.js",
+ "lib/components/related_artists/index.js",
+ "lib/components/related_artists/related_artist.js",
"lib/containers/__tests__/__snapshots__/gene-tests.js.snap",
"lib/containers/__tests__/gene-tests.js",
"lib/containers/gene.js",
"tsconfig.json",
]
at Object.<anonymous> (source/platforms/github/_tests/_github_git.test.ts:71:47)
at step (source/platforms/github/_tests/_github_git.test.ts:32:23)
at Object.next (source/platforms/github/_tests/_github_git.test.ts:13:51)
at fulfilled (source/platforms/github/_tests/_github_git.test.ts:4:56)
● the dangerfile gitDSL › textDiffForFile › returns a diff for modified files
Error
476 | expect(diff.before).toEqual(before)
477 | expect(diff.after).toEqual(after)
> 478 | expect(diff.added).toEqual("+- GeneVC now shows about information, and trending artists - orta")
479 | expect(diff.removed).toEqual("")
480 | expect(diff.diff).toMatch(/GeneVC now shows about information, and trending artists/)
481 | })
Error: expect(received).toEqual(expected)
Expected value to equal:
"+- GeneVC now shows about information, and trending artists - orta"
Received:
" "+- GeneVC now shows about information, and trending artists - orta
at Object.<anonymous> (source/platforms/github/_tests/_github_git.test.ts:478:34)
at step (source/platforms/github/_tests/_github_git.test.ts:32:23)
at Object.next (source/platforms/github/_tests/_github_git.test.ts:13:51)
at fulfilled (source/platforms/github/_tests/_github_git.test.ts:4:56)
Test Suites: 1 failed, 24 passed, 25 total
Tests: 2 failed, 210 passed, 212 total
Snapshots: 6 passed, 6 total
Time: 7.158s
Ran all test suites.
The text was updated successfully, but these errors were encountered:
jchv
added a commit
to jchw-forks/danger-js
that referenced
this issue
Jan 3, 2018
Hello. Today, I tried to run Danger tests for the first time. My Git installation is very stock and has
core.autocrlf
set totrue
(as is default on Windows.)These problems can reliably be resolved by switching off
autocrlf
like this:The failures mainly seem to result from code that does not strip
\r
. Therefore errant\r
s appear at the beginning of lines sometimes, causing diffs to mismatch.The problem can be solved from two angles:
danger-js
to always checkout as UNIX line-endings by specifying it should be so in the.gitattributes
file:The latter would normalize things better across platforms, but personally seems like a bad idea.
The tests failed with the following results:
The text was updated successfully, but these errors were encountered: