Registry / testing / jstest

jstest

JSON →
library1.0.5jsnpmunverified

jstest is an abandoned cross-platform JavaScript test framework, with its last known update around 2014 and the latest npm package version `1.0.5` published in March 2014. It predates most modern JavaScript testing paradigms and tooling, relying heavily on a global `JS.Test` object after a CommonJS `require()`. Unlike contemporary frameworks like Jest or Mocha, jstest offers a very basic set of assertions and test organization (describe/it blocks) without built-in mocking, snapshot testing, or sophisticated test runner features. Its design makes it largely incompatible with modern JavaScript module systems (ESM) and recent Node.js versions. Given its age and lack of maintenance, it is not suitable for new projects and poses significant compatibility and security risks for existing ones.

npm install jstest
INSTALL
IMPORT
SIG · JSTEST
J
jstest
testingjavascriptv1.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

JS
const JS = require('jstest');
import JS from 'jstest';
jstest is a CommonJS module and exports a global 'JS' object. ESM 'import' syntax will not work.
JS.Test.describe
const JS = require('jstest'); JS.Test.describe('My test suite', function() { /* ... */ });
const { describe } = require('jstest');
The main testing functions like 'describe', 'it', and 'assert' are nested under the global 'JS.Test' object, not directly exported as named properties from the package root.
JS.Test.autorun
const JS = require('jstest'); // ... define tests ... JS.Test.autorun();
jstest.autorun();
Calling `JS.Test.autorun()` triggers the execution of all defined test suites, typically at the end of your test file. It's not a standalone function but part of the global `JS.Test` object.

This quickstart demonstrates a basic test suite using `JS.Test.describe`, `it`, and `assert` functions, showcasing the `with(this)` context and `before` hook typical of jstest. It runs all tests using `JS.Test.autorun()`.

const JS = require('jstest'); JS.Test.describe('My Feature', function() { with (this) { before(function() { this.counter = 0; }); it('should increment the counter', function() { with (this) { this.counter++; assert(this.counter === 1, 'Counter should be 1'); } }); describe('Nested tests', function() { with (this) { it('should double the counter', function() { with (this) { this.counter *= 2; assert(this.counter === 2, 'Counter should be 2'); } }); } }); it('should reset the counter for each top-level test', function() { with (this) { assert(this.counter === 0, 'Counter should be 0 at start of new top-level test'); } }); } }); // Run all defined tests JS.Test.autorun();
Debug
Known issues
breakingjstest is an abandoned project, with its last npm publication over a decade ago (March 2014). It receives no maintenance, security updates, or compatibility fixes, making it unsuitable for modern development and potentially vulnerable.
fix
Migrate to a actively maintained JavaScript testing framework such as Jest, Mocha, or Vitest.
affects: >=1.0.5
gotchajstest uses CommonJS modules and cannot be directly imported using ES module (ESM) syntax (e.g., `import JS from 'jstest';`). Attempting to do so in an ESM environment will result in a module resolution error.
fix
Ensure you are using CommonJS `require()` syntax: `const JS = require('jstest');`.
affects: >=1.0.0
gotchaThe framework relies on a global `JS.Test` object. If running in a browser environment without proper script tag loading or in a Node.js environment without assigning the `require('jstest')` result to a variable, core functions like `describe` or `it` will be undefined.
fix
Always capture the module export: `const JS = require('jstest');` and then use `JS.Test.describe`, `JS.Test.it`, etc. In a browser, ensure `jstest.js` is loaded via a `<script>` tag before your test code.
affects: >=1.0.0
gotchajstest's assertion API (e.g., `assert(condition, message)`) is significantly less expressive and feature-rich compared to modern `expect()`-based APIs. It lacks matchers for complex comparisons, mocking capabilities, or snapshot testing.
fix
If migrating is not an option, you will need to implement more complex assertions manually or integrate a separate, lightweight assertion library (which may introduce its own compatibility challenges).
affects: >=1.0.0
gotchaThe `with(this)` construct used extensively in jstest for context scoping is a deprecated and discouraged JavaScript feature due to its negative impact on performance and readability, and its potential for unexpected behavior.
fix
While `jstest` itself uses it, avoid this pattern in new JavaScript code. If you must use jstest, be aware of the implications. Migration is strongly recommended.
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax with jstest in a Node.js environment configured for CommonJS, or generally in an older Node.js version.
fix
Use CommonJS `require()` syntax: `const JS = require('jstest');`.
ReferenceError: JS is not defined
The `jstest` module was not correctly `require()`d or its export was not assigned to a `JS` variable, and subsequently, `JS.Test` is accessed.
fix
Ensure `const JS = require('jstest');` is at the top of your test file.
TypeError: JS.Test.describe is not a function
The `jstest` module was loaded, but `describe` or other test functions are being accessed directly from `JS` instead of `JS.Test`.
fix
Access the testing utilities through the `JS.Test` object: `JS.Test.describe()`, `JS.Test.it()`, etc.
TypeError: assert is not a function
The `assert` function is used directly without being bound to the test context, especially outside of a `with(this)` block or without explicit `this.assert`.
fix
Ensure `assert` is called within the correct context. Inside `it` or `describe` blocks, use `with(this) { assert(...) }` or explicitly `this.assert(...)`.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources