1.0.0-beta.0 • Published 4 years ago
karma-jest v1.0.0-beta.0
karma-jest
A Karma framework for using some of Jest's best features in a browser.
Install
npm i karma-jest -D
Or with yarn
yarn add karma-jest -D
Usage
In your karma config:
module.exports = config => {
config.set({
// add your test files
files: ['test/**/*.test.js'],
plugins: ['karma-jest'],
frameworks: ['jest'],
reporters: ['jest'],
// Add options
jest: {
snapshotPath: 'test/__snapshots__',
},
});
};
Options
At the momement there is only one option:
snapshotPath
: the directory snapshots are saved in, defaults to:path.join(karmaConfig.basePath, '__snapshots__')
Differences from Jest
Because a browser is very different environment from Node, there are a few
key differences with how karma-jest
works compared to Jest.
- Compiling and bundling test files is up to you. Use which ever karam preprocessor
is appropriate for your project, probably
karma-webpack
orkarma-preprocessor-rollup
. - Test's are organized by top level describe blocks instead of test files.
this means
.only
tests apply to the entire test suite, and snapshots are located in a single directory organized by suite name, instead of file name. - module mocking does not work! You can use something specific to your preprocessor if you need.
1.0.0-beta.18
4 years ago
1.0.0-beta.17
4 years ago
1.0.0-beta.16
4 years ago
1.0.0-beta.15
4 years ago
1.0.0-beta.14
4 years ago
1.0.0-beta.13
4 years ago
1.0.0-beta.12
4 years ago
1.0.0-beta.11
4 years ago
1.0.0-beta.10
4 years ago
1.0.0-beta.9
4 years ago
1.0.0-beta.8
4 years ago
1.0.0-beta.7
4 years ago
1.0.0-beta.6
4 years ago
1.0.0-beta.5
4 years ago
1.0.0-beta.4
4 years ago
1.0.0-beta.3
5 years ago
1.0.0-beta.2
5 years ago
1.0.0-beta.1
5 years ago
1.0.0-beta.0
5 years ago