Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Nodebestpractices | 87,387 | 21 hours ago | 36 | cc-by-sa-4.0 | JavaScript | |||||
:white_check_mark: The Node.js best practices list (March 2023) | ||||||||||
Puppeteer | 82,404 | 12,128 | 10,932 | 2 hours ago | 761 | September 22, 2022 | 257 | apache-2.0 | TypeScript | |
Headless Chrome Node.js API | ||||||||||
Mocha | 21,954 | a day ago | 286 | mit | JavaScript | |||||
☕️ simple, flexible, fun javascript test framework for node.js & the browser | ||||||||||
Javascript Testing Best Practices | 21,034 | 9 days ago | 55 | mit | JavaScript | |||||
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (December 2022) | ||||||||||
Ava | 20,284 | 44,279 | 29,305 | 2 days ago | 104 | September 04, 2022 | 89 | mit | JavaScript | |
Node.js test runner that lets you develop with confidence 🚀 | ||||||||||
Keycloak | 15,351 | 215 | 262 | an hour ago | 105 | September 14, 2022 | 1,804 | apache-2.0 | Java | |
Open Source Identity and Access Management For Modern Applications and Services | ||||||||||
Nightwatch | 11,337 | 15,845 | 2,910 | 3 hours ago | 279 | September 17, 2022 | 208 | mit | JavaScript | |
End-to-end testing framework written in Node.js and using the W3C Webdriver API | ||||||||||
Color Thief | 11,321 | 7 | 35 | 23 days ago | 7 | July 06, 2020 | 66 | mit | JavaScript | |
Grab the color palette from an image using just Javascript. Works in the browser and in Node. | ||||||||||
Kind | 11,306 | 280 | 3 hours ago | 163 | September 22, 2022 | 179 | apache-2.0 | Go | ||
Kubernetes IN Docker - local clusters for testing Kubernetes | ||||||||||
Volkswagen | 10,935 | 5 | 5 | 3 years ago | 15 | October 16, 2015 | 58 | mit | JavaScript | |
:see_no_evil: Volkswagen detects when your tests are being run in a CI server, and makes them pass. |
A tiny (~80 lines of TypeScript) test runner focused on simplicity and speed
$ xv ./src
src/add.test.js: 0.103ms
src/sub.test.js: 0.064ms
Extracted from lowdb. One of the fastest test runner according to this benchmark.
If you've used other test runners, you probably have spent a significant amount of time reading docs, configuring, maintaining and debugging them.
By being extremely simple, xv gets out of your way and lets you be productive faster. In fact, the whole project documentation fits in this page ;)
npm install xv --save-dev
Create a test file and use Node's built-in assert
module:
// src/add.test.js
import assert from 'node:assert/strict'
import add from './add.js'
// This is plain Node code, there's no xv API
export function testAdd() {
assert.equal(add(1, 2), 3)
}
Edit package.json
:
{
"scripts": {
"test": "xv src"
}
}
Run tests:
npm test # run all test files in ./src
npx xv src/add.test.js # run a single test file
By default, xv will look for files named: *.test.js
, test.js
, *.test.ts
and test.ts
npm install ts-node --save-dev
{
"scripts": {
"test": "xv --loader=ts-node/esm src"
}
}
Compile your .ts
files using tsc
and run xv
on compiled .js
files.
For example, assuming your compiled files are in lib/
, edit package.json
to run xv
after tsc
:
{
"scripts": {
"test": "tsc && xv lib"
}
}
If you're publishing to npm, edit package.json
to exclude compiled test files:
{
"files": [
"lib",
"!lib/**/*.test.js",
"!lib/**/test.js"
]
}
// src/add.test.js
const assert = require('assert').strict;
const add = require('./add')
exports.testAdd = function() {
assert.equal(add(1, 2), 3)
}
xv doesn't have a watch mode. If the feature is needed, it's recommended to use tools like watchexec or chokidar-cli to re-run xv when there are changes.