Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkg0/jest-webpack-resolver
path resolver for jest through the webpack.config. Auto detect webpack's resolve properties like aliases, plugins and more
https://github.com/mkg0/jest-webpack-resolver
enchanging-resolving-behaviours jest-plugin resolver webpack webpack-resolver
Last synced: 18 days ago
JSON representation
path resolver for jest through the webpack.config. Auto detect webpack's resolve properties like aliases, plugins and more
- Host: GitHub
- URL: https://github.com/mkg0/jest-webpack-resolver
- Owner: mkg0
- Created: 2017-04-29T21:05:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-27T14:42:26.000Z (over 6 years ago)
- Last Synced: 2024-11-14T13:28:12.919Z (about 2 months ago)
- Topics: enchanging-resolving-behaviours, jest-plugin, resolver, webpack, webpack-resolver
- Language: JavaScript
- Size: 74.2 KB
- Stars: 44
- Watchers: 2
- Forks: 6
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jest Webpack Resolver Plugin
It is a jest plugin for enchanging jest resolving behaviour to webpack resolver through any webpack config.
## Why?
webpack 2 provides some custom resolving opinions for enchanging resolving behaviours like [directory-named-webpack-plugin](https://github.com/shaketbaby/directory-named-webpack-plugin) and you can't match this kind of resolves with jest's default resolver and this plugins completely changing resolving rules.
With webpack resolving you don't have to worry about these resolving options:
```
resolve.alias
resolve.descriptionFiles
resolve.extensions
resolve.mainFields
resolve.mainFiles
resolve.modules
resolve.plugins
```## Install
> Jest resolver option supported for jest >=20 versions.install with yarn
```
yarn add jest-webpack-resolver -D
```or install with npm
```
npm install jest-webpack-resolver -D
```add to your jest configuration
```
{
"resolver": "jest-webpack-resolver"
}
```## Configuration
By default plugin tries to detect `webpack.config.js`. You can configure it from `package.json` or `jest.config.js` (or any other jest config file)
add `jestWebpackResolver` to your `package.json` file at root level:
```json
{
"name": "",
"version": "",
"jestWebpackResolver": {
"webpackConfig": "./path/to/webpack.config.js"
}
}
```or at your `jest.config.js` or `jest.config.json` file
```js
{
// ...
jestWebpackResolver: {
webpackConfig: './path/to/webpack.config.js'
}
}
```to stop the 'Webpack Resolver using: ./...' message use the silent option
```json
{
"jestWebpackResolver": {
"silent": true,
"webpackConfig": "./path/to/webpack.config.js"
}
}
```