Closed diogocezar closed 5 years ago
For me, sounds good ;)
On 21 Nov 2019 17:33 -0300, Nick Gavrilov notifications@github.com, wrote:
@ilearnio requested changes on this pull request. Thanks for contributing! It's was definitely a missing piece of documentation. Just adjusted the description a little. If you think it's good, hit "commit suggestion" and we can merge In README.md:
@@ -143,6 +143,21 @@ module.exports = {
}
+## Usage with Jest + +If you use jest to test your application, you can structure this kind of configuration to run tests: ⬇️ Suggested change -If you use jest to test your application, you can structure this kind of configuration to run tests: +Unfortunately, `module-alias` itself would not work from Jest due to a custom behavior of Jest's `require`. But you can use it's own aliasing mechanism instead. The configuration can be defined either in `package.json` or `jest.config.js`. The example below is for `package.json`: In README.md: > @@ -143,6 +143,21 @@ module.exports = { }
+## Usage with Jest
+
+If you use jest to test your application, you can structure this kind of configuration to run tests:
+
+```js
+"jest": {
"moduleNameMapper": {
"@root/(.*)": "
/$1", "@client/(.*)": "
/src/client/$1" },
+}
+```
+
+Just put it on
package.json
or in youtjest.config.js
⬇️ Suggested change -Just put it on
package.json
or in youtjest.config.js
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Thank you! Merging it
Just inserted new section explaining how we can use this package with Jest.