-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Maslowski
committed
Apr 28, 2017
1 parent
8fb1011
commit 2c76eba
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## About | ||
Testing Meteor code is very slow when using the built-in `meteor test` command. | ||
These stubs will help you get rid of the dependencies which are not present in | ||
your project's `node_modules` directory. Use the setup below which does most of | ||
the actual magic. :) | ||
|
||
## Installation | ||
`npm i -D jest-meteor-stubs` or `yarn add -D jest-meteor-stubs` | ||
|
||
## How it works | ||
Jest preprocesses the files to be executed through the test runner. When pulling | ||
in dependencies, i.e. using `require` (in ES6 `import`), similar to the default | ||
behavior of Node.js, the resolver will look for them in a local directory named | ||
`node_modules`. However, Meteor injects additional modules when running `meteor` | ||
instead of plain Node.js, which do not reside in this directory. Jest allows you | ||
to overcome this issue by providing additional locations where the load should | ||
look for modules. | ||
|
||
## Usage | ||
Add this module's `lib/` directory to the `modulePaths` in the `jest` section of | ||
your `package.json` file. Here is a short example: | ||
|
||
```json | ||
"jest": { | ||
"modulePaths": [ | ||
"<rootDir>/node_modules", | ||
"<rootDir>/node_modules/jest-meteor-stubs/lib" | ||
] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "jest-meteor-stubs", | ||
"version": "1.0.0", | ||
"description": "Stubs for using Jest to unit test Meteor modules", | ||
"main": "lib/meteor/meteor.js", | ||
"scripts": { | ||
"test": "jasmine" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/orangecms/jest-meteor-stubs.git" | ||
}, | ||
"keywords": [ | ||
"jest", | ||
"meteor", | ||
"stubs" | ||
], | ||
"author": "Daniel Maslowski", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/orangecms/jest-meteor-stubs/issues" | ||
}, | ||
"homepage": "https://github.com/orangecms/jest-meteor-stubs#readme" | ||
} |