Date comparison isn't very useful
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3k
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
Comparing dates with either `.equal` or `.is` results in some very obtuse output which makes it impossible to debug.
# input
```js
const { test } = require('uvu')
const assert = require('uvu/assert')
test('dates', () => {
const a = new Date()
const b = new Date(new Date().setMonth(5))
assert.is(a, b)
})
test.run()
```
# output
```sh
npx uvu
index.spec.js
✘ (0 / 1)
FAIL "dates"
Expected values to be strictly equal: (is)
++"2021-06-04T11:40:40.529Z" (Expected)
-- {} (Actual)
^^^^^^^^^^^^^^^^^^^^^^^^^^
at assert (/home/ant/Projects/uvutest/node_modules/uvu/assert/index.js:31:8)
at Object.is (/home/ant/Projects/uvutest/node_modules/uvu/assert/index.js:39:2)
at Object.handler (/home/ant/Projects/uvutest/index.spec.js:7:12)
at Number.runner (/home/ant/Projects/uvutest/node_modules/uvu/dist/index.js:77:16)
at exec (file:///home/ant/Projects/uvutest/node_modules/uvu/dist/index.mjs:131:39)
at Module.run (file:///home/ant/Projects/uvutest/node_modules/uvu/run/index.mjs:13:8)
at async /home/ant/Projects/uvutest/node_modules/uvu/bin.js:26:5
Total: 1
Passed: 0
Skipped: 0
Duration: 2.36ms
```
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
Reproduce the case in index.spec.js and start at uvu/assert/index.js, where the reported Object.is output is shown in the stack trace. Compare the failure output for Date values with the expected behavior described in the issue, then add or update assertion coverage so date comparisons produce useful diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100