lovecraft
v1.0.3
Published
A dark and eldritch test framework, powered by the ancient tomes of [Mocha](https://mochajs.org/), [Chai](https://www.chaijs.com/), [Sinon](https://sinonjs.org/), and [c8](https://github.com/bcoe/c8#readme).
Downloads
334
Readme
Lovecraft Test Framework 🐙
A dark and eldritch test framework, powered by the ancient tomes of Mocha, Chai, Sinon, and c8.
Features 🧠
- Re-exports all functions and assertions from the
chai
module, allowing you to use them directly in your tests. - Re-exports all functions from the
sinon
module, providing powerful mocking and stubbing capabilities. - Exposes a CLI command
lovecraft
that can be used to run your tests, with optional linting and coverage reporting.
Usage 🪄
Import the Lovecraft framework into your project:
import lovecraft from 'lovecraft';
const { expect, stub } = lovecraft;
// Use the imported test utilities in your code
The lovecraft
module provides a default export that can be used to run tests, lint your code, and generate coverage reports. The available command-line options are:
Test 🧪
lovecraft
orlovecraft -t
orlovecraft --test
: Runs all tests found in**/*.test.js
files.
Coverage 📊
lovecraft -c
orlovecraft --coverage
: Runs tests with coverage reporting.
Lint 🧹
lovecraft -l
orlovecraft --lint
: Runs ESLint on your code.
Publish 🚀
lovecraft -p
orlovecraft --publish
: Bumps the version, then tags and publishes the package.
When using the --publish
option, Lovecraft will run all the other checks (test, lint, coverage) first. The package will only be published if all the checks pass successfully. This can be used to prevent the accidental publication of a package with failing tests or linting issues.
All 🔮
lovecraft -a
orlovecraft --all
: Runs tests, generates coverage, and lints the code.
Note that "all" means "all checks" in this context; it does not publish the package. However, lovecraft --all --publish
is a great way to ensure that all checks pass before publishing the package.
Conventions 🕸️
Lovecraft assumes that your test files follow the convention of being named *.test.js
and located alongside the code they are testing. This allows the CLI command to easily find and run the appropriate tests.
The Lovecraft framework also includes a default ESLint configuration file (eslint.config.js
) that can be used to ensure consistent code style and quality.
If you have any other questions or need further assistance, please don't hesitate to reach out to the dark masters of Phantomaton AI. 🐙