@lg-tools/test
v0.4.10
Published
Jest setup & config for LeafyGreen repositories
Downloads
61
Keywords
Readme
@lg-tools/test
Shared test config & scripts for LeafyGreen repositories.
Usage
It's best not to use this as a standalone package, but use it as part of @lg-tools/cli
instead.
To run tests using the shared config, use the lg
cli:
> lg test
Options
To see all options for this command run:
> lg test --help
Extending & overriding the shared config
To extend/override the shared config (located in @lg-tools/test/config
), create a jest.config.js
file at the root of the repository, and extend the default config with the code below:
// ./jest.config.js
const jestConfig = require('@lg-tools/test/config/js.config.js');
module.exports = {
...jestConfig,
// extend your jest config here
};
You can also pass a --config
option to the test command:
> lg test --config ./path/to/config
Testing in React 17
In CI we test our components using React 17.
To do this manually, first run the init script in order to install the specific testing dependencies needed for React 17. (yarn init17
from the repo root)
> yarn init17
Next, run your tests with the --react17
flag. This ensures that the tests are run with specific Jest config for React 17.
> yarn test --react17
To go back to the default version of React you'll need to clear your packages and re-build:
> yarn clean:modules && yarn run init