Registry / testing / jsonscript-test

jsonscript-test

JSON →
library0.6.0jsnpmunverified

jsonscript-test (v0.6.0) is a testing library for JSONScript scripts, allowing developers to define and run test suites that validate script behavior. It is part of the JSONScript ecosystem and is currently a work in progress, with an unstable API expected to evolve. Unlike general testing frameworks, it is tailored specifically for JSONScript's declarative execution model. Release cadence is sporadic, as the project is in early development.

npm install jsonscript-test
INSTALL
IMPORT
SIG · JSONSCRIPT-TEST
J
jsonscript-test
testingjavascriptv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import test from 'jsonscript-test'
const test = require('jsonscript-test')
Package is ESM-only since v0.6.0; CommonJS require() will fail.
runSuite
import { runSuite } from 'jsonscript-test'
const { runSuite } = require('jsonscript-test')
Named export for running a test suite; CommonJS not supported.
defineSuite
import { defineSuite } from 'jsonscript-test'
import { defineSuite } from 'jsonscript-test/test'
Subpath imports are not defined; incorrect path may cause resolution errors.

Demonstrates defining and running a test suite for a JSONScript script, with import examples.

import test, { runSuite, defineSuite } from 'jsonscript-test'; // Define a test suite const suite = defineSuite({ name: 'My Suite', tests: [ { name: 'addition', script: { $op: 'add', left: 1, right: 2 }, expected: 3 } ] }); // Run the suite const results = runSuite(suite); console.log(results); // outputs test results
Debug
Known issues
gotchaPackage is a work in progress; API is unstable and may change without notice.
fix
Pin to exact version and expect breaking changes.
affects: *
breakingv0.6.0 switched to ESM-only; CommonJS require() will throw an error.
fix
Use ES module imports or downgrade to v0.5.x if CJS needed.
affects: >=0.6.0
gotchaTest suites must follow JSONScript schema; invalid scripts cause silent failures.
fix
Validate JSONScript scripts before including in test suites.
affects: *
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Running ESM code in a non-module Node.js environment.
fix
Add "type": "module" to package.json or use .mjs extension.
TypeError: require is not a function
Using require() in an ESM context after v0.6.0.
fix
Switch to import statements or downgrade to v0.5.0.
AssertionError: expected undefined to deeply equal 3
Test script returned undefined instead of expected value.
fix
Ensure JSONScript script produces correct output; check script definition.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
jsonscript-test — npm install jsonscript-test · libregistry