{"id":13527273,"url":"https://github.com/typicode/xv","last_synced_at":"2025-05-16T00:06:32.076Z","repository":{"id":43196550,"uuid":"374257107","full_name":"typicode/xv","owner":"typicode","description":"🙅‍♀️ ✌️ fastest test runner","archived":false,"fork":false,"pushed_at":"2023-10-08T21:35:39.000Z","size":150,"stargazers_count":828,"open_issues_count":0,"forks_count":38,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-10T04:39:10.312Z","etag":null,"topics":["ava","esm","javascript","jest","minimalist","mocha","node","nodejs","runner","tdd","test","testing","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typicode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"typicode"}},"created_at":"2021-06-06T03:14:04.000Z","updated_at":"2025-02-27T16:11:50.000Z","dependencies_parsed_at":"2024-01-13T19:22:57.866Z","dependency_job_id":null,"html_url":"https://github.com/typicode/xv","commit_stats":{"total_commits":118,"total_committers":2,"mean_commits":59.0,"dds":0.008474576271186418,"last_synced_commit":"dd33699b21a41688a83585ce1f9504151ff14a18"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fxv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fxv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fxv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typicode%2Fxv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typicode","download_url":"https://codeload.github.com/typicode/xv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ava","esm","javascript","jest","minimalist","mocha","node","nodejs","runner","tdd","test","testing","typescript"],"created_at":"2024-08-01T06:01:44.603Z","updated_at":"2025-05-16T00:06:32.046Z","avatar_url":"https://github.com/typicode.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cimg src=\"xv.svg\" alt=\"xv\" height=50\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n[![Node.js CI](https://github.com/typicode/xv/actions/workflows/node.js.yml/badge.svg)](https://github.com/typicode/xv/actions/workflows/node.js.yml) [![install size](https://packagephobia.com/badge?p=xv)](https://packagephobia.com/result?p=xv)\n\n\u003e A tiny (~80 lines of TypeScript) test runner focused on simplicity and speed\n\n```sh\n$ xv ./src\nsrc/add.test.js: 0.103ms\nsrc/sub.test.js: 0.064ms\n```\n\n_Extracted from [lowdb](https://github.com/typicode/lowdb). Fastest test runner according to this [benchmark](https://github.com/icetbr/comparing-testing-libraries)._\n\n## Why\n\nIf you've used other test runners, you probably have spent a significant amount of time reading docs, configuring, maintaining and debugging them.\n\nBy 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 ;)\n\n## Install\n\n```sh\nnpm install xv --save-dev\n```\n\n## Usage\n\nCreate a test file and use Node's built-in [`assert`](https://nodejs.org/api/assert.html) module:\n\n```js\n// src/add.test.js\nimport assert from 'node:assert/strict'\nimport add from './add.js'\n\n// This is plain Node code, there's no xv API\nexport function testAdd() {\n  assert.equal(add(1, 2), 3)\n}\n```\n\nEdit `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"xv src\"\n  }\n}\n```\n\nRun tests:\n\n```sh\nnpm test                # run all test files in ./src\nnpx xv src/add.test.js  # run a single test file\n```\n\n## Convention\n\nBy default, xv will look for files named: `*.test.js`, `test.js`, `*.test.ts` and `test.ts`\n\n## TypeScript\n\n### With TypeScript + [ts-node](https://typestrong.org/ts-node/)\n\n```sh\nnpm install ts-node --save-dev\n```\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"xv --loader=ts-node/esm src\"\n  }\n}\n```\n\n### With TypeScript only\n\nCompile your `.ts` files using `tsc` and run `xv` on compiled `.js` files. \n\nFor example, assuming your compiled files are in `lib/`, edit `package.json` to run `xv` after `tsc`:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"tsc \u0026\u0026 xv lib\"\n  }\n}\n```\n\nIf you're publishing to npm, edit `package.json` to exclude compiled test files:\n\n```json\n{\n  \"files\": [\n    \"lib\",\n    \"!lib/**/*.test.js\",\n    \"!lib/**/test.js\"\n  ]\n}\n```\n\n## Common JS\n\n```js\n// src/add.test.js\nconst assert = require('assert').strict;\nconst add = require('./add')\n\nexports.testAdd = function() {\n  assert.equal(add(1, 2), 3)\n}\n```\n\n## Watch mode\n\nxv doesn't have a watch mode. If the feature is needed, it's recommended to use tools like [watchexec](https://github.com/watchexec/watchexec) or [chokidar-cli](https://github.com/open-cli-tools/chokidar-cli) to re-run xv when there are changes.\n","funding_links":["https://github.com/sponsors/typicode"],"categories":["JavaScript","typescript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypicode%2Fxv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypicode%2Fxv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypicode%2Fxv/lists"}