forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
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
jeffmo
committed
May 14, 2014
0 parents
commit 88a94d5
Showing
110 changed files
with
14,036 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,17 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
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,9 @@ | ||
*~ | ||
*.swp | ||
.DS_STORE | ||
.haste_cache_dir | ||
node_modules | ||
npm-debug.log | ||
build | ||
website/core/metadata.js | ||
website/src/jest/docs |
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,77 @@ | ||
{ | ||
"-W093": true, | ||
"asi": false, | ||
"bitwise": true, | ||
"boss": false, | ||
"browser": false, | ||
"camelcase": true, | ||
"couch": false, | ||
"curly": true, | ||
"debug": false, | ||
"devel": true, | ||
"dojo": false, | ||
"eqeqeq": true, | ||
"eqnull": false, | ||
"esnext": true, | ||
"evil": false, | ||
"expr": true, | ||
"forin": false, | ||
"freeze": true, | ||
"funcscope": true, | ||
"gcl": false, | ||
"globalstrict": true, | ||
"immed": false, | ||
"indent": 2, | ||
"iterator": false, | ||
"jquery": false, | ||
"lastsemic": false, | ||
"latedef": false, | ||
"laxbreak": true, | ||
"laxcomma": false, | ||
"loopfunc": false, | ||
"maxcomplexity": false, | ||
"maxdepth": false, | ||
"maxerr": 50, | ||
"maxlen": 80, | ||
"maxparams": false, | ||
"maxstatements": false, | ||
"mootools": false, | ||
"moz": false, | ||
"multistr": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"node": true, | ||
"noempty": true, | ||
"nonbsp": true, | ||
"nonew": true, | ||
"nonstandard": false, | ||
"notypeof": false, | ||
"noyield": false, | ||
"phantom": false, | ||
"plusplus": false, | ||
"predef": [ | ||
"describe", | ||
"beforeEach", | ||
"it", | ||
"jest", | ||
"pit", | ||
"expect" | ||
], | ||
"proto": false, | ||
"prototypejs": false, | ||
"quotmark": true, | ||
"rhino": false, | ||
"scripturl": false, | ||
"shadow": false, | ||
"smarttabs": false, | ||
"strict": true, | ||
"sub": false, | ||
"supernew": false, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
"validthis": false, | ||
"worker": false, | ||
"wsh": false, | ||
"yui": false | ||
} |
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,3 @@ | ||
examples | ||
website | ||
docs |
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,13 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.8' | ||
notifications: | ||
irc: | ||
use_notice: true | ||
skip_join: true | ||
on_success: change | ||
on_failure: change | ||
channels: | ||
- chat.freenode.net#jestjs |
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,63 @@ | ||
# Contributing to Jest | ||
|
||
Jest is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on facebook.com. We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and preempts some questions you may have. | ||
|
||
## Our Development Process | ||
|
||
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in. | ||
|
||
### `master` is unsafe | ||
|
||
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be. | ||
|
||
### Pull Requests | ||
|
||
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process. | ||
|
||
*Before* submitting a pull request, please make sure the following is done… | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests! | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes (`npm test`). | ||
5. If you haven't already, complete the CLA. | ||
|
||
### Contributor License Agreement ("CLA") | ||
|
||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Bugs | ||
|
||
### Where to Find Known Issues | ||
|
||
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist. | ||
|
||
### Reporting New Issues | ||
|
||
The best way to get your bug fixed is to provide a reduced test case. jsFiddle, jsBin, and other sites provide a way to give live examples. | ||
|
||
### Security Bugs | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues and go through the process outlined on that page. | ||
|
||
## How to Get in Touch | ||
|
||
* IRC - [#jestjs on freenode](http://webchat.freenode.net/?channels=jestjs) | ||
* Mailing list - [jestjs on Google Groups](http://groups.google.com/group/jestjs) | ||
|
||
## Coding Style | ||
|
||
* Use semicolons; | ||
* Commas last, | ||
* 2 spaces for indentation (no tabs) | ||
* Prefer `'` over `"` | ||
* `'use strict';` | ||
* 80 character line length | ||
* "Attractive" | ||
* Do not use the optional parameters of `setTimeout` and `setInterval` | ||
|
||
## License | ||
|
||
By contributing to Jest, you agree that your contributions will be licensed under its BSD license. |
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 @@ | ||
BSD License | ||
|
||
For Jest software | ||
|
||
Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name Facebook nor the names of its contributors may be used to | ||
endorse or promote products derived from this software without specific | ||
prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,23 @@ | ||
Additional Grant of Patent Rights | ||
|
||
"Software" means the Jest software distributed by Facebook, Inc. | ||
|
||
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive, | ||
irrevocable (subject to the termination provision below) license under any | ||
rights in any patent claims owned by Facebook, to make, have made, use, sell, | ||
offer to sell, import, and otherwise transfer the Software. For avoidance of | ||
doubt, no license is granted under Facebook’s rights in any patent claims that | ||
are infringed by (i) modifications to the Software made by you or a third party, | ||
or (ii) the Software in combination with any software or other technology | ||
provided by you or a third party. | ||
|
||
The license granted hereunder will terminate, automatically and without notice, | ||
for anyone that makes any claim (including by filing any lawsuit, assertion or | ||
other action) alleging (a) direct, indirect, or contributory infringement or | ||
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or | ||
affiliates, whether or not such claim is related to the Software, (ii) by any | ||
party if such claim arises in whole or in part from any software, product or | ||
service of Facebook or any of its subsidiaries or affiliates, whether or not | ||
such claim is related to the Software, or (iii) by any party relating to the | ||
Software; or (b) that any right in any patent claim of Facebook is invalid or | ||
unenforceable. |
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,90 @@ | ||
# [Jest](http://facebook.github.io/jest/) | ||
|
||
Painless JavaScript Unit Testing | ||
|
||
- **Familiar Approach**: Built on top of Jasmine test framework, a familiar BDD testing environment | ||
|
||
- **Mock by Default**: Automatically mocks CommonJS modules returned by require(), making most existing code testable | ||
|
||
- **Short Feedback Loop**: Tests run in parallel and DOM apis are mocked so you can run tests on the command line | ||
|
||
## Getting Started | ||
|
||
Check out the [Getting Started](http://facebook.github.io/jest/docs/getting-started.html) tutorial. It's pretty simple! | ||
|
||
## API | ||
|
||
<generated_api_start /> | ||
#### The `jest` object | ||
|
||
- [`jest.autoMockOff()`](http://facebook.github.io/jest/docs/api.html#jest-automockoff) | ||
- [`jest.autoMockOn()`](http://facebook.github.io/jest/docs/api.html#jest-automockon) | ||
- [`jest.clearAllTimers()`](http://facebook.github.io/jest/docs/api.html#jest-clearalltimers) | ||
- [`jest.dontMock(module)`](http://facebook.github.io/jest/docs/api.html#jest-dontmockmodulename) | ||
- [`jest.genMockFromModule(moduleObj)`](http://facebook.github.io/jest/docs/api.html#jest-genmockfrommodule-moduleobj) | ||
- [`jest.genMockFunction()`](http://facebook.github.io/jest/docs/api.html#jest-genmockfunction) | ||
- [`jest.genMockFn()`](http://facebook.github.io/jest/docs/api.html#jest-genmockfn) | ||
- [`jest.mock(moduleName)`](http://facebook.github.io/jest/docs/api.html#jest-mockmodule-name) | ||
- [`jest.runAllTicks()`](http://facebook.github.io/jest/docs/api.html#jest-runallticks) | ||
- [`jest.runAllTimers()`](http://facebook.github.io/jest/docs/api.html#jest-runalltimers) | ||
- [`jest.runOnlyPendingTimers()`](http://facebook.github.io/jest/docs/api.html#jest-runonlypendingtimers) | ||
- [`jest.setMock(moduleName, moduleExports)`](http://facebook.github.io/jest/docs/api.html#jest-setmock-modulename-moduleexports) | ||
|
||
#### Mock functions | ||
|
||
- [`mockFn.mock.calls`](http://facebook.github.io/jest/docs/api.html#mockfn-mock-calls) | ||
- [`mockFn.mock.instances`](http://facebook.github.io/jest/docs/api.html#mockfn-mock-instances) | ||
- [`mockFn.mockClear()`](http://facebook.github.io/jest/docs/api.html#mockfn-mockclear) | ||
- [`mockFn.mockImplementation(fn)`](http://facebook.github.io/jest/docs/api.html#mockfn-mockimplementation-fn) | ||
- [`mockFn.mockImpl(fn)`](http://facebook.github.io/jest/docs/api.html#mockfn-mockimpl-fn) | ||
- [`mockFn.mockReturnThis()`](http://facebook.github.io/jest/docs/api.html#mockfn-mockreturnthis) | ||
- [`mockFn.mockReturnValue(value)`](http://facebook.github.io/jest/docs/api.html#mockfn-mockreturnvalue-value) | ||
- [`mockFn.mockReturnValueOnce(value)`](http://facebook.github.io/jest/docs/api.html#mockfn-mockreturnvalueonce-value) | ||
|
||
#### Config options | ||
|
||
- [`config.collectCoverage` [boolean]](http://facebook.github.io/jest/docs/api.html#config-collectcoverage-boolean) | ||
- [`config.collectCoverageOnlyFrom` [object]](http://facebook.github.io/jest/docs/api.html#config-collectcoverageonlyfrom-object) | ||
- [`config.modulePathIgnorePatterns` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-modulepathignorepatterns-array-string) | ||
- [`config.rootDir` [string]](http://facebook.github.io/jest/docs/api.html#config-rootdir-string) | ||
- [`config.scriptPreprocessor` [string]](http://facebook.github.io/jest/docs/api.html#config-scriptpreprocessor-string) | ||
- [`config.setupEnvScriptFile` [string]](http://facebook.github.io/jest/docs/api.html#config-setupenvscriptfile-string) | ||
- [`config.setupTestFrameworkScriptFile` [string]](http://facebook.github.io/jest/docs/api.html#config-setuptestframeworkscriptfile-string) | ||
- [`config.testFileExtensions` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-testfileextensions-array-string) | ||
- [`config.testPathDirs` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-testpathdirs-array-string) | ||
- [`config.testPathIgnorePatterns` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-testpathignorepatterns-array-string) | ||
- [`config.unmockedModulePathPatterns` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-unmockedmodulepathpatterns-array-string) | ||
|
||
#### Globally injected variables | ||
|
||
- [`jest`](http://facebook.github.io/jest/docs/api.html#the-jest-object) | ||
- `require(module)` | ||
- `require.requireActual(module)` | ||
- `describe(name, fn)` | ||
- `beforeEach(fn)` | ||
- `afterEach(fn)` | ||
- `it(name, fn)` | ||
- `it.only(name, fn)` executes [only](https://github.com/davemo/jasmine-only) this test. Useful when investigating a failure | ||
- `pit(name, fn)` [helper](https://www.npmjs.org/package/jasmine-pit) for promises | ||
|
||
#### `expect(value)` | ||
|
||
- `.not` inverse the next comparison | ||
- `.toThrow(?message)` | ||
- `.toBe(value)` comparison using `===` | ||
- `.toEqual(value)` deep comparison. Use [`jasmine.any(type)`](http://jasmine.github.io/1.3/introduction.html#section-Matching_Anything_with_<code>jasmine.any</code>) to be softer | ||
- `.toBeFalsy()` | ||
- `.toBeTruthy()` | ||
- `.toBeNull()` | ||
- `.toBeUndefined()` | ||
- `.toBeDefined()` | ||
- `.toMatch(regexp)` | ||
- `.toContain(string)` | ||
- `.toBeCloseTo(number, delta)` | ||
- `.toBeGreaterThan(number)` | ||
- `.toBeLessThan(number)` | ||
- `.toBeCalled()` | ||
- `.toBeCalledWith(arg, um, ents)` | ||
- `.lastCalledWith(arg, um, ents)` | ||
|
||
<generated_api_end /> |
Oops, something went wrong.