Skip to content

Commit 3190b21

Browse files
committed
Replace jest with vitest
1 parent 31ef8f7 commit 3190b21

File tree

7 files changed

+2943
-6561
lines changed

7 files changed

+2943
-6561
lines changed

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,36 @@ In your `package.json` you can use the scripts:
3131
}
3232
```
3333

34-
You will also need to install `typescript` for building and `@jest/globals` for testing.
34+
You will also need to install `typescript` for building and `vitest` for testing.
3535

3636
### Batteries Included
3737

38-
- `install` - Installs `husky` and `lint-staged`
39-
- `lint` - Uses `eslint --fix`
40-
- `format` - Uses `prettier --write`
41-
- `specs` - Uses `jest`
38+
- `install` - Installs `husky` and `lint-staged` for git commit hooks
39+
- `lint` - Uses `eslint --fix` on all supported files in `src` (i.e. `js`, `jsx`, `ts`, `tsx`)
40+
- `format` - Uses `prettier --write` on all supported files in `src` and the root directory
41+
- `specs` - Uses `vitest` to run test files match `*.{test,spec}.*` files
42+
- `--watch <index>` Runs vitest in watch mode on the config at `<index>`
43+
- `--update` Updates the snapshot files
44+
- `--changed` Runs tests on only changed files
45+
- `--since <commit>` Runs tests on files changed since `<commit>`
46+
- `--test-pattern` Runs tests matching the specified pattern
4247
- `build` - Uses `rimraf` and `tsc`
43-
- `check` - Uses `eslint` and `prettier --check`
48+
- `check` - Uses `eslint`, `prettier --check`, and `tsc` on each test "project"
4449
- `test` - Runs `check`, `specs`, and `build`
4550

4651
### Configuration
4752

4853
Configuration can get specified in your `package.json` file under `ts-scripts`:
4954

50-
- `src` - An array of source directories to read (default: `["src"]`)
51-
- `dist` - An array of output directories to clean, i.e. `outDir` in `tsconfig.json` (default: `["dist"]`)
52-
- `project` An array of `tsconfig.json` project files for TypeScript (default: `["tsconfig.json"]`)
55+
- `src` - An array of source directories used for `format` and `lint` (default: `["src"]`)
56+
- `dist` - An array of output directories to clean before `build` (default: `["dist"]`)
57+
- `project` An array of `tsconfig.json` project files to build using TypeScript (default: `["tsconfig.json"]`)
5358
- `test` An array of test configuration objects (default: `[{}]`)
54-
- `name` The name of this test configuration (default: `undefined`)
55-
- `dir` An array of directories to read tests from (default: `src`)
56-
- `env` The environment to use for these tests (default: `"node"`)
57-
- `project` The `tsconfig.json` project file to use for this test (default: `"tsconfig.json"`)
59+
- `dir` The directory to read tests from (default: `undefined`, root directory)
60+
- `config` The configuration file to use for this test (default: `undefined`, discovered by `vitest`)
61+
- `project` The `tsconfig.json` project file to use for type checking (default: `"tsconfig.json"`)
62+
63+
Specific configuration can be disabled for customized configuration by setting `src`, `dist`, `project`, or `test` to an empty array.
5864

5965
## License
6066

configs/esbuild-jest.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

configs/jest.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)