Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Dec 9, 2022
1 parent e014848 commit 716f672
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
<br>
</p>

> xv is a blazingly fast test runner that works differently
## Features

- __Simple__ - zero-config, no API to learn, out of the box ESM/CJS support
- __Lightweight__ - 6kB and no dependencies
- __Magical__ - simply export test functions, that's all
- __Blazingly fast__ - with almost zero abstractions, xv is as fast as Node
- __TypeScript__ - no complex setup, xv works with TypeScript + ESM
- __Blazingly fast__ - with almost zero abstractions, xv is one of the fastest test runners
- __Different__ - simply export test functions, doesn't hide console logs, raw errors, ...
- __Lightweight__ - 2kB for the runner code and no dependencies
- __Unix philosophy™__ - `do one thing well`, xv is _only_ a test runner

Used by [lowdb](https://github.com/typicode/lowdb) (local JSON database), [steno](https://github.com/typicode/steno) (fast file writer) and other [awesome projects](https://github.com/typicode/xv/network/dependents).
Expand All @@ -30,7 +33,7 @@ Create a test file and use Node's built-in [`assert`](https://nodejs.org/api/ass

```js
// src/add.test.js
import { strict as assert } from 'assert'
import assert from 'node:assert/strict'
import add from './add.js'

// This is plain Node code, there's no xv API
Expand Down Expand Up @@ -63,11 +66,34 @@ npx xv src/add.test.js

## Convention

When provided with a directory, xv will look for files named `*.test.js` or `test.js` and run exported functions sequentially.
When provided with a directory, xv will look for files named:

* `*.test.js`
* `test.js`
* `*.test.ts`
* `test.ts`

And run exported functions sequentially.

## TypeScript

To test TypeScript code, compile your `.ts` files and run `xv` on compiled `.js` files.
### With [ts-node](https://typestrong.org/ts-node/)

```sh
npm install ts-node --save-dev
```

```json
{
"scripts": {
"test": "xv --loader=ts-node/esm src"
}
}
```

### With tsc only

Compile your `.ts` files and run `xv` on compiled `.js` files.

For example, assuming your compiled files are in `lib/`, edit `package.json` to run `xv` after `tsc`:

Expand Down Expand Up @@ -110,9 +136,3 @@ exports.testAdd = function() {
## Watch mode

xv doesn't integrate 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.

## Status

The project being very simple by design, there probably won't be frequent updates to the code (_which is a good thing for you, unless you like Dependabot alerts and updating devDependencies_). It will be updated to support latest Node releases and implement potential improvements.

__tl;dr__ xv is maintained and used, even though code updates may not be recent.

0 comments on commit 716f672

Please sign in to comment.