Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@fast-check/jest
Advanced tools
@fast-check/jest
Bring the power of property based testing framework fast-check
into Jest.
@fast-check/jest
simplifies the integration of fast-check
into Jest testing framework.
Install @fast-check/jest
:
npm install --save-dev @fast-check/jest
In order to work properly, @fast-check/jest
requires jest
to be installed.
import { testProp, fc } from '@fast-check/jest';
// for all a, b, c strings
// b is a substring of a + b + c
testProp('should detect the substring', [fc.string(), fc.string(), fc.string()], (a, b, c) => {
return (a + b + c).includes(b);
});
Please note that the properties accepted by @fast-check/jest
as input can either be synchronous or asynchronous (even just PromiseLike
instances).
If you want to forward custom parameters to fast-check, testProp
accepts an optional fc.Parameters
(more).
@fast-check/jest
also comes with .only
, .skip
and .todo
from jest.
import { itProp, testProp, fc } from '@fast-check/jest';
testProp(
'should replay the test for the seed 4242',
[fc.nat(), fc.nat()],
(a, b) => {
return a + b === b + a;
},
{ seed: 4242 }
);
testProp.skip('should be skipped', [fc.fullUnicodeString()], (text) => {
return text.length === [...text].length;
});
describe('with it', () => {
itProp('should run too', [fc.nat(), fc.nat()], (a, b) => {
return a + b === b + a;
});
});
@fast-check/jest | jest | fast-check |
---|---|---|
^1.0.0 | >=26.5.0(1)(2) | ^3.0.0 |
jest
should be greater or equal than 26.5.0 if you are using commonjs
esm
build, you may need to enable experimental features of node, see hereFAQs
Property based testing for Jest based on fast-check
The npm package @fast-check/jest receives a total of 40,669 weekly downloads. As such, @fast-check/jest popularity was classified as popular.
We found that @fast-check/jest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.