Gathering detailed insights and metrics for @jason0x43/jest-expect-message
Gathering detailed insights and metrics for @jason0x43/jest-expect-message
Gathering detailed insights and metrics for @jason0x43/jest-expect-message
Gathering detailed insights and metrics for @jason0x43/jest-expect-message
npm install @jason0x43/jest-expect-message
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
16 Commits
1 Forks
1 Watchers
13 Branches
1 Contributors
Updated on Jun 12, 2021
Latest Version
1.1.1
Package Id
@jason0x43/jest-expect-message@1.1.1
Unpacked Size
24.83 kB
Size
8.53 kB
File Count
21
NPM Version
7.17.0
Node Version
16.3.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
🃏🗯
Add custom message to Jest expects
Note: This is a fork of mattphillips/jest-expect-message with TS source and updates for Jest 27.
In many testing libraries it is possible to supply a custom message for a given expectation, this is currently not possible in Jest.
For example:
1test('returns 2 when adding 1 and 1', () => { 2 expect(1 + 1, 'Woah this should be 2!').toBe(3); 3});
This will throw the following error in Jest:
1Expect takes at most one argument.
jest-expect-message
allows you to call expect
with a second argument of a String
message.
For example the same test as above:
1test('returns 2 when adding 1 and 1', () => { 2 expect(1 + 1, 'Woah this should be 2!').toBe(3); 3});
With jest-expect-message
this will fail with your custom error message:
1 ● returns 2 when adding 1 and 1 2 3 Custom message: 4 Woah this should be 2! 5 6 expect(received).toBe(expected) // Object.is equality 7 8 Expected: 3 9 Received: 2
With npm:
1npm install --save-dev jest-expect-message
With yarn:
1yarn add -D jest-expect-message
Add jest-expect-message
to your Jest setupFilesAfterEnv
configuration.
See for help
1"jest": { 2 "setupFilesAfterEnv": ["jest-expect-message"] 3}
1"jest": { 2 "setupTestFrameworkScriptFile": "jest-expect-message" 3}
expect(actual, message)
actual
: The value you would normally pass into an expect
to assert against with a given matcher.message
: String, the custom message you want to be printed should the expect
fail.1test('returns 2 when adding 1 and 1', () => { 2 expect(1 + 1, 'Woah this should be 2!').toBe(3); 3});
Matt Phillips 💻 📖 💡 🤔 🚇 ⚠️ 🔧 |
---|
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
68 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More