From 2c76eba15f1dc2dc88f05e59888b4b32acbfd60e Mon Sep 17 00:00:00 2001 From: Daniel Maslowski Date: Fri, 28 Apr 2017 09:01:26 +0200 Subject: [PATCH] init and README --- README.md | 30 ++++++++++++++++++++++++++++++ package.json | 24 ++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 README.md create mode 100644 package.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..df40866 --- /dev/null +++ b/README.md @@ -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": [ + "/node_modules", + "/node_modules/jest-meteor-stubs/lib" + ] + } +``` diff --git a/package.json b/package.json new file mode 100644 index 0000000..2f0c55f --- /dev/null +++ b/package.json @@ -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://git@github.com/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" +}