regexpu-fixtures
raw JSON → 2.1.6 verified Fri May 01 auth: no javascript maintenance
Test fixtures (test cases) for the regexpu project, which transpiles ES2015 Unicode regular expressions to ES5. Version 2.1.6 is stable. The package contains JSON data used by regexpu's test suite and may be reused by other JavaScript regex tools. No active development since the last release. Differentiator: provides a comprehensive set of test cases for Unicode-aware regex transpilation.
Common errors
error Cannot find module 'regexpu-fixtures' ↓
cause Importing the package without specifying a JSON file path.
fix
Import a specific file: import data from 'regexpu-fixtures/data.json' assert { type: 'json' };
Warnings
gotcha No default export from the package; you must import JSON files by their full path with extension. ↓
fix Use import with path to .json file and assert type (ESM) or require with .json extension (CJS).
Install
npm install regexpu-fixtures yarn add regexpu-fixtures pnpm add regexpu-fixtures Imports
- data wrong
const data = require('regexpu-fixtures');correctimport data from 'regexpu-fixtures/data.json' assert { type: 'json' }; - rawFixtures wrong
const rawFixtures = require('regexpu-fixtures/raw-fixtures');correctimport rawFixtures from 'regexpu-fixtures/raw-fixtures.json' assert { type: 'json' }; - es6 wrong
import es6 from 'regexpu-fixtures';correctimport es6 from 'regexpu-fixtures/es6.json' assert { type: 'json' };
Quickstart
import data from 'regexpu-fixtures/data.json' assert { type: 'json' };
console.log(Object.keys(data)); // List of fixture categories
// Access specific test cases
const es5fixtures = data['es5-fixtures'];
console.log(es5fixtures.length); // Number of test cases