![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ava-fast-check
Advanced tools
Bring the power of property based testing framework fast-check into AVA.
ava-fast-check
simplifies the integration of fast-check into AVA testing framework.
Install ava-fast-check
and its peer dependencies:
npm install --save-dev ava fast-check ava-fast-check
import { testProp, fc } from 'ava-fast-check';
// 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()], (t, a, b, c) => {
t.true((a + b + c).includes(b));
});
The property is passed AVA's t
argument for its first parameter, and the value of each arbitrary for the current test case for the rest of the parameters.
ava-fast-check
supports all of AVA's assertions and like AVA, supports synchronous and asynchronous functions, including promises, observables, and callbacks. See AVA's documentation for more information.
fast-check
ParameterstestProp
accepts an optional fc.Parameters
for forwarding custom parameters to fast-check
(more).
ava-fast-check
also comes with .only
, .serial
.skip
, and .failing
modifiers from AVA.
import { testProp, fc } from 'ava-fast-check';
testProp('should replay the test for the seed 4242', [fc.nat(), fc.nat()], (t, a, b) => {
t.is(a + b, b + a);
}, { seed: 4242 });
testProp.skip('should be skipped', [fc.fullUnicodeString()], (t, text) => {
t.is([...text].length, text.length);
});
before
/after
Hooksava-fast-check
exposes AVA's before
/after
hooks:
import { testProp, fc } from 'ava-fast-check';
testProp.before(t => {
connectToDatabase();
});
testProp(
// ... omitted for brevity
);
testProp.after(t => {
closeDatabaseConnection();
});
ava-fast-check
mirror's AVA's procedure for customizing the test execution context:
import { fc, testProp as anyTestProp, PropertyTestInterface } from '../src/ava-fast-check';
type TestContext = {
state: string
};
const testProp = anyTestProp as PropertyTestInterface<TestContext>;
testProp(
'should reach terminal state',
[fc.string()],
(t, received) => {
// here t is typed as ExecutionContext<TestContext>
console.log(t.context.state); // logs 'uninitialized'
// ... omitted for brevity
}
);
ava-fast-check | AVA | fast-check |
---|---|---|
^6.0.0 | >=4.0.0 | ^3.0.0 |
^5.0.0 | >=4.0.0 | ^2.0.0(2)(4) |
^4.0.0 | >=3.9.0(1) | ^2.0.0(2) |
^3.0.0 | >=3.9.0(1) | ^2.0.0(2) |
^2.0.0 | >=3.9.0(1) | ^1.0.0 |
^1.0.0 | >=0.1.0(3) | ^1.0.0 |
ava@>=3.9.0
for t.try
supportfast-check@^2.0.0
for hybrid module support: commonjs
and esm
togetherava@>=0.1.0
for its Promise supportfast-check@^3.0.0
but bump to 6.0.0
for updated peer versionFAQs
Property based testing for AVA based on fast-check
We found that ava-fast-check demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.