forked from vlucas/frisby
-
Notifications
You must be signed in to change notification settings - Fork 0
Jest
H1Gdev edited this page Sep 9, 2026
·
16 revisions
it('Test resolves.not.toThrow()', async () => {
await expect(async function() {
await test();
}()).resolves.not.toThrow();
});
it('Test .rejects.toThrow()', async () => {
await expect(async () => {
await test();
}).rejects.toThrow();
});it.each([...Array(3).keys()])('%i times', (n) => {
// Test.
});const testif = condition => condition ? test : test.skip;
const itif = condition => condition ? it : it.skip;
itif(true)('test', () => {
// Test.
});
itif(false)('skip test', () => {
// Test.
});- cannot be used with
test.each...
npm install jest-html-reporters --save-dev "jest": {
"reporters": [
"default",
[
"jest-html-reporters",
{
"publicPath": "./html-report",
"filename": "index.html",
"openReport": true
}
]
]
},npm install jest-junit --save-dev "jest": {
"reporters": [
"default",
"jest-junit"
]
},
"jest-junit": {
"outputDirectory": "<rootDir>/reports",
"outputName": "results.xml"
}npm test -- --coverage