Skip to content

Commit 7edb0fd

Browse files
committed
init from jest-runner-mocha
0 parents  commit 7edb0fd

15 files changed

+3811
-0
lines changed

.babelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"useBuiltIns": true,
7+
"targets": {
8+
"node": "4"
9+
}
10+
}
11+
]
12+
]
13+
}

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
undefined

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/node_modules
2+
build

.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["airbnb-base", "prettier"],
3+
"plugins": ["prettier", "jest"],
4+
"rules": {
5+
"no-underscore-dangle": 0,
6+
"arrow-body-style": 0,
7+
"prettier/prettier": [
8+
"error",
9+
{
10+
"singleQuote": true,
11+
"trailingComma": "all"
12+
}
13+
]
14+
},
15+
"env": {
16+
"jest/globals": true
17+
}
18+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
projects
3+
yarn-error.log
4+
build
5+
coverage

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "8"
4+
- "6"
5+
- "4"

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.rulers": [80],
3+
"files.exclude": {
4+
"**/.git": true,
5+
"**/node_modules": true,
6+
"**/build": true
7+
},
8+
"prettier.parser": "flow",
9+
"prettier.printWidth": 80,
10+
"prettier.singleQuote": true,
11+
"prettier.trailingComma": "all",
12+
"prettier.semi": true,
13+
"editor.formatOnSave": true,
14+
"prettier.eslintIntegration": true
15+
}

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
### Setup up your dev environment
2+
3+
1. Fork the repo and create your branch from `master`.
4+
A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/
5+
6+
Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type:
7+
```sh
8+
git clone https://github.com/<your_username>/jest-runner-utils
9+
cd jest
10+
git checkout -b my_branch
11+
```
12+
Note:
13+
Replace `<your_username>` with your GitHub username
14+
15+
2. jest-runner-utils uses [Yarn](https://code.facebook.com/posts/1840075619545360)
16+
for running development scripts. If you haven't already done so,
17+
please [install yarn](https://yarnpkg.com/en/docs/install).
18+
19+
3. Run `yarn`.
20+
21+
```sh
22+
yarn
23+
```
24+
25+
5. If you've changed APIs, update the documentation.
26+
27+
6. Ensure the test suite passes via `yarn test`. To run the test suite you
28+
29+
```sh
30+
yarn test
31+
```

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG NODE_VERSION=8
2+
FROM node:${NODE_VERSION}
3+
4+
WORKDIR /app
5+
6+
COPY package.json yarn.lock /app/
7+
8+
RUN yarn --ignore-scripts
9+
10+
COPY . .
11+
12+
RUN yarn build
13+
14+
CMD ["yarn", "test"]

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# jest-runner-mocha
2+
3+
[![Build Status](https://travis-ci.org/rogeliog/jest-runner-mocha.svg?branch=master)](https://travis-ci.org/rogeliog/jest-runner-mocha) [![npm version](https://badge.fury.io/js/jest-runner-mocha.svg)](https://badge.fury.io/js/jest-runner-mocha)
4+
5+
An experimental Mocha runner for Jest
6+
7+
This makes it easy to integrate existing Mocha projects with Jest.
8+
9+
![runner](https://user-images.githubusercontent.com/574806/30088955-728bf97e-925e-11e7-9b25-6aac237085ca.gif)
10+
11+
12+
## Usage
13+
14+
### Install
15+
16+
Install `jest`_(it needs Jest 21+)_ and `jest-runner-mocha`
17+
18+
```bash
19+
yarn add --dev jest jest-runner-mocha
20+
21+
# or with NPM
22+
23+
npm install --save-dev jest jest-runner-mocha
24+
25+
```
26+
27+
### Add it to your Jest config
28+
29+
In your `package.json`
30+
```json
31+
{
32+
"jest": {
33+
"runner": "jest-runner-mocha"
34+
}
35+
}
36+
```
37+
38+
Or in `jest.config.js`
39+
```js
40+
module.exports = {
41+
runner: 'jest-runner-mocha',
42+
}
43+
```
44+
45+
### Run Jest
46+
```bash
47+
yarn jest
48+
```
49+
50+
### Coverage
51+
52+
Coverage works outside of the box, simply `yarn jest -- --coverage`
53+
54+
You can also use other Jest options like [coveragePathIgnorePatterns](http://facebook.github.io/jest/docs/en/configuration.html#coveragepathignorepatterns-array-string) and [coverageReporters](http://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string)
55+
56+
## Custom config options
57+
58+
Create a `jest-runner-mocha.config.js` at the `<rootDir>` or your Jest project.
59+
60+
- `ui`: (Optional) the UI used by mocha
61+
```js
62+
// example
63+
module.exports = {
64+
ui: 'tdd',
65+
}
66+
```
67+
68+
- `compiler`: (Optional) the used for adding a compile step to your mocha tests
69+
70+
```js
71+
// example
72+
module.exports = {
73+
compiler: '/absolute/path/to/babel-register/or/other/compiler',
74+
}
75+
```
76+
77+
_NOTE: Eventually Jest will eventually have an option for configuring runners that will eliminate the need for `jest-runner-mocha.config.js`_
78+
79+
80+
## Known issues
81+
- It does not support any Mocha options except for `ui` and `compiler`
82+
- Support for compilers is very limited.
83+
- Does not support `jest --runInBand`

0 commit comments

Comments
 (0)