
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
ava-fixture
Advanced tools
This library helps you to write fixture tests: test-per-folder or test-per-file.
For example, you are testing code that process files (e.g. a compiler, config-reader, etc).
You put each test case inside its own folder:
+ fixtures
+ cases
+ empty
- somefiles
+ basic-case
- someOtherFiles
+ single-line
- ...
+ ...
You can run each test case like this:
import ava from 'ava';
import fixture from 'ava-fixture';
// Point to the base folder which contain the fixtures.
// Use relative path starts from project root or absolute path
const ftest = fixture(ava, 'fixtures/cases', 'fixtures/baselines', 'fixtures/results');
ftest.each((t, d) => {
// d.caseName: 'empty', 'basic-case', 'single-line', etc
// d.casePath: absolute path points to each test case folder
// d.resultPath: absolute path points to each test result folder
// Your test target reads from `d.casePath` and writes to `d.resultPath`
target.process(d.casePath, d.resultPath)
// d.match() will compare the result folder against the baseline folder
return d.match()
})
You can also use this library to run tests that only read files:
import ava from 'ava';
import fixture from 'ava-fixture';
// Point to the base folder which contain the fixtures.
// Relative path starts from project root.
const ftest = fixture(ava, 'fixture/cases');
ftest('test title', 'case-1', (t, d) => {
// t is ava test assertion.
t.is(d.casePath, 'absolut path the the case folder')
const result = target.read(d.casePath)
t.deepEqual(result, 'expected result')
});
// test title can be omitted
ftest('case-1', (t, d) => {
// ...
})
// go through each test
ftest.each((t, d) => {
// ...
})
// or run certain test based on filter
ftest.each(/some filter/, (t, d) => {
// ...
})
import test from 'ava';
import fixture from 'ava-fixture';
const ftest = fixture(test, 'fixture/cases');
ftest.only(...)
ftest.skip(...)
ftest.failing(...)
ftest.only.each.failing(...)
For before()
, beforeEach()
, after()
, afterEach()
, todo()
, use ava
directly.
# right after clone
npm install
# begin making changes
git checkout -b <branch>
npm run watch
# edit `webpack.config.es5.js` and `rollup.config.es2015.js` to exclude dependencies for the bundle if needed
# after making change(s)
git commit -m "<commit message>"
git push
# create PR
There are a few useful commands you can use during development.
# Run tests (and lint) automatically whenever you save a file.
npm run watch
# Run tests with coverage stats (but won't fail you if coverage does not meet criteria)
npm run test
# Manually verify the project.
# This will be ran during 'npm preversion' so you normally don't need to run this yourself.
npm run verify
# Build the project.
# You normally don't need to do this.
npm run build
# Run tslint
# You normally don't need to do this as `npm run watch` and `npm version` will automatically run lint for you.
npm run lint
Generated by generator-unional@0.9.0
FAQs
Write fixture tests with ava
The npm package ava-fixture receives a total of 27 weekly downloads. As such, ava-fixture popularity was classified as not popular.
We found that ava-fixture 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
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.