Does not handle objects without prototype
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- testing
Research direction
Start with lib/interpolate-pos-arg.js, especially the String conversion shown in the stack trace, and reproduce the failure with the provided Node script using Object.create(null). Confirm the fix by ensuring assert.isUndefined reports a normal assertion error instead of a TypeError.
Written by the indexing model from the issue text.
Description
- library version : 3.2.0
- Environment : Node
What did you expect to happen?
That it would print a normal assertion error
What actually happens
It fails with
TypeError: Cannot convert object to primitive value
at String (<anonymous>)
at /tmp/test1/node_modules/@sinonjs/referee/lib/interpolate-pos-arg.js:12:44
at Array.reduce (<anonymous>)
at interpolatePosArg (/tmp/test1/node_modules/@sinonjs/referee/lib/interpolate-pos-arg.js:9:12)
at Object.fail (/tmp/test1/node_modules/@sinonjs/referee/lib/define-assertion.js:30:27)
at assertion (/tmp/test1/node_modules/@sinonjs/referee/lib/define-assertion.js:68:17)
at Function.referee.<computed>.<computed> [as isUndefined] (/tmp/test1/node_modules/@sinonjs/referee/lib/define-assertion.js:93:26)
at Object.<anonymous> (/tmp/test1/mytest.js:4:8)
How to reproduce
$ cat > mytest.js << EOF
var referee = require("@sinonjs/referee");
var assert = referee.assert;
assert.isUndefined(Object.create(null));
EOF
node mytest.js
- Dominant language
- JavaScript
- Stars
- 43
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Contributor guide
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.
More from sinonjs/referee
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Documentation and assert.equals error message still reference deprecated (removed) defined assertion Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·