sinonjs / sinonjs/sinon

Throw meaningful error message when trying to return non-objects from stub used as constructor

Open
#2,532 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation wontfix
Dominant language
JavaScript
Stars
9.8k
Forks
809
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
See #1676. User's think that not returning a string or other non-object is an error when newing up objects. We should rather explicitly throw an error message saying this is intended.

Describe the solution you'd like
Throw an error

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #1676 and locating the stub behavior used as a constructor. Done means that returning a non-object from such a stub produces a meaningful explicit error, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.