PrettyFormatPluginError: object is not a function
See original GitHub issue🐛 Bug Report
The code below makes Jest crash internally with PrettyFormatPluginError: object is not a function
error
To Reproduce
Steps to reproduce the behavior:
- Create
./src/index.js
with code
'use strict'
module.exports = rec
function rec (p) {
return new Proxy(p, {
get: (obj, prop) => {
return rec(obj)
}
})
}
- Create
./test/index.test.js
with code
'use strict'
const rec = require('../src')
test('', () => {
const inner = 'inner'
const outer = rec({inner})
expect(outer.inner).toEqual('inner')
})
- Run Jest
FAIL test/index.test.js
× (9ms)
●
PrettyFormatPluginError: object is not a functionTypeError: object is not a function
at RegExp.test (<anonymous>)
7 | const outer = rec({inner})
8 |
> 9 | expect(outer.inner).toEqual('inner')
| ^
10 | })
at testName (node_modules/pretty-format/build/plugins/DOMCollection.js:47:53)
at Object.toEqual (test/index.test.js:9:23)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.558s
Ran all test suites.
Link to repl or repo (highly encouraged)
https://github.com/Alexsey/jest-bug-rec
Expected behavior
There should be a message on the actual error (if there is any)
envinfo
npx: installed 1 in 2.175s
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz
Binaries:
Node: 12.10.0 - C:\Program Files\nodejs\node.EXE
npm: 6.11.3 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: ^24.9.0 => 24.9.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React Function: TypeError: Object(...) is not a function
I am having some issues updating my team's code in order to app the inactivity function. But when trying to do ...
Read more >Object.prototype.hasOwnProperty() - JavaScript | MDN
The method returns false if the property is inherited, or has not been declared at all. Unlike the in operator, this method does...
Read more >TypeError: Object(...) is not a function : r/reactjs - Reddit
TypeError: Object(...) is not a function. Hello,. While working in React I made an ES6 arrow function. When I saved my work and...
Read more >JavaScript: Uncaught TypeError: n is not a function
This means that the expression did not return a function object. So you need to understand that what you are trying to achieve...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think i have the same error
Any idea ?
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.