2.1.0 version with node and jest mocking causes errors
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- testing-qa, tooling
Research direction
Start by reproducing the error at jest.spyOn(transactionDomain, 'upsertThing') with tslib 2.1.0 and the listed TypeScript, Node, Jest, ts-jest, and ts-node versions. Trace the export from the standalone upsertThing file through the index export, then compare behavior with tslib 1.14.1. Done means identifying the compatibility regression and establishing a verified fix or clear reproduction.
Written by the indexing model from the issue text.
Description
When upgrading to the newest versions of tslib, typescript, and jest I received the following error in an existing project:
TypeError: Cannot redefine property: upsertThing
at Function.defineProperty (<anonymous>)
jest.spyOn(transactionDomain, 'upsertThing');
upsertThing is a function exported from it's own file, then again exported from an index file via export *.... When jest tries to spy on it, this error is thrown with version 2.1.0 of tslib. But when I downgrade to tslib 1.14.1 the error goes away.
Version Info:
Node: Tried on both 12 and 14
jest: 26.6.3
ts-jest: 26.4.4
ts-node: 9.1.1
typescript: 4.1.3
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
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.
More from microsoft/tslib
-
question
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·