Crates.io | jest_lint |
lib.rs | jest_lint |
version | 0.1.4 |
source | src |
created_at | 2024-04-19 10:15:52.886074 |
updated_at | 2024-11-04 12:43:49.768331 |
description | Lint your Jest unit tests to find problems |
homepage | https://github.com/symless/jest-lint |
repository | https://github.com/symless/jest-lint |
max_upload_size | |
id | 1213485 |
size | 24,908 |
Lint your Jest unit tests to find problems. Built with Rust.
Right now this is a simple tool to check that you have mocked your imports. But if you have an idea for adding a new feature, feel free to suggest
If you want to ignore a region of imports (e.g. if you intentionally don't want to mock them),
you can use a region: //#region not-mocked
(see the samples dir for more context)
First: Install Rust and Cargo
Then, either install the published create (easy) or download from this repo.
cargo install jest_lint
jest_lint --help
To test for mocks in all your files:
jest_lint -m
To test for mocks in files for a specific dir:
jest_lint -d path/to/files
To test for mocks in a single file:
jest_lint -m -f path/to/foobar.test.js
Download this repository.
cd jest_lint
cargo run -- --help
PRs welcome!
If you're using VS Code, you can add a task to .vscode/tasks.json
to run jest_lint
on the current file:
{
"label": "jest_lint",
"type": "shell",
"command": "jest_lint -mf ${file}"
}
Then you can use a keyboard shortcut to check your mocks while you have your .spec.*
or .test.*
file open.