print trailing "\n" in multiline diff
Open
Nobody has claimed this yet.
bug
- Dominant language
- JavaScript
- Stars
- 3k
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
assert.fixture fails even if the actual result is equal to the expected
is there any way to debug more, why the test fails, even the result is correct?
const formatT = suite("FORMAT")
formatT("correct format", () => {
let input = `
<div
class="bg-red-500"
>
Test
</div>
`
fixture(
new Magician(new Processor(), input, "src/App.svelte").format().getCode(),
`<div class="bg-red-500">Test</div>`
)
})
formatT.run()
FAIL FORMAT "correct format"
Expected value to match fixture: (fixture)
Actual:
L1 --<div·class="bg-red-500">Test</div>
Expected:
L1 ++<div·class="bg-red-500">Test</div>
at assert (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/assert/index.js:31:8)
at fixture (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/assert/index.js:77:2)
at Object.handler (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/tests/magician.ts:28:19)
at Number.runner (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/dist/index.js:77:16)
at exec (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/dist/index.js:131:39)
at async Object.exports.run (C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/run/index.js:12:2)
at async C:/Users/Alexander/Documents/projects/windicss/svelte-windicss-preprocess/node_modules/uvu/bin.js:28:5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing case in tests/magician.ts and inspect the fixture assertion reported at node_modules/uvu/assert/index.js:77. Reproduce the multiline comparison and determine how the diff represents a trailing newline; done when the shown case clearly exposes that difference without obscuring the compared values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100