toBeArrayOfSize() throwing error on constructing message
See original GitHub issueWhen using:
expect(arrayOfObjects).toBeArrayOfSize(n)
I am getting errors from expect-more on creation of the jest error message when the test fails:
TypeError: Cannot convert object to primitive value
at Array.join (<anonymous>)
at Array.toString (<anonymous>)
at message (node_modules/expect-more-jest/dist/to-be-array-of-size.js:7:51)
at message (node_modules/expect-more-jest/dist/lib/create-result.js:6:62)
at getMessage (node_modules/expect/build/index.js:209:15)
at processResult (node_modules/expect/build/index.js:327:25)
at Object.toBeArrayOfSize (node_modules/expect/build/index.js:396:16)
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
jest-community/jest-extended: Additional Jest matchers - GitHub
Problem. Jest is an amazing test runner and has some awesome assertion APIs built in by default. However, there are times when having...
Read more >jest-extended - npm
toBeArrayOfSize when checking if a value is an Array of size x. ... test('throws an error of type TypeError with message "hello world"', ......
Read more >jest-extended 1.0: Additional Matchers for Jest Users - Morioh
toBeArrayOfSize when checking if a value is an Array of size x. ... test('throws an error of type TypeError with message "hello world"',...
Read more >Jest exception match both type and message - Stack Overflow
Your example code would look like this: test("should throw a CustomError with the right message", () => { expect( ...
Read more >Scripting support - OpenTest
but when I include it in yaml file than it throws an error as the package which I installed cannot be found. 2....
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 Free
Top 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
Released in 4.0.2, please let me know of any issues and thanks for all your work on investigating this issue.
Here is a more formal test you could use:
This proves that object literals create objects with prototypes since the first set of expectations work. The second usage should match behavior of the first but fails due to objects not having prototypes.