Skip to content

Commit

Permalink
init and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Maslowski committed Apr 28, 2017
1 parent 8fb1011 commit 2c76eba
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
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"
]
}
```
24 changes: 24 additions & 0 deletions package.json
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"
}

0 comments on commit 2c76eba

Please sign in to comment.