diff --git a/.editorconfig b/.editorconfig index e3a4859eeb..e09b844f73 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,9 +10,3 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 - -[Makefile] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000000..934e19bb89 --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,44 @@ +'use strict'; + +module.exports = function(eleventyConfig) { + eleventyConfig.addPassthroughCopy('docs/css'); + eleventyConfig.addPassthroughCopy('docs/js'); + eleventyConfig.addPassthroughCopy('docs/images'); + eleventyConfig.addPassthroughCopy('docs/CNAME'); + eleventyConfig.addPassthroughCopy('docs/_headers'); + eleventyConfig.addPassthroughCopy('docs/favicon.ico'); + + eleventyConfig.addPassthroughCopy('docs/example'); + + /* Markdown Plugins */ + const markdown = require('markdown-it')({ + html: true, + linkify: true + }); + + markdown.use(require('markdown-it-anchor'), { + slugify: require('uslug'), + permalink: true, + permalinkBefore: true, + permalinkClass: 'direct-link', + permalinkSymbol: '#' + }); + + markdown.use(require('markdown-it-attrs'), { + leftDelimiter: '{:', + rightDelimiter: '}' + }); + + markdown.use(require('markdown-it-prism')); + + eleventyConfig.setLibrary('md', markdown); + + return { + passthroughFileCopy: true, + dir: { + input: 'docs', + includes: '_includes', + output: 'docs/_site' + } + }; +}; diff --git a/.eslintignore b/.eslintignore index 1ce4437ab5..d9a508ec53 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,8 @@ coverage/ -lib/to-iso-string/**/*.js mocha.js -BUILDTMP +*.fixture.js +docs/ +out/ +!lib/mocha.js +test/integration/fixtures +!.*.js diff --git a/.eslintrc.yaml b/.eslintrc.yaml deleted file mode 100644 index d5673232e7..0000000000 --- a/.eslintrc.yaml +++ /dev/null @@ -1,15 +0,0 @@ -root: true -env: - node: true - browser: true -parserOptions: - ecmaVersion: 5 - sourceType: script -extends: semistandard -rules: - strict: - - error - - safe - linebreak-style: - - error - - unix diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000000..a668139868 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,90 @@ +root: true +extends: + - semistandard + - plugin:prettier/recommended +env: + node: yes + browser: yes +parserOptions: + ecmaVersion: 5 + ecmaFeatures: + globalReturn: no + jsx: no + sourceType: script +rules: + strict: + - error + - safe +overrides: + - files: + - scripts/**/*.js + - package-scripts.js + - karma.conf.js + - .wallaby.js + - .eleventy.js + - bin/* + - lib/cli/**/*.js + - test/node-unit/**/*.js + - test/integration/options/watch.spec.js + - test/integration/helpers.js + - lib/growl.js + parserOptions: + ecmaVersion: 6 + env: + browser: no + + - files: + - test/**/*.{js,mjs} + env: + mocha: yes + globals: + expect: no + - files: + - bin/* + - lib/**/*.js + rules: + no-restricted-globals: + - error + - name: setTimeout + message: &GH-237 See https://github.com/mochajs/mocha/issues/237 + - name: clearTimeout + message: *GH-237 + - name: setInterval + message: *GH-237 + - name: clearInterval + message: *GH-237 + - name: setImmediate + message: *GH-237 + - name: clearImmediate + message: *GH-237 + - name: Date + message: *GH-237 + no-restricted-modules: + - error + - timers + no-restricted-syntax: + - error + # disallow `global.setTimeout()`, `global.setInterval()`, etc. + - selector: 'CallExpression[callee.object.name=global][callee.property.name=/(set|clear)(Timeout|Immediate|Interval)/]' + message: *GH-237 + # disallow `new global.Date()` + - selector: 'NewExpression[callee.object.name=global][callee.property.name=Date]' + message: *GH-237 + # disallow property access of `global..*` + - selector: '*[object.object.name=global][object.property.name=/(Date|(set|clear)(Timeout|Immediate|Interval))/]:expression' + message: *GH-237 + + - files: + - test/**/*.mjs + parserOptions: + ecmaVersion: 6 + sourceType: module + + - files: + - lib/reporters/*.js + rules: + no-restricted-syntax: + - error + # disallow Reporters using `console.log()` + - selector: 'CallExpression[callee.object.name=console][callee.property.name=log]' + message: &GH-3604 See https://github.com/mochajs/mocha/issues/3604 diff --git a/.fossaignore b/.fossaignore new file mode 100644 index 0000000000..db585bd78d --- /dev/null +++ b/.fossaignore @@ -0,0 +1,2 @@ +CONTRIBUTING.md +MAINTAINERS.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..6313b56c57 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 4e63d0ac3d..06fc2b30ed 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -1,6 +1,7 @@ # Mocha Code of Conduct ## Be friendly and patient + We understand that everyone has different levels of experience or knowledge in many diverse fields, be it technical or non-technical in nature. We also have areas of knowledge we are eager to expand; we want to be a community where people can not only contribute, but feel comfortable to ask questions as well and learn along the way. If someone says something @@ -8,36 +9,41 @@ wrong, or says something accidentally offensive, respond with patience and try t we all were newbies at one point. ## Be welcoming + We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to, members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability. ## Be considerate + Your work will be used by other people, and you in turn will depend on the work of others. Any decision you make will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we’re a world-wide community, so you might not be communicating in someone else’s primary language. ## Be respectful + Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the JS Foundation community should be respectful when dealing with other members as well as with people outside the JS Foundation community. ## Be careful in the words that you choose + We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren’t acceptable. This includes, but is not limited to: -* Violent threats or language directed against another person. -* Discriminatory jokes and language. -* Posting sexually explicit or violent material. -* Posting (or threatening to post) other people’s personally identifying information (“doxing”). -* Personal insults, especially those using racist or sexist terms. -* Unwelcome sexual attention. -* Advocating for, or encouraging, any of the above behavior. -* Repeated harassment of others. In general, if someone asks you to stop, then stop. +- Violent threats or language directed against another person. +- Discriminatory jokes and language. +- Posting sexually explicit or violent material. +- Posting (or threatening to post) other people’s personally identifying information (“doxing”). +- Personal insults, especially those using racist or sexist terms. +- Unwelcome sexual attention. +- Advocating for, or encouraging, any of the above behavior. +- Repeated harassment of others. In general, if someone asks you to stop, then stop. ## When we disagree, try to understand why + Disagreements, both social and technical, happen all the time and JS Foundation projects are no exception. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of the JS Foundation comes from its varied community, people from a wide range of backgrounds. Different people have different @@ -48,4 +54,41 @@ and learning from mistakes. Original text courtesy of the Speak Up! project and Django Project. ## QUESTIONS? -If you have questions, please see the FAQ. If that doesn’t answer your questions, feel free to email conduct@js.foundation. + +If you have questions, please see the FAQ. If that doesn’t answer your questions, feel free to email report@lists.openjsf.org. + +# OpenJS Foundation Code of Conduct + +The OpenJS Foundation and its member projects use the Contributor +Covenant v1.4.1 as its Code of Conduct. Refer to the following +for the full text: + +- [english](https://www.contributor-covenant.org/version/1/4/code-of-conduct) +- [translations](https://www.contributor-covenant.org/translations) + +Refer to the section on reporting and escalation in this document for the specific emails that can be used to report and escalate issues. + +## Reporting + +### Project Spaces + +For reporting issues in spaces related to a member project please use the email provided by the project for reporting. Projects handle CoC issues related to the spaces that they maintain. Projects maintainers commit to: + +- maintain the confidentiality with regard to the reporter of an incident +- to participate in the path for escalation as outlined in + the section on Escalation when required. + +### Foundation Spaces + +For reporting issues in spaces managed by the OpenJS Foundation, for example, repositories within the OpenJS organization, use the email `report@lists.openjsf.org`. The Cross Project Council (CPC) is responsible for managing these reports and commits to: + +- maintain the confidentiality with regard to the reporter of an incident +- to participate in the path for escalation as outlined in + the section on Escalation when required. + +## Escalation + +The OpenJS Foundation maintains a Code of Conduct Panel (CoCP). This is a foundation-wide team established to manage escalation when a reporter believes that a report to a member project or the CPC has not been properly handled. In order to escalate to the CoCP send an email to `"coc-escalation@lists.openjsf.org`. + +For more information, refer to the full +[Code of Conduct governance document](https://github.com/openjs-foundation/bootstrap/blob/master/proposals/stage-1/CODE_OF_CONDUCT/FOUNDATION_CODE_OF_CONDUCT_REQUIREMENTS.md). diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b36ef88c3c..027a7f9647 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -8,77 +8,90 @@ If you have a question about using Mocha, please use the [mailing list](https:// ## :bug: I Found a Bug -Sorry! It happens to the best of us. If you've found a bug in Mocha, **please [search](https://github.com/mochajs/mocha/issues/) to see if it's already been reported**. Otherwise, create a [new issue](https://github.com/mochajs/mocha/issues/new). If you can fix the bug yourself, feel free to create a [pull request](#propose-a-change) thereafter. +Sorry! It happens to the best of us. If you've found a bug in Mocha, **please [search](https://github.com/mochajs/mocha/issues/) to see if it's already been reported**. Otherwise, create a [new issue](https://github.com/mochajs/mocha/issues/new). If you can fix the bug yourself, feel free to create a [pull request](#propose-a-change) thereafter. -Please include *as much detail as possible* to help us reproduce and diagnose the bug. Most importantly: +Please include _as much detail as possible_ to help us reproduce and diagnose the bug. Most importantly: -- Let us know *how* you're running Mocha (options, flags, environment, browser or Node.js, etc.) -- Include your test code or file(s). If large, please provide a link to a repository or [gist](https://gist.github.com). +- Let us know _how_ you're running Mocha (options, flags, environment, browser or Node.js, etc.) +- Include your test code or file(s). If large, please provide a link to a repository or [gist](https://gist.github.com). - Please show code in JavaScript only (any version) -If we need more information from you, we'll let you know. If you don't within a reasonable time frame (TBD), your issue will be automatically closed for inactivity. +If we need more information from you, we'll let you know. If you don't within a reasonable time frame (TBD), your issue will be automatically closed for inactivity. ## :exclamation: Propose a Change -Before you get your hands dirty, please [search](https://github.com/mochajs/mocha/issues/) for a related issue, or [create a new one](https://github.com/mochajs/mocha/issues/new). If you wish to contribute a new feature, this is doubly important! Let's discuss your proposed changes first; we don't want you to waste time implementing a change that is at odds with the project's direction. That said, we'll happily consider any contribution, no matter how great or small. +Before you get your hands dirty, please [search](https://github.com/mochajs/mocha/issues/) for a related issue, or [create a new one](https://github.com/mochajs/mocha/issues/new). If you wish to contribute a new feature, this is doubly important! Let's discuss your proposed changes first; we don't want you to waste time implementing a change that is at odds with the project's direction. That said, we'll happily consider any contribution, no matter how great or small. -*This paragraph would contain information about Mocha's roadmap, but it doesn't yet exist.* :poop: +_This paragraph would contain information about Mocha's roadmap, but it doesn't yet exist._ :poop: It's also important to understand some overarching goals of Mocha, detailed below. ### :soccer: About Project Goals -Mocha is a test framework. Developers use it against anything from legacy spaghetti in IE7 to stage-0 TC39 features in Electron. While still staying current, Mocha will only drop support for old platforms as a last resort. If and only if Mocha cannot move forward as a project, support will be dropped. If workarounds exist, they are preferred. +Mocha is a test framework. Developers use it against anything from legacy spaghetti in IE11 to stage-0 TC39 features in Electron. Mocha is committed to providing support for maintained (LTS) versions of Node.js and popular browsers (of which IE11 is still one, as of December 2018). -Mocha adheres strictly to [semantic versioning](https://semver.org). We are *extremely cautious* with changes that have the potential to break; given the size of Mocha's user base, it's *highly unlikely* a breaking change will slide by. +Mocha adheres strictly to [semantic versioning](https://semver.org). We are _extremely cautious_ with changes that have the potential to break; given the size of Mocha's user base, it's _highly unlikely_ a breaking change will slide by. -Mocha's usage far outweighs its resources. If a proposed feature would incur a maintenance penalty, it could be a hard sell. +Mocha's usage far outweighs its resources. If a proposed feature would incur a maintenance penalty, it could be a hard sell. We ask you please keep these goals in mind when making or proposing changes. ### :shoe: Contributing Code: Step-by-Step -Follow these steps to get going. If you are having trouble, don't be afraid to [ask for help](#got-a-question). - -1. [Install Node.js 4.x or newer](https://nodejs.org/download). -1. Install [GNU Make](https://www.gnu.org/software/make/) or equivalent. -1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo/) on setting up Git, forking and cloning. -1. Create a new branch in your working copy. Give your branch a descriptive name, such as `issue/12345`: `git checkout -b issue/12345`. -1. Execute `npm install` to install the development dependencies. -1. Make your changes and add them via `git add`. - - **Do not modify** the root `mocha.js` file directly; it is automatically generated. - - Your changes will likely be somewhere in `lib/`, `bin/` or `browser-entry.js` if your changes are browser-specific. - - Please add unit and/or integration tests (depending on the nature of your changes). - - Keep your PR focused. Don't fix two things at once, or make formatting changes alongside bug fixes. -1. Before committing, run `npm test`. - - This will run unit tests, Node.js and browser integration tests, and lint the source code. - - The "browser" tests use Mocha to test itself; it will rebuild the root `mocha.js` file with your changes. - - **Please avoid committing changes to `mocha.js`**. - - Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha)). The first step to ensuring these checks pass is to test on your own machine. -1. Commit your changes. - - Use a brief message on the first line, referencing a relevant issue (e.g. `#12345`). - - Add detail in subsequent lines. -1. Push your changes to your fork. -1. Navigate to the source repository. You should see a notification about your recent changes in your fork's branch, with a button to create a pull request. Click it. -1. Describe your changes in detail here. Once you're satisfied, submit the form. - - *PRO TIP*: If you've used a multi-line commit message, Github will pre-fill the PR's description with it. -1. If you have not signed our Contributor License Agreement, a friendly robot will prompt you to do so. A CLA (electronic) signature is **required** for all contributions of code to Mocha. -1. CI will run against your changes. - - If the changes fail the checks, you will need to address those before merging. - - You don't need to make a new PR to make changes. Instead, commit on top of your changes, and push these to your fork's branch. The PR will be updated, and CI will re-run. - - Github will indicate if there's a conflict. If this happens, you will need to [rebase](https://help.github.com/articles/about-git-rebase/) your branch onto the `master` branch of the source repository. *Don't merge.* - - It's no longer necessary to "squash" your changes. -1. Be patient while your PR is reviewed. This can take awhile ([why?](https://github.com/orgs/mochajs/projects/4)). We may request changes; don't be afraid to question them. +Follow these steps to get going. If you are having trouble, don't be afraid to [ask for help](#got-a-question). + +> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start ` (powered by [nps](https://npm.im/nps)). + +1. [Install Node.js 8.x or newer](https://nodejs.org/en/download/). + - If you're new to installing Node, a tool like [nvm](https://github.com/creationix/nvm#install-script) can help you manage multiple version installations. + - You will need [Google Chrome](https://www.google.com/chrome/) to run browser-based tests locally. +1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo/) on setting up Git, forking and cloning. +1. Create a new branch in your working copy. Give your branch a descriptive name, such as `issue/12345`: `git checkout -b issue/12345`. +1. Execute `npm install` to install the development dependencies. + - Do not use `yarn install`. + - Some optional dependencies may fail; you can safely ignore these unless you are trying to build the documentation. + - If you're sick of seeing the failures, run `npm install --ignore-scripts`. +1. Make your changes and add them via `git add`. + - Your changes will likely be somewhere in `lib/`, `bin/` or `browser-entry.js` (if your changes are browser-specific). + - Unit and/or integration **tests are required** for any code change. These live in `test/`. + - **Do not modify** the root `mocha.js` file directly; it is automatically generated. + - Keep your PR focused. Don't fix two things at once; don't upgrade dependencies unless necessary. +1. Before committing, run `npm start test`. + - This will run both Node.js-based and browser-based tests. + - Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha)). The first step to ensuring these checks pass is to test on your own machine. + - A coverage check will be sent to [Coveralls](https://coveralls.io/github/mochajs/mocha). **A drop in code coverage % is considered a failed check**. +1. Commit your changes. + - Use a brief message on the first line, referencing a relevant issue (e.g. `closes #12345`). + - Add detail in subsequent lines. + - A pre-commit hook will run which automatically formats your staged changes (and fixes any problems it can) with ESLint and Prettier. If ESLint fails to fix an issue, your commit will fail and you will need to manually correct the problem. +1. (Optional) Ensure you are up-to-date with Mocha's `master` branch: + - You can add an "upstream" remote repo using `git remote add upstream https://github.com/mochajs/mocha.git && git fetch upstream`. + - Navigate to your `master` branch using `git checkout master`. + - Pull changes from `upstream` using `git pull upstream master`. + - If any changes were pulled in, rebase your branch onto `master` by switching back to your branch (`git checkout `) then rebasing using `git rebase master`. +1. Push your changes to your fork; `git push origin`. +1. In your browser, navigate to [mochajs/mocha](https://github.com/mochajs/mocha). You should see a notification about your recent changes in your fork's branch, with a (green?) button to create a pull request. Click it. +1. Describe your changes in detail here, following the template. Once you're satisfied, submit the form. +1. If you have not signed our [Contributor License Agreement](https://js.foundation/cla), a friendly robot will prompt you to do so. A [CLA](https://cla.js.foundation/mochajs/mocha) (electronic) signature is **required** for all contributions of code to Mocha. +1. Continuous integration checks will run against your changes. The result of these checks will be displayed on your PR. + - If the checks fail, you must address those before the PR is accepted. + - GitHub will indicate if there's a conflict. If this happens, you will need to [rebase](https://help.github.com/articles/about-git-rebase/) your branch onto the `master` branch of the source repository. **Do not `git merge`**. + - (Optional) [Squash](https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits) your changesets. If you have multiple changesets in your PR, they will be squashed upon PR acceptance by the Mocha team. +1. Be patient while your PR is reviewed. This can take a while. We may request changes, but don't be afraid to question them. +1. Your PR might become conflicted with the code in `master`. If this is the case, you will need to [update your PR](#up-to-date) and resolve your conflicts. +1. You don't need to make a new PR to any needed changes. Instead, commit on top of your changes, and push these to your fork's branch. The PR will be updated, and CI will re-run. + +Join us in the [contributors' chat](https://gitter.im/mochajs/contributors)! ## :angel: I Just Want To Help -*Excellent.* Here's how: +_Excellent._ Here's how: -- **Handy with JavaScript?** Please check out the issues labeled [`pr-please`](https://git.io/vXYu2). -- **Can you write good (and do other stuff good too)?** Help with the documentation. See the [issues for our site](https://github.com/mochajs/mochajs.github.io/issues). -- **Design your thing?** [Our site](https://github.com/mochajs/mochajs.github.io) needs your magic touch. -- **Know Mocha's codebase?** We could use your help triaging issues and/or reviewing pull requests. Please contact an [org member](https://github.com/orgs/mochajs/people), and we'll chat. -- **Want to build our community?** Mocha has a *lot* of users. We could use your help bringing everyone together in peace and harmony. Please contact an [org member](https://github.com/mochajs/people). -- **You can sell dirt to worms?** Let's raise Mocha's profile in the JavaScript and OSS communities. Please contact an [org member](https://github.com/mochajs/people)! -- **Wait--you write unit tests for *fun*?** A PR which increases coverage is unlikely to be turned down. -- **Are you experienced?** If you're a seasoned Mocha user, why not help answer some questions in the [chat room](https://gitter.im/mochajs/mocha)? +- **Handy with JavaScript?** Please check out the issues labeled [`help wanted`](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or [`good-first-issue`](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Agood-first-issue). Try `npx good-first-issue mocha`! +- **Can you write ~~good~~ well?** The [documentation](https://mochajs.org) almost always needs some love. See the [doc-related issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3Adocumentation). +- **Design your thing?** [Our site](https://mochajs.org) needs your magic touch. +- **Familiar with Mocha's codebase?** We could use your help triaging issues and/or reviewing pull requests. Please contact an [org member](https://github.com/orgs/mochajs/people), and we'll chat. +- **Want to build our community?** Mocha has a _lot_ of users. We could use your help bringing everyone together in peace and harmony. Please contact an [org member](https://github.com/mochajs/people). +- **You can sell dirt to worms?** Let's raise Mocha's profile in the JavaScript and OSS communities. Please contact an [org member](https://github.com/orgs/mochajs/people)! +- **Wait--you write unit tests for _fun_?** A PR which increases coverage is unlikely to be turned down. +- **Are you experienced?** :guitar: If you're a seasoned Mocha user, why not help answer some questions in the [main chat room](https://gitter.im/mochajs/mocha)? diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..7491593eb1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,68 @@ +--- +name: Bug report +about: To report a part of mocha not working as expected +title: '' +labels: 'unconfirmed-bug' +--- + + + +### Prerequisites + + + +- [ ] Checked that your issue hasn't already been filed by cross-referencing [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20) +- [ ] Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code. +- [ ] 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself +- [ ] Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: `node node_modules/.bin/mocha --version`(Local) and `mocha --version`(Global). We recommend that you _not_ install Mocha globally. + +### Description + + + +### Steps to Reproduce + + + +**Expected behavior:** [What you expect to happen] + +**Actual behavior:** [What actually happens] + + +**Reproduces how often:** [What percentage of the time does it reproduce?] + +### Versions + + + +- The output of `mocha --version` and `node node_modules/.bin/mocha --version`: +- The output of `node --version`: +- Your operating system + - name and version: + - architecture (32 or 64-bit): +- Your shell (e.g., bash, zsh, PowerShell, cmd): +- Your browser and version (if running browser tests): +- Any third-party Mocha-related modules (and their versions): +- Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): + +### Additional Information + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..8a8343e96f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: Suggest an idea for Mocha +title: '' +labels: 'feature' +--- + +**Is your feature request related to a problem or a nice-to-have?? Please describe.** +A clear and concise description of what the problem is. E.g. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/support-question.md b/.github/ISSUE_TEMPLATE/support-question.md new file mode 100644 index 0000000000..93f367cee5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support-question.md @@ -0,0 +1,15 @@ +--- +name: Support Question +about: If you have a question, please check out our Gitter or StackOverflow! +title: '' +labels: 'question' +--- + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..37271e9cb0 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,40 @@ +### Requirements + +* Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. +* All new code requires tests to ensure against regressions. + +### Description of the Change + + + +### Alternate Designs + + + +### Why should this be in core? + + + +### Benefits + + + +### Possible Drawbacks + + + +### Applicable issues + + diff --git a/.github/stale.yml b/.github/stale.yml index 748e2845f7..152dd7373e 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -4,28 +4,25 @@ daysUntilStale: 120 daysUntilClose: 14 # Issues with these labels will never be considered stale exemptLabels: - - pr-please - - confirmed - - future - - bug - - chore - - feature - - unconfirmed - - usability - - to-merge - browser - - reporter - - feature + - chore + - confirmed-bug + - developer-experience - documentation - - nice-to-have + - faq + - feature + - future + - good-first-issue + - help wanted - needs-review + - nice-to-have - qa - - usability - - semver-minor + - reporter - semver-major + - semver-minor - semver-patch - - reporter - - common-mistake + - unconfirmed-bug + - usability # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable diff --git a/.gitignore b/.gitignore index da8160085d..02634697bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,143 @@ -.DS_Store -node_modules -*.sock -*.sw* -.idea -*.iml -*.patch -*.diff -npm-debug.log* -.envrc +# Mocha-specific +docs/_site +docs/_dist +mocha.js .karma/ +!lib/mocha.js + +######################################### +# NON-MOCHA STUFF GOES BELOW THIS THING # +######################################### + +# Git mergetool +# Use `git config mergetool.keepBackup false` to stop generating these files *.orig -.nyc_output/ -coverage/ -BUILDTMP/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# nyc/istanbul +coverage +.nyc_output + +# Dependencies +node_modules/ + +# npm +.npm +*.tgz + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# dotenv environment variables file +.env +.env.test + +# Yarn yarn.lock -package-lock.json +.yarn-integrity + +# Various temporary files +*~ + +# Emacs +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Vim +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] +Session.vim +[._]*.un~ + +# Diff +*.patch +*.diff + +# VSCode +.vscode/ + +# JetBrains' IDEs +.idea/ +*.iws +out/ +.idea_modules/ +atlassian-ide-plugin.xml + +# SourceTree +*_BACKUP_* +*_BASE_* +*_LOCAL_* +*_REMOTE_* + +# SublimeText +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +sftp-config.json +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +Package Control.merged-ca-bundle +Package Control.user-ca-bundle +oscrypto-ca-bundle.crt +bh_unicode_properties.cache +GitHub.sublime-settings + +# direnv +.envrc + +# Linux +.fuse_hidden* +.directory +.Trash-* +.nfs* + +# Windows +Thumbs.db +ehthumbs.db +ehthumbs_vista.db +*.stackdump +[Dd]esktop.ini +$RECYCLE.BIN/ +*.cab +*.msi +*.msix +*.msm +*.msp +*.lnk + +# macOS +.DS_Store +.AppleDouble +.LSOverride +._* +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# SauceConnect +*.sock diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000000..14dcdd9302 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,10 @@ +{ + "linters": { + "(bin/*|*.js|**/*.js)": ["eslint --fix", "git add"], + "(*.{json,yml,md,html}|**/*.{json,yml,md,html})": [ + "prettier --write", + "git add" + ] + }, + "ignore": ["docs/**/*.js", "test/**/*.fixture.js", "package*.json"] +} diff --git a/.mailmap b/.mailmap index 528a26775e..9200a76f02 100644 --- a/.mailmap +++ b/.mailmap @@ -1,12 +1,30 @@ +# see https://www.git-scm.com/docs/git-check-mailmap for formatting info TJ Holowaychuk -Travis Jeffery -Travis Jeffery Dr. Travis Jeffery -Christopher Hiller Christopher Hiller -David da Silva Contín David da Silva -David da Silva Contín David da Silva -David da Silva Contín -Ariel Mashraki Ariel Mashraki -Ariel Mashraki Ariel Mashraki -Forbes Lindesay Forbes Lindesay -Ben Bradley Ben Bradley <[ben.bradley@cigna.com|mailto:ben.bradley@cigna.com]> -Glen Mailer Glen Mailer +Travis Jeffery +Travis Jeffery Dr. Travis Jeffery +Christopher Hiller +David da Silva Contín David da Silva +David da Silva Contín David da Silva +David da Silva Contín +Ariel Mashraki +Ariel Mashraki +Forbes Lindesay +Ben Bradley <[ben.bradley@cigna.com|mailto:ben.bradley@cigna.com]> +Glen Mailer +38elements <38elements@users.noreply.github.com> +Andreas Lind Petersen Andreas Lind +Ben Harris +Can Oztokmak +Will Langstroth +Sulabh Bista +Rustem Mustafin +Rico Sta. Cruz +Pete Hawkins +Raynos <=> +Raynos Raynos (Jake Verbaten) +Markus Tacker +Long Ho +László Bácsi Laszlo Bacsi +Eli Skeggs +Domenic Denicola domenic +Michael Schoonmaker diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000000..14a5c306e6 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,10 @@ +{ + "no-inline-html": false, + "line-length": false, + "no-trailing-punctuation": false, + "no-duplicate-header": false, + "first-header-h1": false, + "first-line-h1": false, + "commands-show-output": false, + "single-h1": false +} diff --git a/.mocharc.yml b/.mocharc.yml new file mode 100644 index 0000000000..fc4c97339c --- /dev/null +++ b/.mocharc.yml @@ -0,0 +1,7 @@ +require: test/setup +ui: bdd +global: + - okGlobalA,okGlobalB + - okGlobalC + - callback* +timeout: 300 diff --git a/.npmignore b/.npmignore deleted file mode 100644 index e3216decb2..0000000000 --- a/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -assets/ - diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b15cbc2c02..0000000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -package-lock=false - diff --git a/.travis.yml b/.travis.yml index d5c75c269a..5fb2bdb701 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,88 +1,94 @@ -sudo: false +### +### .travis.yml +### -# trust dist provides a modern build chain (as opposed to 'precise' dist) -# which absolves us from having to install compilers and stuff -dist: trusty +# these are executed in order. each must pass for the next to be run +stages: + - smoke # this ensures a "user" install works properly + - precache # warm up cache for default Node.js version + - lint # lint code and docs + - test # all tests +# defaults language: node_js +node_js: '12' +addons: + apt: + packages: + # Growl + - libnotify-bin +# `nvm install` happens before the cache is restored, which means +# we must install our own npm elsewhere (`~/npm`) +before_install: | + [[ ! -x ~/npm/node_modules/.bin/npm ]] && { + # caching feature creates `~/npm` for us + cd ~/npm && npm install npm + cd - + } || true + # avoids bugs around https://github.com/travis-ci/travis-ci/issues/5092 + export PATH=~/npm/node_modules/.bin:$PATH +# this avoids compilation in most cases (where we don't need it) +install: npm ci --ignore-scripts +cache: + directories: + - ~/.npm # cache npm's cache + - ~/npm # cache latest npm -env: - global: - # phantomjs hosts binaries @ bitbucket, which has fairly restrictive - # rate-limiting. pull it from this sketchy site in China instead. - - PHANTOMJS_CDNURL='https://cnpmjs.org/downloads' - -matrix: - fast_finish: true +jobs: include: - - node_js: '8' - env: TARGET=test-node COVERAGE=true - - node_js: '7' - env: TARGET=test-node - - node_js: '6' - env: TARGET=test-node - - node_js: '5' - env: TARGET=test-node - - node_js: '4' - env: TARGET=test-node - - node_js: 'iojs' - env: TARGET=test-node - - node_js: '0.12' - env: TARGET=test-node - - node_js: '0.11' - env: TARGET=test-node - - node_js: '0.10' - env: TARGET=test-node - - node_js: '8' - env: TARGET=lint - # phantomjs - - node_js: '8' - env: TARGET=test-browser - # chrome - - node_js: '8' - env: TARGET=test-browser BROWSER="chrome@latest" PLATFORM="Windows 8" - # edge - - node_js: '8' - env: TARGET=test-browser BROWSER="MicrosoftEdge@latest" PLATFORM="Windows 10" - # ie11 - - node_js: '8' - env: TARGET=test-browser BROWSER="internet explorer@11.0" PLATFORM="Windows 8.1" - # ie10 - - node_js: '8' - env: TARGET=test-browser BROWSER="internet explorer@10.0" PLATFORM="Windows 8" - # ie9 - - node_js: '8' - env: TARGET=test-browser BROWSER="internet explorer@9.0" PLATFORM="Windows 7" - # ie8 - - node_js: '8' - env: TARGET=test-browser BROWSER="internet explorer@8.0" PLATFORM="Windows 7" - # ie7 - - node_js: '8' - env: TARGET=test-browser BROWSER="internet explorer@7.0" PLATFORM="Windows XP" - # firefox - - node_js: '8' - env: TARGET=test-browser BROWSER="firefox@latest" PLATFORM="Windows 8.1" - # safari - - node_js: '8' - env: TARGET=test-browser BROWSER="safari@latest" PLATFORM="OS X 10.11" + - script: COVERAGE=1 npm start test.node + after_success: npm start coveralls + + - &node + script: npm start test.node + node_js: '10' + + - <<: *node + node_js: '8' + + - script: npm start test.bundle test.browser + # XXX: update when canvas supplies a prebuilt binary for Node.js v12.x + node_js: 10 + install: npm ci # we need the native modules here + addons: + artifacts: + paths: + - .karma/ + - ./mocha.js + chrome: stable + sauce_connect: true -before_install: scripts/travis-before-install.sh + - stage: lint + script: npm start lint -before_script: scripts/travis-before-script.sh + # smoke tests use default npm. + - &smoke + stage: smoke + env: null + before_install: true + install: npm install --production -script: make $TARGET + script: ./bin/mocha --no-config --reporter spec test/sanity/sanity.spec.js + cache: + directories: + - ~/.npm + - node_modules # npm install, unlike npm ci, doesn't wipe node_modules -after_success: "npm run postcoverage && { + return { + files: [ + 'index.js', + 'lib/**/*.{js,json}', + 'test/setup.js', + 'test/assertions.js', + { + pattern: 'test/node-unit/**/*.fixture.js', + instrument: false + }, + { + pattern: 'test/unit/**/*.fixture.js', + instrument: false + }, + 'package.json', + 'test/opts/mocha.opts', + 'mocharc.yml' + ], + filesWithNoCoverageCalculated: [ + 'test/**/*.fixture.js', + 'test/setup.js', + 'test/assertions.js', + 'lib/browser/**/*.js' + ], + tests: ['test/unit/**/*.spec.js', 'test/node-unit/**/*.spec.js'], + env: { + type: 'node', + runner: 'node' + }, + workers: {recycle: true}, + testFramework: {type: 'mocha', path: __dirname}, + setup(wallaby) { + // running mocha instance is not the same as mocha under test, + // running mocha is the project's source code mocha, mocha under test is instrumented version of the source code + const runningMocha = wallaby.testFramework; + runningMocha.timeout(200); + // to expose it/describe etc. on the mocha under test + const MochaUnderTest = require('./'); + const mochaUnderTest = new MochaUnderTest(); + mochaUnderTest.suite.emit( + MochaUnderTest.Suite.constants.EVENT_FILE_PRE_REQUIRE, + global, + '', + mochaUnderTest + ); + // to make test/node-unit/color.spec.js pass, we need to run mocha in the project's folder context + const childProcess = require('child_process'); + const execFile = childProcess.execFile; + childProcess.execFile = function() { + let opts = arguments[2]; + if (typeof opts === 'function') { + opts = {}; + Array.prototype.splice.call(arguments, 2, 0, opts); + } + opts.cwd = wallaby.localProjectDir; + return execFile.apply(this, arguments); + }; + require('./test/setup'); + }, + debug: true + }; +}; diff --git a/CHANGELOG.md b/CHANGELOG.md index 66e5aac8a2..f61ff11537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,52 +1,623 @@ +# 6.2.0 / 2019-07-18 + +## :tada: Enhancements + +- [#3827](https://github.com/mochajs/mocha/issues/3827): Do not fork child-process if no Node flags are present ([**@boneskull**](https://github.com/boneskull)) +- [#3725](https://github.com/mochajs/mocha/issues/3725): Base reporter store ref to console.log, see [mocha/wiki](https://github.com/mochajs/mocha/wiki/HOW-TO:-Correctly-stub-stdout) ([**@craigtaub**](https://github.com/craigtaub)) + +## :bug: Fixes + +- [#3942](https://github.com/mochajs/mocha/issues/3942): Fix "No test files found" Error when file is passed via `--file` ([**@gabegorelick**](https://github.com/gabegorelick)) +- [#3914](https://github.com/mochajs/mocha/issues/3914): Modify Mocha constructor to accept options `global` or `globals` ([**@pascalpp**](https://github.com/pascalpp)) +- [#3894](https://github.com/mochajs/mocha/issues/3894): Fix parsing of config files with `_mocha` binary ([**@juergba**](https://github.com/juergba)) +- [#3834](https://github.com/mochajs/mocha/issues/3834): Fix CLI parsing with default values ([**@boneskull**](https://github.com/boneskull), [**@juergba**](https://github.com/juergba)) +- [#3831](https://github.com/mochajs/mocha/issues/3831): Fix `--timeout`/`--slow` string values and duplicate arguments ([**@boneskull**](https://github.com/boneskull), [**@juergba**](https://github.com/juergba)) + +## :book: Documentation + +- [#3906](https://github.com/mochajs/mocha/issues/3906): Document option to define custom report name for XUnit reporter ([**@pkuczynski**](https://github.com/pkuczynski)) +- [#3889](https://github.com/mochajs/mocha/issues/3889): Adds doc links for mocha-examples ([**@craigtaub**](https://github.com/craigtaub)) +- [#3887](https://github.com/mochajs/mocha/issues/3887): Fix broken links ([**@toyjhlee**](https://github.com/toyjhlee)) +- [#3841](https://github.com/mochajs/mocha/issues/3841): Fix anchors to configuration section ([**@trescube**](https://github.com/trescube)) + +## :mag: Coverage + +- [#3915](https://github.com/mochajs/mocha/issues/3915), [#3929](https://github.com/mochajs/mocha/issues/3929): Increase tests coverage for `--watch` options ([**@geigerzaehler**](https://github.com/geigerzaehler)) + +## :nut_and_bolt: Other + +- [#3953](https://github.com/mochajs/mocha/issues/3953): Collect test files later, prepares improvements to the `--watch` mode behavior ([**@geigerzaehler**](https://github.com/geigerzaehler)) +- [#3939](https://github.com/mochajs/mocha/issues/3939): Upgrade for npm audit ([**@boneskull**](https://github.com/boneskull)) +- [#3930](https://github.com/mochajs/mocha/issues/3930): Extract `runWatch` into separate module ([**@geigerzaehler**](https://github.com/geigerzaehler)) +- [#3922](https://github.com/mochajs/mocha/issues/3922): Add `mocha.min.js` file to stacktrace filter ([**@brian-lagerman**](https://github.com/brian-lagerman)) +- [#3919](https://github.com/mochajs/mocha/issues/3919): Update CI config files to use Node-12.x ([**@plroebuck**](https://github.com/plroebuck)) +- [#3892](https://github.com/mochajs/mocha/issues/3892): Rework reporter tests ([**@plroebuck**](https://github.com/plroebuck)) +- [#3872](https://github.com/mochajs/mocha/issues/3872): Rename `--exclude` to `--ignore` and create alias ([**@boneskull**](https://github.com/boneskull)) +- [#3963](https://github.com/mochajs/mocha/issues/3963): Hide stacktrace when cli args are missing ([**@outsideris**](https://github.com/outsideris)) +- [#3956](https://github.com/mochajs/mocha/issues/3956): Do not redeclare variable in docs array example ([**@DanielRuf**](https://github.com/DanielRuf)) +- [#3957](https://github.com/mochajs/mocha/issues/3957): Remove duplicate line-height property in `mocha.css` ([**@DanielRuf**](https://github.com/DanielRuf)) +- [#3960](https://github.com/mochajs/mocha/issues/3960): Don't re-initialize grep option on watch re-run ([**@geigerzaehler**](https://github.com/geigerzaehler)) + +# 6.1.4 / 2019-04-18 + +## :lock: Security Fixes + +- [#3877](https://github.com/mochajs/mocha/issues/3877): Upgrade [js-yaml](https://npm.im/js-yaml), addressing [code injection vulnerability](https://www.npmjs.com/advisories/813) ([**@bjornstar**](https://github.com/bjornstar)) + +# 6.1.3 / 2019-04-11 + +## :bug: Fixes + +- [#3863](https://github.com/mochajs/mocha/issues/3863): Fix `yargs`-related global scope pollution ([**@inukshuk**](https://github.com/inukshuk)) +- [#3869](https://github.com/mochajs/mocha/issues/3869): Fix failure when installed w/ `pnpm` ([**@boneskull**](https://github.com/boneskull)) + +# 6.1.2 / 2019-04-08 + +## :bug: Fixes + +- [#3867](https://github.com/mochajs/mocha/issues/3867): Re-publish v6.1.1 from POSIX OS to avoid dropped executable flags ([**@boneskull**](https://github.com/boneskull)) + +# 6.1.1 / 2019-04-07 + +## :bug: Fixes + +- [#3866](https://github.com/mochajs/mocha/issues/3866): Fix Windows End-of-Line publishing issue ([**@juergba**](https://github.com/juergba) & [**@cspotcode**](https://github.com/cspotcode)) + +# 6.1.0 / 2019-04-07 + +## :lock: Security Fixes + +- [#3845](https://github.com/mochajs/mocha/issues/3845): Update dependency "js-yaml" to v3.13.0 per npm security advisory ([**@plroebuck**](https://github.com/plroebuck)) + +## :tada: Enhancements + +- [#3766](https://github.com/mochajs/mocha/issues/3766): Make reporter constructor support optional `options` parameter ([**@plroebuck**](https://github.com/plroebuck)) +- [#3760](https://github.com/mochajs/mocha/issues/3760): Add support for config files with `.jsonc` extension ([**@sstephant**](https://github.com/sstephant)) + +## :fax: Deprecations + +These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: + +- [#3719](https://github.com/mochajs/mocha/issues/3719): Deprecate `this.skip()` for "after all" hooks ([**@juergba**](https://github.com/juergba)) + +## :bug: Fixes + +- [#3829](https://github.com/mochajs/mocha/issues/3829): Use cwd-relative pathname to load config file ([**@plroebuck**](https://github.com/plroebuck)) +- [#3745](https://github.com/mochajs/mocha/issues/3745): Fix async calls of `this.skip()` in "before each" hooks ([**@juergba**](https://github.com/juergba)) +- [#3669](https://github.com/mochajs/mocha/issues/3669): Enable `--allow-uncaught` for uncaught exceptions thrown inside hooks ([**@givanse**](https://github.com/givanse)) + +and some regressions: + +- [#3848](https://github.com/mochajs/mocha/issues/3848): Fix `Suite` cloning by copying `root` property ([**@fatso83**](https://github.com/fatso83)) +- [#3816](https://github.com/mochajs/mocha/issues/3816): Guard against undefined timeout option ([**@boneskull**](https://github.com/boneskull)) +- [#3814](https://github.com/mochajs/mocha/issues/3814): Update "yargs" in order to avoid deprecation message ([**@boneskull**](https://github.com/boneskull)) +- [#3788](https://github.com/mochajs/mocha/issues/3788): Fix support for multiple node flags ([**@aginzberg**](https://github.com/aginzberg)) + +## :book: Documentation + +- [mochajs/mocha-examples](https://github.com/mochajs/mocha-examples): New repository of working examples of common configurations using mocha ([**@craigtaub**](https://github.com/craigtaub)) +- [#3850](https://github.com/mochajs/mocha/issues/3850): Remove pound icon showing on header hover on docs ([**@jd2rogers2**](https://github.com/jd2rogers2)) +- [#3812](https://github.com/mochajs/mocha/issues/3812): Add autoprefixer to documentation page CSS ([**@Munter**](https://github.com/Munter)) +- [#3811](https://github.com/mochajs/mocha/issues/3811): Update doc examples "tests.html" ([**@DavidLi119**](https://github.com/DavidLi119)) +- [#3807](https://github.com/mochajs/mocha/issues/3807): Mocha website HTML tweaks ([**@plroebuck**](https://github.com/plroebuck)) +- [#3793](https://github.com/mochajs/mocha/issues/3793): Update config file example ".mocharc.yml" ([**@cspotcode**](https://github.com/cspotcode)) + +## :nut_and_bolt: Other + +- [#3830](https://github.com/mochajs/mocha/issues/3830): Replace dependency "findup-sync" with "find-up" for faster startup ([**@cspotcode**](https://github.com/cspotcode)) +- [#3799](https://github.com/mochajs/mocha/issues/3799): Update devDependencies to fix many npm vulnerabilities ([**@XhmikosR**](https://github.com/XhmikosR)) + +# 6.0.2 / 2019-02-25 + +## :bug: Fixes + +Two more regressions fixed: + +- [#3768](https://github.com/mochajs/mocha/issues/3768): Test file paths no longer dropped from `mocha.opts` ([**@boneskull**](https://github.com/boneskull)) +- [#3767](https://github.com/mochajs/mocha/issues/3767): `--require` does not break on module names that look like certain `node` flags ([**@boneskull**](https://github.com/boneskull)) + +# 6.0.1 / 2019-02-21 + +The obligatory round of post-major-release bugfixes. + +## :bug: Fixes + +These issues were regressions. + +- [#3754](https://github.com/mochajs/mocha/issues/3754): Mocha again finds `test.js` when run without arguments ([**@plroebuck**](https://github.com/plroebuck)) +- [#3756](https://github.com/mochajs/mocha/issues/3756): Mocha again supports third-party interfaces via `--ui` ([**@boneskull**](https://github.com/boneskull)) +- [#3755](https://github.com/mochajs/mocha/issues/3755): Fix broken `--watch` ([**@boneskull**](https://github.com/boneskull)) +- [#3759](https://github.com/mochajs/mocha/issues/3759): Fix unwelcome deprecation notice when Mocha run against languages (CoffeeScript) with implicit return statements; _returning a non-`undefined` value from a `describe` callback is no longer considered deprecated_ ([**@boneskull**](https://github.com/boneskull)) + +## :book: Documentation + +- [#3738](https://github.com/mochajs/mocha/issues/3738): Upgrade to `@mocha/docdash@2` ([**@tendonstrength**](https://github.com/tendonstrength)) +- [#3751](https://github.com/mochajs/mocha/issues/3751): Use preferred names for example config files ([**@Szauka**](https://github.com/Szauka)) + +# 6.0.0 / 2019-02-18 + +## :tada: Enhancements + +- [#3726](https://github.com/mochajs/mocha/issues/3726): Add ability to unload files from `require` cache ([**@plroebuck**](https://github.com/plroebuck)) + +## :bug: Fixes + +- [#3737](https://github.com/mochajs/mocha/issues/3737): Fix falsy values from options globals ([**@plroebuck**](https://github.com/plroebuck)) +- [#3707](https://github.com/mochajs/mocha/issues/3707): Fix encapsulation issues for `Suite#_onlyTests` and `Suite#_onlySuites` ([**@vkarpov15**](https://github.com/vkarpov15)) +- [#3711](https://github.com/mochajs/mocha/issues/3711): Fix diagnostic messages dealing with plurality and markup of output ([**@plroebuck**](https://github.com/plroebuck)) +- [#3723](https://github.com/mochajs/mocha/issues/3723): Fix "reporter-option" to allow comma-separated options ([**@boneskull**](https://github.com/boneskull)) +- [#3722](https://github.com/mochajs/mocha/issues/3722): Fix code quality and performance of `lookupFiles` and `files` ([**@plroebuck**](https://github.com/plroebuck)) +- [#3650](https://github.com/mochajs/mocha/issues/3650), [#3654](https://github.com/mochajs/mocha/issues/3654): Fix noisy error message when no files found ([**@craigtaub**](https://github.com/craigtaub)) +- [#3632](https://github.com/mochajs/mocha/issues/3632): Tests having an empty title are no longer confused with the "root" suite ([**@juergba**](https://github.com/juergba)) +- [#3666](https://github.com/mochajs/mocha/issues/3666): Fix missing error codes ([**@vkarpov15**](https://github.com/vkarpov15)) +- [#3684](https://github.com/mochajs/mocha/issues/3684): Fix exiting problem in Node.js v11.7.0+ ([**@addaleax**](https://github.com/addaleax)) +- [#3691](https://github.com/mochajs/mocha/issues/3691): Fix `--delay` (and other boolean options) not working in all cases ([**@boneskull**](https://github.com/boneskull)) +- [#3692](https://github.com/mochajs/mocha/issues/3692): Fix invalid command-line argument usage not causing actual errors ([**@boneskull**](https://github.com/boneskull)) +- [#3698](https://github.com/mochajs/mocha/issues/3698), [#3699](https://github.com/mochajs/mocha/issues/3699): Fix debug-related Node.js options not working in all cases ([**@boneskull**](https://github.com/boneskull)) +- [#3700](https://github.com/mochajs/mocha/issues/3700): Growl notifications now show the correct number of tests run ([**@outsideris**](https://github.com/outsideris)) +- [#3686](https://github.com/mochajs/mocha/issues/3686): Avoid potential ReDoS when diffing large objects ([**@cyjake**](https://github.com/cyjake)) +- [#3715](https://github.com/mochajs/mocha/issues/3715): Fix incorrect order of emitted events when used programmatically ([**@boneskull**](https://github.com/boneskull)) +- [#3706](https://github.com/mochajs/mocha/issues/3706): Fix regression wherein `--reporter-option`/`--reporter-options` did not support comma-separated key/value pairs ([**@boneskull**](https://github.com/boneskull)) + +## :book: Documentation + +- [#3652](https://github.com/mochajs/mocha/issues/3652): Switch from Jekyll to Eleventy ([**@Munter**](https://github.com/Munter)) + +## :nut_and_bolt: Other + +- [#3677](https://github.com/mochajs/mocha/issues/3677): Add error objects for createUnsupportedError and createInvalidExceptionError ([**@boneskull**](https://github.com/boneskull)) +- [#3733](https://github.com/mochajs/mocha/issues/3733): Removed unnecessary processing in post-processing hook ([**@wanseob**](https://github.com/wanseob)) +- [#3730](https://github.com/mochajs/mocha/issues/3730): Update nyc to latest version ([**@coreyfarrell**](https://github.com/coreyfarrell)) +- [#3648](https://github.com/mochajs/mocha/issues/3648), [#3680](https://github.com/mochajs/mocha/issues/3680): Fixes to support latest versions of [unexpected](https://npm.im/unexpected) and [unexpected-sinon](https://npm.im/unexpected-sinon) ([**@sunesimonsen**](https://github.com/sunesimonsen)) +- [#3638](https://github.com/mochajs/mocha/issues/3638): Add meta tag to site ([**@MartijnCuppens**](https://github.com/MartijnCuppens)) +- [#3653](https://github.com/mochajs/mocha/issues/3653): Fix parts of test suite failing to run on Windows ([**@boneskull**](https://github.com/boneskull)) + +# 6.0.0-1 / 2019-01-02 + +## :bug: Fixes + +- Fix missing `mocharc.json` in published package ([**@boneskull**](https://github.com/boneskull)) + +# 6.0.0-0 / 2019-01-01 + +**Documentation for this release can be found at [next.mochajs.org](https://next.mochajs.org)**! + +Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https://github.com/craigtaub), & [**@markowsiak**](https://github.com/markowsiak) to the team! + +## :boom: Breaking Changes + +- [#3149](https://github.com/mochajs/mocha/issues/3149): **Drop Node.js v4.x support** ([**@outsideris**](https://github.com/outsideris)) +- [#3556](https://github.com/mochajs/mocha/issues/3556): Changes to command-line options ([**@boneskull**](https://github.com/boneskull)): + - `--grep` and `--fgrep` are now mutually exclusive; attempting to use both will cause Mocha to fail instead of simply ignoring `--grep` + - `--compilers` is no longer supported; attempting to use will cause Mocha to fail with a link to more information + - `-d` is no longer an alias for `--debug`; `-d` is currently ignored + - [#3275](https://github.com/mochajs/mocha/issues/3275): `--watch-extensions` no longer implies `js`; it must be explicitly added ([**@TheDancingCode**](https://github.com/TheDancingCode)) +- [#2908](https://github.com/mochajs/mocha/issues/2908): `tap` reporter emits error messages ([**@chrmod**](https://github.com/chrmod)) +- [#2819](https://github.com/mochajs/mocha/issues/2819): When conditionally skipping in a `before` hook, subsequent `before` hooks _and_ tests in nested suites are now skipped ([**@bannmoore**](https://github.com/bannmoore)) +- [#627](https://github.com/mochajs/mocha/issues/627): Emit filepath in "timeout exceeded" exceptions where applicable ([**@boneskull**](https://github.com/boneskull)) +- [#3556](https://github.com/mochajs/mocha/issues/3556): `lib/template.html` has moved to `lib/browser/template.html` ([**@boneskull**](https://github.com/boneskull)) +- [#2576](https://github.com/mochajs/mocha/issues/2576): An exception is now thrown if Mocha fails to parse or find a `mocha.opts` at a user-specified path ([**@plroebuck**](https://github.com/plroebuck)) +- [#3458](https://github.com/mochajs/mocha/issues/3458): Instantiating a `Base`-extending reporter without a `Runner` parameter will throw an exception ([**@craigtaub**](https://github.com/craigtaub)) +- [#3125](https://github.com/mochajs/mocha/issues/3125): For consumers of Mocha's programmatic API, all exceptions thrown from Mocha now have a `code` property (and some will have additional metadata). Some `Error` messages have changed. **Please use the `code` property to check `Error` types instead of the `message` property**; these descriptions will be localized in the future. ([**@craigtaub**](https://github.com/craigtaub)) + +## :fax: Deprecations + +These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: + +- `-gc` users should use `--gc-global` instead +- Consumers of the function exported by `bin/options` should now use the `loadMochaOpts` or `loadOptions` (preferred) functions exported by the `lib/cli/options` module + +Regarding the `Mocha` class constructor (from `lib/mocha`): + +- Use property `color: false` instead of `useColors: false` +- Use property `timeout: false` instead of `enableTimeouts: false` + +All of the above deprecations were introduced by [#3556](https://github.com/mochajs/mocha/issues/3556). + +`mocha.opts` is now considered "legacy"; please prefer RC file or `package.json` over `mocha.opts`. + +## :tada: Enhancements + +Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556): + +- Mocha now supports "RC" files in JS, JSON, YAML, or `package.json`-based (using `mocha` property) format + + - `.mocharc.js`, `.mocharc.json`, `.mocharc.yaml` or `.mocharc.yml` are valid "rc" file names and will be automatically loaded + - Use `--config /path/to/rc/file` to specify an explicit path + - Use `--package /path/to/package.json` to specify an explicit `package.json` to read the `mocha` prop from + - Use `--no-config` or `--no-package` to completely disable loading of configuration via RC file and `package.json`, respectively + - Configurations are merged as applicable using the priority list: + 1. Command-line arguments + 1. RC file + 1. `package.json` + 1. `mocha.opts` + 1. Mocha's own defaults + - Check out these [example config files](https://github.com/mochajs/mocha/tree/master/example/config) + +- Node/V8 flag support in `mocha` executable: + + - Support all allowed `node` flags as supported by the running version of `node` (also thanks to [**@demurgos**](https://github.com/demurgos)) + - Support any V8 flag by prepending `--v8-` to the flag name + - All flags are also supported via config files, `package.json` properties, or `mocha.opts` + - Debug-related flags (e.g., `--inspect`) now _imply_ `--no-timeouts` + - Use of e.g., `--debug` will automatically invoke `--inspect` if supported by running version of `node` + +- Support negation of any Mocha-specific command-line flag by prepending `--no-` to the flag name + +- Interfaces now have descriptions when listed using `--interfaces` flag + +- `Mocha` constructor supports all options + +- `--extension` is now an alias for `--watch-extensions` and affects _non-watch-mode_ test runs as well. For example, to run _only_ `test/*.coffee` (not `test/*.js`), you can do `mocha --require coffee-script/register --extensions coffee`. + +- [#3552](https://github.com/mochajs/mocha/issues/3552): `tap` reporter is now TAP13-capable ([**@plroebuck**](https://github.com/plroebuck) & [**@mollstam**](https://github.com/mollstam)) + +- [#3535](https://github.com/mochajs/mocha/issues/3535): Mocha's version can now be queried programmatically via public property `Mocha.prototype.version` ([**@plroebuck**](https://github.com/plroebuck)) + +- [#3428](https://github.com/mochajs/mocha/issues/3428): `xunit` reporter shows diffs ([**@mlucool**](https://github.com/mlucool)) + +- [#2529](https://github.com/mochajs/mocha/issues/2529): `Runner` now emits a `retry` event when tests are retried (reporters can listen for this) ([**@catdad**](https://github.com/catdad)) + +- [#2962](https://github.com/mochajs/mocha/issues/2962), [#3111](https://github.com/mochajs/mocha/issues/3111): In-browser notification support; warn about missing prereqs when `--growl` supplied ([**@plroebuck**](https://github.com/plroebuck)) + +## :bug: Fixes + +- [#3356](https://github.com/mochajs/mocha/issues/3356): `--no-timeouts` and `--timeout 0` now does what you'd expect ([**@boneskull**](https://github.com/boneskull)) +- [#3475](https://github.com/mochajs/mocha/issues/3475): Restore `--no-exit` option ([**@boneskull**](https://github.com/boneskull)) +- [#3570](https://github.com/mochajs/mocha/issues/3570): Long-running tests now respect `SIGINT` ([**@boneskull**](https://github.com/boneskull)) +- [#2944](https://github.com/mochajs/mocha/issues/2944): `--forbid-only` and `--forbid-pending` now "fail fast" when encountered on a suite ([**@outsideris**](https://github.com/outsideris)) +- [#1652](https://github.com/mochajs/mocha/issues/1652), [#2951](https://github.com/mochajs/mocha/issues/2951): Fix broken clamping of timeout values ([**@plroebuck**](https://github.com/plroebuck)) +- [#2095](https://github.com/mochajs/mocha/issues/2095), [#3521](https://github.com/mochajs/mocha/issues/3521): Do not log `stdout:` prefix in browser console ([**@Bamieh**](https://github.com/Bamieh)) +- [#3595](https://github.com/mochajs/mocha/issues/3595): Fix mochajs.org deployment problems ([**@papandreou**](https://github.com/papandreou)) +- [#3518](https://github.com/mochajs/mocha/issues/3518): Improve `utils.isPromise()` ([**@fabiosantoscode**](https://github.com/fabiosantoscode)) +- [#3320](https://github.com/mochajs/mocha/issues/3320): Fail gracefully when non-extensible objects are thrown in async tests ([**@fargies**](https://github.com/fargies)) +- [#2475](https://github.com/mochajs/mocha/issues/2475): XUnit does not duplicate test result numbers in "errors" and "failures"; "failures" will **always** be zero ([**@mlucool**](https://github.com/mlucool)) +- [#3398](https://github.com/mochajs/mocha/issues/3398), [#3598](https://github.com/mochajs/mocha/issues/3598), [#3457](https://github.com/mochajs/mocha/issues/3457), [#3617](https://github.com/mochajs/mocha/issues/3617): Fix regression wherein `--bail` would not execute "after" nor "after each" hooks ([**@juergba**](https://github.com/juergba)) +- [#3580](https://github.com/mochajs/mocha/issues/3580): Fix potential exception when using XUnit reporter programmatically ([**@Lana-Light**](https://github.com/Lana-Light)) +- [#1304](https://github.com/mochajs/mocha/issues/1304): Do not output color to `TERM=dumb` ([**@plroebuck**](https://github.com/plroebuck)) + +## :book: Documentation + +- [#3525](https://github.com/mochajs/mocha/issues/3525): Improvements to `.github/CONTRIBUTING.md` ([**@markowsiak**](https://github.com/markowsiak)) +- [#3466](https://github.com/mochajs/mocha/issues/3466): Update description of `slow` option ([**@finfin**](https://github.com/finfin)) +- [#3405](https://github.com/mochajs/mocha/issues/3405): Remove references to bower installations ([**@goteamtim**](https://github.com/goteamtim)) +- [#3361](https://github.com/mochajs/mocha/issues/3361): Improvements to `--watch` docs ([**@benglass**](https://github.com/benglass)) +- [#3136](https://github.com/mochajs/mocha/issues/3136): Improve docs around globbing and shell expansion ([**@akrawchyk**](https://github.com/akrawchyk)) +- [#2819](https://github.com/mochajs/mocha/issues/2819): Update docs around skips and hooks ([**@bannmoore**](https://github.com/bannmoore)) +- Many improvements by [**@outsideris**](https://github.com/outsideris) + +## :nut_and_bolt: Other + +- [#3557](https://github.com/mochajs/mocha/issues/3557): Use `ms` userland module instead of hand-rolled solution ([**@gizemkeser**](https://github.com/gizemkeser)) +- Many CI fixes and other refactors by [**@plroebuck**](https://github.com/plroebuck) +- Test refactors by [**@outsideris**](https://github.com/outsideris) + +# 5.2.0 / 2018-05-18 + +## :tada: Enhancements + +- [#3375](https://github.com/mochajs/mocha/pull/3375): Add support for comments in `mocha.opts` ([@plroebuck](https://github.com/plroebuck)) + +## :bug: Fixes + +- [#3346](https://github.com/mochajs/mocha/pull/3346): Exit correctly from `before` hooks when using `--bail` ([@outsideris](https://github.com/outsideris)) + +## :book: Documentation + +- [#3328](https://github.com/mochajs/mocha/pull/3328): Mocha-flavored [API docs](https://mochajs.org/api/)! ([@Munter](https://github.com/munter)) + +## :nut_and_bolt: Other + +- [#3330](https://github.com/mochajs/mocha/pull/3330): Use `Buffer.from()` ([@harrysarson](https://github.com/harrysarson)) +- [#3295](https://github.com/mochajs/mocha/pull/3295): Remove redundant folder ([@DavNej](https://github.com/DajNev)) +- [#3356](https://github.com/mochajs/mocha/pull/3356): Refactoring ([@plroebuck](https://github.com/plroebuck)) + +# 5.1.1 / 2018-04-18 + +## :bug: Fixes + +- [#3325](https://github.com/mochajs/mocha/issues/3325): Revert change which broke `--watch` ([@boneskull](https://github.com/boneskull)) + +# 5.1.0 / 2018-04-12 + +## :tada: Enhancements + +- [#3210](https://github.com/mochajs/mocha/pull/3210): Add `--exclude` option ([@metalex9](https://github.com/metalex9)) + +## :bug: Fixes + +- [#3318](https://github.com/mochajs/mocha/pull/3318): Fix failures in circular objects in JSON reporter ([@jeversmann](https://github.com/jeversmann), [@boneskull](https://github.com/boneskull)) + +## :book: Documentation + +- [#3323](https://github.com/mochajs/mocha/pull/3323): Publish actual [API documentation](https://mochajs.org/api/)! ([@dfberry](https://github.com/dfberry), [@Munter](https://github.com/munter)) +- [#3299](https://github.com/mochajs/mocha/pull/3299): Improve docs around exclusive tests ([@nicgirault](https://github.com/nicgirault)) + +## :nut_and_bolt: Other + +- [#3302](https://github.com/mochajs/mocha/pull/3302), [#3308](https://github.com/mochajs/mocha/pull/3308), [#3310](https://github.com/mochajs/mocha/pull/3310), [#3315](https://github.com/mochajs/mocha/pull/3315), [#3316](https://github.com/mochajs/mocha/pull/3316): Build matrix improvements ([more info](https://boneskull.com/mocha-and-travis-ci-build-stages/)) ([@outsideris](https://github.com/outsideris), [@boneskull](https://github.com/boneskull)) +- [#3272](https://github.com/mochajs/mocha/pull/3272): Refactor reporter tests ([@jMuzsik](https://github.com/jMuzsik)) + +# 5.0.5 / 2018-03-22 + +Welcome [@outsideris](https://github.com/outsideris) to the team! + +## :bug: Fixes + +- [#3096](https://github.com/mochajs/mocha/issues/3096): Fix `--bail` failing to bail within hooks ([@outsideris](https://github.com/outsideris)) +- [#3184](https://github.com/mochajs/mocha/issues/3184): Don't skip too many suites (using `describe.skip()`) ([@outsideris](https://github.com/outsideris)) + +## :book: Documentation + +- [#3133](https://github.com/mochajs/mocha/issues/3133): Improve docs regarding "pending" behavior ([@ematicipo](https://github.com/ematicipo)) +- [#3276](https://github.com/mochajs/mocha/pull/3276), [#3274](https://github.com/mochajs/mocha/pull/3274): Fix broken stuff in `CHANGELOG.md` ([@tagoro9](https://github.com/tagoro9), [@honzajavorek](https://github.com/honzajavorek)) + +## :nut_and_bolt: Other + +- [#3208](https://github.com/mochajs/mocha/issues/3208): Improve test coverage for AMD users ([@outsideris](https://github.com/outsideris)) +- [#3267](https://github.com/mochajs/mocha/pull/3267): Remove vestiges of PhantomJS from CI ([@anishkny](https://github.com/anishkny)) +- [#2952](https://github.com/mochajs/mocha/issues/2952): Fix a debug message ([@boneskull](https://github.com/boneskull)) + +# 5.0.4 / 2018-03-07 + +## :bug: Fixes + +- [#3265](https://github.com/mochajs/mocha/issues/3265): Fixes regression in "watch" functionality introduced in v5.0.2 ([@outsideris](https://github.com/outsideris)) + +# 5.0.3 / 2018-03-06 + +This patch features a fix to address a potential "low severity" [ReDoS vulnerability](https://snyk.io/vuln/npm:diff:20180305) in the [diff](https://npm.im/diff) package (a dependency of Mocha). + +## :lock: Security Fixes + +- [#3266](https://github.com/mochajs/mocha/pull/3266): Bump `diff` to v3.5.0 ([@anishkny](https://github.com/anishkny)) + +## :nut_and_bolt: Other + +- [#3011](https://github.com/mochajs/mocha/issues/3011): Expose `generateDiff()` in `Base` reporter ([@harrysarson](https://github.com/harrysarson)) + +# 5.0.2 / 2018-03-05 + +This release fixes a class of tests which report as _false positives_. **Certain tests will now break**, though they would have previously been reported as passing. Details below. Sorry for the inconvenience! + +## :bug: Fixes + +- [#3226](https://github.com/mochajs/mocha/issues/3226): Do not swallow errors that are thrown asynchronously from passing tests ([@boneskull](https://github.com/boneskull)). Example: + + \```js + it('should actually fail, sorry!', function (done) { + // passing assertion + assert(true === true); + + // test complete & is marked as passing + done(); + + // ...but something evil lurks within + setTimeout(() => { + throw new Error('chaos!'); + }, 100); + }); + \``` + + Previously to this version, Mocha would have _silently swallowed_ the `chaos!` exception, and you wouldn't know. Well, _now you know_. Mocha cannot recover from this gracefully, so it will exit with a nonzero code. + + **Maintainers of external reporters**: _If_ a test of this class is encountered, the `Runner` instance will emit the `end` event _twice_; you _may_ need to change your reporter to use `runner.once('end')` intead of `runner.on('end')`. + +- [#3093](https://github.com/mochajs/mocha/issues/3093): Fix stack trace reformatting problem ([@outsideris](https://github.com/outsideris)) + +## :nut_and_bolt: Other + +- [#3248](https://github.com/mochajs/mocha/issues/3248): Update `browser-stdout` to v1.3.1 ([@honzajavorek](https://github.com/honzajavorek)) + +# 5.0.1 / 2018-02-07 + +...your garden-variety patch release. + +Special thanks to [Wallaby.js](https://wallabyjs.com) for their continued support! :heart: + +## :bug: Fixes + +- [#1838](https://github.com/mochajs/mocha/issues/1838): `--delay` now works with `.only()` ([@silviom](https://github.com/silviom)) +- [#3119](https://github.com/mochajs/mocha/issues/3119): Plug memory leak present in v8 ([@boneskull](https://github.com/boneskull)) + +## :book: Documentation + +- [#3132](https://github.com/mochajs/mocha/issues/3132), [#3098](https://github.com/mochajs/mocha/issues/3098): Update `--glob` docs ([@outsideris](https://github.com/outsideris)) +- [#3212](https://github.com/mochajs/mocha/pull/3212): Update [Wallaby.js](https://wallabyjs.com)-related docs ([@ArtemGovorov](https://github.com/ArtemGovorov)) +- [#3205](https://github.com/mochajs/mocha/pull/3205): Remove outdated cruft ([@boneskull](https://github.com/boneskull)) + +## :nut_and_bolt: Other + +- [#3224](https://github.com/mochajs/mocha/pull/3224): Add proper Wallaby.js config ([@ArtemGovorov](https://github.com/ArtemGovorov)) +- [#3230](https://github.com/mochajs/mocha/pull/3230): Update copyright year ([@josephlin55555](https://github.com/josephlin55555)) + +# 5.0.0 / 2018-01-17 + +Mocha starts off 2018 right by again dropping support for _unmaintained rubbish_. + +Welcome [@vkarpov15](https://github.com/vkarpov15) to the team! + +## :boom: Breaking Changes + +- **[#3148](https://github.com/mochajs/mocha/issues/3148): Drop support for IE9 and IE10** ([@Bamieh](https://github.com/Bamieh)) + Practically speaking, only code which consumes (through bundling or otherwise) the userland [buffer](https://npm.im/buffer) module should be affected. However, Mocha will no longer test against these browsers, nor apply fixes for them. + +## :tada: Enhancements + +- [#3181](https://github.com/mochajs/mocha/issues/3181): Add useful new `--file` command line argument ([documentation](https://mochajs.org/#--file-file)) ([@hswolff](https://github.com/hswolff)) + +## :bug: Fixes + +- [#3187](https://github.com/mochajs/mocha/issues/3187): Fix inaccurate test duration reporting ([@FND](https://github.com/FND)) +- [#3202](https://github.com/mochajs/mocha/pull/3202): Fix bad markup in HTML reporter ([@DanielRuf](https://github.com/DanielRuf)) + +## :sunglasses: Developer Experience + +- [#2352](https://github.com/mochajs/mocha/issues/2352): Ditch GNU Make for [nps](https://npm.im/nps) to manage scripts ([@TedYav](https://github.com/TedYav)) + +## :book: Documentation + +- [#3137](https://github.com/mochajs/mocha/issues/3137): Add missing `--no-timeouts` docs ([@dfberry](https://github.com/dfberry)) +- [#3134](https://github.com/mochajs/mocha/issues/3134): Improve `done()` callback docs ([@maraisr](https://github.com/maraisr)) +- [#3135](https://github.com/mochajs/mocha/issues/3135): Fix cross-references ([@vkarpov15](https://github.com/vkarpov15)) +- [#3163](https://github.com/mochajs/mocha/pull/3163): Fix tpyos ([@tbroadley](https://github.com/tbroadley)) +- [#3177](https://github.com/mochajs/mocha/pull/3177): Tweak `README.md` organization ([@xxczaki](https://github.com/xxczaki)) +- Misc updates ([@boneskull](https://github.com/boneskull)) + +## :nut_and_bolt: Other + +- [#3118](https://github.com/mochajs/mocha/issues/3118): Move TextMate Integration to [its own repo](https://github.com/mochajs/mocha.tmbundle) ([@Bamieh](https://github.com/Bamieh)) +- [#3185](https://github.com/mochajs/mocha/issues/3185): Add Node.js v9 to build matrix; remove v7 ([@xxczaki](https://github.com/xxczaki)) +- [#3172](https://github.com/mochajs/mocha/issues/3172): Markdown linting ([@boneskull](https://github.com/boneskull)) +- Test & Netlify updates ([@Munter](https://github.com/munter), [@boneskull](https://github.com/boneskull)) + +# 4.1.0 / 2017-12-28 + +This is mainly a "housekeeping" release. + +Welcome [@Bamieh](https://github.com/Bamieh) and [@xxczaki](https://github.com/xxczaki) to the team! + +## :bug: Fixes + +- [#2661](https://github.com/mochajs/mocha/issues/2661): `progress` reporter now accepts reporter options ([@canoztokmak](https://github.com/canoztokmak)) +- [#3142](https://github.com/mochajs/mocha/issues/3142): `xit` in `bdd` interface now properly returns its `Test` object ([@Bamieh](https://github.com/Bamieh)) +- [#3075](https://github.com/mochajs/mocha/pull/3075): Diffs now computed eagerly to avoid misinformation when reported ([@abrady0](https://github.com/abrady0)) +- [#2745](https://github.com/mochajs/mocha/issues/2745): `--help` will now help you even if you have a `mocha.opts` ([@Zarel](https://github.com/Zarel)) + +## :tada: Enhancements + +- [#2514](https://github.com/mochajs/mocha/issues/2514): The `--no-diff` flag will completely disable diff output ([@CapacitorSet](https://github.com/CapacitorSet)) +- [#3058](https://github.com/mochajs/mocha/issues/3058): All "setters" in Mocha's API are now also "getters" if called without arguments ([@makepanic](https://github.com/makepanic)) + +## :book: Documentation + +- [#3170](https://github.com/mochajs/mocha/pull/3170): Optimization and site speed improvements ([@Munter](https://github.com/munter)) +- [#2987](https://github.com/mochajs/mocha/issues/2987): Moved the old [site repo](https://github.com/mochajs/mochajs.github.io) into the main repo under `docs/` ([@boneskull](https://github.com/boneskull)) +- [#2896](https://github.com/mochajs/mocha/issues/2896): Add [maintainer guide](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) ([@boneskull](https://github.com/boneskull)) +- Various fixes and updates ([@xxczaki](https://github.com/xxczaki), [@maty21](https://github.com/maty21), [@leedm777](https://github.com/leedm777)) + +## :nut_and_bolt: Other + +- Test improvements and fixes ([@eugenet8k](https://github.com/eugenet8k), [@ngeor](https://github.com/ngeor), [@38elements](https://github.com/38elements), [@Gerhut](https://github.com/Gerhut), [@ScottFreeCode](https://github.com/ScottFreeCode), [@boneskull](https://github.com/boneskull)) +- Refactoring and cruft excision ([@38elements](https://github.com/38elements), [@Bamieh](https://github.com/Bamieh), [@finnigantime](https://github.com/finnigantime), [@boneskull](https://github.com/boneskull)) + +# 4.0.1 / 2017-10-05 + +## :bug: Fixes + +- [#3051](https://github.com/mochajs/mocha/pull/3051): Upgrade Growl to v1.10.3 to fix its [peer dep problems](https://github.com/tj/node-growl/pull/68) ([@dpogue](https://github.com/dpogue)) + +# 4.0.0 / 2017-10-02 + +You might want to read this before filing a new bug! :stuck_out_tongue_closed_eyes: + +## :boom: Breaking Changes + +For more info, please [read this article](https://boneskull.com/mocha-v4-nears-release/). + +### Compatibility + +- [#3016](https://github.com/mochajs/mocha/issues/3016): Drop support for unmaintained versions of Node.js ([@boneskull](https://github.com/boneskull)): + - 0.10.x + - 0.11.x + - 0.12.x + - iojs (any) + - 5.x.x +- [#2979](https://github.com/mochajs/mocha/issues/2979): Drop support for non-ES5-compliant browsers ([@boneskull](https://github.com/boneskull)): + - IE7 + - IE8 + - PhantomJS 1.x +- [#2615](https://github.com/mochajs/mocha/issues/2615): Drop Bower support; old versions (3.x, etc.) will remain available ([@ScottFreeCode](https://github.com/ScottFreeCode), [@boneskull](https://github.com/boneskull)) + +### Default Behavior + +- [#2879](https://github.com/mochajs/mocha/issues/2879): By default, Mocha will no longer force the process to exit once all tests complete. This means any test code (or code under test) which would normally prevent `node` from exiting will do so when run in Mocha. Supply the `--exit` flag to revert to pre-v4.0.0 behavior ([@ScottFreeCode](https://github.com/ScottFreeCode), [@boneskull](https://github.com/boneskull)) + +### Reporter Output + +- [#2095](https://github.com/mochajs/mocha/issues/2095): Remove `stdout:` prefix from browser reporter logs ([@skeggse](https://github.com/skeggse)) +- [#2295](https://github.com/mochajs/mocha/issues/2295): Add separator in "unified diff" output ([@olsonpm](https://github.com/olsonpm)) +- [#2686](https://github.com/mochajs/mocha/issues/2686): Print failure message when `--forbid-pending` or `--forbid-only` is specified ([@ScottFreeCode](https://github.com/ScottFreeCode)) +- [#2814](https://github.com/mochajs/mocha/pull/2814): Indent contexts for better readability when reporting failures ([@charlierudolph](https://github.com/charlierudolph)) + +## :-1: Deprecations + +- [#2493](https://github.com/mochajs/mocha/issues/2493): The `--compilers` command-line option is now soft-deprecated and will emit a warning on `STDERR`. Read [this](https://github.com/mochajs/mocha/wiki/compilers-deprecation) for more info and workarounds ([@ScottFreeCode](https://github.com/ScottFreeCode), [@boneskull](https://github.com/boneskull)) + +## :tada: Enhancements + +- [#2628](https://github.com/mochajs/mocha/issues/2628): Allow override of default test suite name in XUnit reporter ([@ngeor](https://github.com/ngeor)) + +## :book: Documentation + +- [#3020](https://github.com/mochajs/mocha/pull/3020): Link to CLA in `README.md` and `CONTRIBUTING.md` ([@skeggse](https://github.com/skeggse)) + +## :nut_and_bolt: Other + +- [#2890](https://github.com/mochajs/mocha/issues/2890): Speed up build by (re-)consolidating SauceLabs tests ([@boneskull](https://github.com/boneskull)) + +# 3.5.3 / 2017-09-11 + +## :bug: Fixes + +- [#3003](https://github.com/mochajs/mocha/pull/3003): Fix invalid entities in xUnit reporter first appearing in v3.5.1 ([@jkrems](https://github.com/jkrems)) + +# 3.5.2 / 2017-09-10 + +## :bug: Fixes + +- [#3001](https://github.com/mochajs/mocha/pull/3001): Fix AMD-related failures first appearing in v3.5.1 ([@boneskull](https://github.com/boneskull)) + +# 3.5.1 / 2017-09-09 + +## :newspaper: News + +- :mega: Mocha is now sponsoring [PDXNode](http://pdxnode.org)! If you're in the [Portland](https://wikipedia.org/wiki/Portland,_Oregon) area, come check out the monthly talks and hack nights! + +## :bug: Fixes + +- [#2997](https://github.com/mochajs/mocha/pull/2997): Fix missing `xit` export for "require" interface ([@solodynamo](https://github.com/solodynamo)) +- [#2957](https://github.com/mochajs/mocha/pull/2957): Fix unicode character handling in XUnit reporter failures ([@jkrems](https://github.com/jkrems)) + +## :nut_and_bolt: Other + +- [#2986](https://github.com/mochajs/mocha/pull/2986): Add issue and PR templates ([@kungapal](https://github.com/kungapal)) +- [#2918](https://github.com/mochajs/mocha/pull/2918): Drop bash dependency for glob-related tests ([@ScottFreeCode](https://github.com/ScottFreeCode)) +- [#2922](https://github.com/mochajs/mocha/pull/2922): Improve `--compilers` coverage ([@ScottFreeCode](https://github.com/ScottFreeCode)) +- [#2981](https://github.com/mochajs/mocha/pull/2981): Fix tpyos and spelling errors ([@jsoref](https://github.com/jsoref)) + # 3.5.0 / 2017-07-31 ## :newspaper: News -- Mocha now has a [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) (thanks [@kungapal]!). -- Old issues and PRs are now being marked "stale" by [Probot's "Stale" plugin](https://github.com/probot/stale). If an issue is marked as such, and you would like to see it remain open, simply add a new comment to the ticket or PR. +- Mocha now has a [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) (thanks [@kungapal](https://github.com/kungapal)!). +- Old issues and PRs are now being marked "stale" by [Probot's "Stale" plugin](https://github.com/probot/stale). If an issue is marked as such, and you would like to see it remain open, simply add a new comment to the ticket or PR. - **WARNING**: Support for non-ES5-compliant environments will be dropped starting with version 4.0.0 of Mocha! ## :lock: Security Fixes -- [#2860]: Address [CVE-2015-8315](https://nodesecurity.io/advisories/46) via upgrade of [debug](https://npm.im/debug) ([@boneskull]) +- [#2860](https://github.com/mochajs/mocha/pull/2860): Address [CVE-2015-8315](https://nodesecurity.io/advisories/46) via upgrade of [debug](https://npm.im/debug) ([@boneskull](https://github.com/boneskull)) ## :tada: Enhancements -- [#2696]: Add `--forbid-only` and `--forbid-pending` flags. Use these in CI or hooks to ensure tests aren't accidentally being skipped! ([@charlierudolph]) -- [#2813]: Support Node.js 8's `--napi-modules` flag ([@jupp0r]) +- [#2696](https://github.com/mochajs/mocha/pull/2696): Add `--forbid-only` and `--forbid-pending` flags. Use these in CI or hooks to ensure tests aren't accidentally being skipped! ([@charlierudolph](https://github.com/charlierudolph)) +- [#2813](https://github.com/mochajs/mocha/pull/2813): Support Node.js 8's `--napi-modules` flag ([@jupp0r](https://github.com/jupp0r)) ## :nut_and_bolt: Other -- Various CI-and-test-related fixes and improvements ([@boneskull], [@dasilvacontin], [@PopradiArpad], [@Munter], [@ScottFreeCode]) -- "Officially" support Node.js 8 ([@elergy]) - -[#2860]: https://github.com/mochajs/mocha/pulls/2860 -[#2696]: https://github.com/mochajs/mocha/pulls/2696 -[#2813]: https://github.com/mochajs/mocha/pulls/2813 -[@charlierudolph]: https://github.com/charlierudolph -[@PopradiArpad]: https://github.com/PopradiArpad -[@kungapal]: https://github.com/kungapal -[@elergy]: https://github.com/elergy -[@jupp0r]: https://github.com/jupp0r +- Various CI-and-test-related fixes and improvements ([@boneskull](https://github.com/boneskull), [@dasilvacontin](https://github.com/dasilvacontin), [@PopradiArpad](https://github.com/PopradiArpad), [@Munter](https://github.com/munter), [@ScottFreeCode](https://github.com/ScottFreeCode)) +- "Officially" support Node.js 8 ([@elergy](https://github.com/elergy)) # 3.4.2 / 2017-05-24 ## :bug: Fixes -- [#2802]: Remove call to deprecated `os.tmpDir` ([@makepanic]) -- [#2820]: Eagerly set `process.exitCode` ([@chrisleck]) +- [#2802](https://github.com/mochajs/mocha/issues/2802): Remove call to deprecated `os.tmpDir` ([@makepanic](https://github.com/makepanic)) +- [#2820](https://github.com/mochajs/mocha/pull/2820): Eagerly set `process.exitCode` ([@chrisleck](https://github.com/chrisleck)) ## :nut_and_bolt: Other -- [#2778]: Move linting into an npm script ([@Munter]) - -[@chrisleck]: https://github.com/chrisleck -[@makepanic]: https://github.com/makepanic -[@Munter]: https://github.com/Munter - -[#2778]: https://github.com/mochajs/mocha/pulls/2778 -[#2802]: https://github.com/mochajs/mocha/issues/2802 -[#2820]: https://github.com/mochajs/mocha/pull/2820 +- [#2807](https://github.com/mochajs/mocha/pull/2807): Move linting into an npm script ([@Munter](https://github.com/munter)) # 3.4.1 / 2017-05-14 @@ -63,30 +634,18 @@ This week's highlights: ## :tada: Enhancements -- [#2793], [#2697]: add --allowUncaught to Node.js ([@lrowe]) -- [#2733]: Add `--no-warnings` and `--trace-warnings` flags ([@sonicdoe]) +- [#2793](https://github.com/mochajs/mocha/pull/2793), [#2697](https://github.com/mochajs/mocha/pull/2697): add --allowUncaught to Node.js ([@lrowe](https://github.com/lrowe)) +- [#2733](https://github.com/mochajs/mocha/pull/2733): Add `--no-warnings` and `--trace-warnings` flags ([@sonicdoe](https://github.com/sonicdoe)) ## :bug: Fixes -- [#2793], [#2697]: fix broken allowUncaught ([@lrowe]) +- [#2793](https://github.com/mochajs/mocha/pull/2793), [#2697](https://github.com/mochajs/mocha/pull/2697): fix broken allowUncaught ([@lrowe](https://github.com/lrowe)) ## :nut_and_bolt: Other -- [#2778]: Add license report and scan status ([@xizhao]) -- [#2794]: no special case for macOS running Karma locally ([@boneskull]) -- [#2795]: reverts use of semistandard directly ([#2648]) ([@boneskull]) - -[@lrowe]: https://github.com/lrowe -[@sonicdoe]: https://github.com/sonicdoe -[@xizhao]: https://github.com/xizhao -[@boneskull]: https://github.com/boneskull - -[#2795]: https://github.com/mochajs/mocha/pull/2795 -[#2733]: https://github.com/mochajs/mocha/pull/2733 -[#2793]: https://github.com/mochajs/mocha/pull/2793 -[#2697]: https://github.com/mochajs/mocha/pull/2697 -[#2778]: https://github.com/mochajs/mocha/pull/2778 -[#2794]: https://github.com/mochajs/mocha/pull/2794 +- [#2778](https://github.com/mochajs/mocha/pull/2778): Add license report and scan status ([@xizhao](https://github.com/xizhao)) +- [#2794](https://github.com/mochajs/mocha/pull/2794): no special case for macOS running Karma locally ([@boneskull](https://github.com/boneskull)) +- [#2795](https://github.com/mochajs/mocha/pull/2795): reverts use of semistandard directly ([#2648](https://github.com/mochajs/mocha/pull/2648)) ([@boneskull](https://github.com/boneskull)) # 3.3.0 / 2017-04-24 @@ -95,86 +654,47 @@ Thanks to all our contributors, maintainers, sponsors, and users! ❤️ As highlights: - We've got coverage now! -- Testing is looking less flaky \o/. +- Testing is looking less flaky \\o/. - No more nitpicking about "mocha.js" build on PRs. ## :tada: Enhancements -- [#2659]: Adds support for loading reporter from an absolute or relative path ([@sul4bh]) -- [#2769]: Support `--inspect-brk` on command-line ([@igwejk]) +- [#2659](https://github.com/mochajs/mocha/pull/2659): Adds support for loading reporter from an absolute or relative path ([@sul4bh](https://github.com/sul4bh)) +- [#2769](https://github.com/mochajs/mocha/pull/2769): Support `--inspect-brk` on command-line ([@igwejk](https://github.com/igwejk)) ## :bug: Fixes -- [#2662]: Replace unicode chars w/ hex codes in HTML reporter ([@rotemdan]) +- [#2662](https://github.com/mochajs/mocha/pull/2662): Replace unicode chars w/ hex codes in HTML reporter ([@rotemdan](https://github.com/rotemdan)) ## :mag: Coverage -- [#2672]: Add coverage for node tests ([@c089], [@Munter]) -- [#2680]: Increase tests coverage for base reporter ([@epallerols]) -- [#2690]: Increase tests coverage for doc reporter ([@craigtaub]) -- [#2701]: Increase tests coverage for landing, min, tap and list reporters ([@craigtaub]) -- [#2691]: Increase tests coverage for spec + dot reporters ([@craigtaub]) -- [#2698]: Increase tests coverage for xunit reporter ([@craigtaub]) -- [#2699]: Increase tests coverage for json-stream, markdown and progress reporters ([@craigtaub]) -- [#2703]: Cover .some() function in utils.js with tests ([@seppevs]) -- [#2773]: Add tests for loading reporters w/ relative/absolute paths ([@sul4bh]) +- [#2672](https://github.com/mochajs/mocha/pull/2672): Add coverage for node tests ([@c089](https://github.com/c089), [@Munter](https://github.com/munter)) +- [#2680](https://github.com/mochajs/mocha/pull/2680): Increase tests coverage for base reporter ([@epallerols](https://github.com/epallerols)) +- [#2690](https://github.com/mochajs/mocha/pull/2690): Increase tests coverage for doc reporter ([@craigtaub](https://github.com/craigtaub)) +- [#2701](https://github.com/mochajs/mocha/pull/2701): Increase tests coverage for landing, min, tap and list reporters ([@craigtaub](https://github.com/craigtaub)) +- [#2691](https://github.com/mochajs/mocha/pull/2691): Increase tests coverage for spec + dot reporters ([@craigtaub](https://github.com/craigtaub)) +- [#2698](https://github.com/mochajs/mocha/pull/2698): Increase tests coverage for xunit reporter ([@craigtaub](https://github.com/craigtaub)) +- [#2699](https://github.com/mochajs/mocha/pull/2699): Increase tests coverage for json-stream, markdown and progress reporters ([@craigtaub](https://github.com/craigtaub)) +- [#2703](https://github.com/mochajs/mocha/pull/2703): Cover .some() function in utils.js with tests ([@seppevs](https://github.com/seppevs)) +- [#2773](https://github.com/mochajs/mocha/pull/2773): Add tests for loading reporters w/ relative/absolute paths ([@sul4bh](https://github.com/sul4bh)) ## :nut_and_bolt: Other -- Remove bin/.eslintrc; ensure execs are linted ([@boneskull]) -- [#2542]: Expand CONTRIBUTING.md ([@boneskull]) -- [#2660]: Double timeouts on integration tests ([@Munter]) -- [#2653]: Update copyright year ([@Scottkao85], [@Munter]) -- [#2621]: Update dependencies to enable Greenkeeper ([@boneskull], [@greenkeeper]) -- [#2625]: Use trusty container in travis-ci; use "artifacts" addon ([@boneskull]) -- [#2670]: doc(CONTRIBUTING): fix link to org members ([@coderbyheart]) -- Add Mocha propaganda to README.md ([@boneskull]) -- [#2470]: Avoid test flake in "delay" test ([@boneskull]) -- [#2675]: Limit browser concurrency on sauce ([@boneskull]) -- [#2669]: Use temporary test-only build of mocha.js for browsers tests ([@Munter]) -- Fix "projects" link in README.md ([@boneskull]) -- [#2678]: Chore(Saucelabs): test on IE9, IE10 and IE11 ([@coderbyheart]) -- [#2648]: Use `semistandard` directly ([@kt3k]) -- [#2727]: Make the build reproducible ([@lamby]) - -[@boneskull]: https://github.com/boneskull -[@c089]: https://github.com/c089 -[@coderbyheart]: https://github.com/coderbyheart -[@craigtaub]: https://github.com/craigtaub -[@epallerols]: https://github.com/epallerols -[@greenkeeper]: https://github.com/greenkeeper -[@igwejk]: https://github.com/igwejk -[@kt3k]: https://github.com/kt3k -[@lamby]: https://github.com/lamby -[@Munter]: https://github.com/Munter -[@rotemdan]: https://github.com/rotemdan -[@seppevs]: https://github.com/seppevs -[@sul4bh]: https://github.com/sul4bh - -[#2470]: https://github.com/mochajs/mocha/pull/2470 -[#2542]: https://github.com/mochajs/mocha/issues/2542 -[#2621]: https://github.com/mochajs/mocha/pull/2621 -[#2625]: https://github.com/mochajs/mocha/pull/2625 -[#2648]: https://github.com/mochajs/mocha/pull/2648 -[#2653]: https://github.com/mochajs/mocha/pull/2653 -[#2659]: https://github.com/mochajs/mocha/pull/2659 -[#2660]: https://github.com/mochajs/mocha/pull/2660 -[#2662]: https://github.com/mochajs/mocha/pull/2662 -[#2669]: https://github.com/mochajs/mocha/pull/2669 -[#2670]: https://github.com/mochajs/mocha/pull/2670 -[#2672]: https://github.com/mochajs/mocha/pull/2672 -[#2675]: https://github.com/mochajs/mocha/pull/2675 -[#2678]: https://github.com/mochajs/mocha/pull/2678 -[#2680]: https://github.com/mochajs/mocha/pull/2680 -[#2690]: https://github.com/mochajs/mocha/pull/2690 -[#2691]: https://github.com/mochajs/mocha/pull/2691 -[#2698]: https://github.com/mochajs/mocha/pull/2698 -[#2699]: https://github.com/mochajs/mocha/pull/2699 -[#2701]: https://github.com/mochajs/mocha/pull/2701 -[#2703]: https://github.com/mochajs/mocha/pull/2703 -[#2727]: https://github.com/mochajs/mocha/pull/2727 -[#2769]: https://github.com/mochajs/mocha/pull/2769 -[#2773]: https://github.com/mochajs/mocha/pull/2773 +- Remove bin/.eslintrc; ensure execs are linted ([@boneskull](https://github.com/boneskull)) +- [#2542](https://github.com/mochajs/mocha/issues/2542): Expand CONTRIBUTING.md ([@boneskull](https://github.com/boneskull)) +- [#2660](https://github.com/mochajs/mocha/pull/2660): Double timeouts on integration tests ([@Munter](https://github.com/munter)) +- [#2653](https://github.com/mochajs/mocha/pull/2653): Update copyright year ([@Scottkao85], [@Munter](https://github.com/munter)) +- [#2621](https://github.com/mochajs/mocha/pull/2621): Update dependencies to enable Greenkeeper ([@boneskull](https://github.com/boneskull), [@greenkeeper](https://github.com/greenkeeper)) +- [#2625](https://github.com/mochajs/mocha/pull/2625): Use trusty container in travis-ci; use "artifacts" addon ([@boneskull](https://github.com/boneskull)) +- [#2670](https://github.com/mochajs/mocha/pull/2670): doc(CONTRIBUTING): fix link to org members ([@coderbyheart](https://github.com/coderbyheart)) +- Add Mocha propaganda to README.md ([@boneskull](https://github.com/boneskull)) +- [#2470](https://github.com/mochajs/mocha/pull/2470): Avoid test flake in "delay" test ([@boneskull](https://github.com/boneskull)) +- [#2675](https://github.com/mochajs/mocha/pull/2675): Limit browser concurrency on sauce ([@boneskull](https://github.com/boneskull)) +- [#2669](https://github.com/mochajs/mocha/pull/2669): Use temporary test-only build of mocha.js for browsers tests ([@Munter](https://github.com/munter)) +- Fix "projects" link in README.md ([@boneskull](https://github.com/boneskull)) +- [#2678](https://github.com/mochajs/mocha/pull/2678): Chore(Saucelabs): test on IE9, IE10 and IE11 ([@coderbyheart](https://github.com/coderbyheart)) +- [#2648](https://github.com/mochajs/mocha/pull/2648): Use `semistandard` directly ([@kt3k](https://github.com/kt3k)) +- [#2727](https://github.com/mochajs/mocha/pull/2727): Make the build reproducible ([@lamby](https://github.com/lamby)) # 3.2.0 / 2016-11-24 @@ -182,1486 +702,1115 @@ As highlights: ### Mocha is now a JS Foundation Project! -Mocha is proud to have joined the [JS Foundation](https://js.foundation). For more information, [read the announcement](https://js.foundation/announcements/2016/10/17/Linux-Foundation-Unites-JavaScript-Community-Open-Web-Development/). +Mocha is proud to have joined the [JS Foundation](https://js.foundation). For more information, [read the announcement](https://js.foundation/announcements/2016/10/17/Linux-Foundation-Unites-JavaScript-Community-Open-Web-Development/). ### Contributor License Agreement -Under the foundation, all contributors to Mocha must sign the [JS Foundation CLA](https://js.foundation/CLA/) before their code can be merged. When sending a PR--if you have not already signed the CLA--a friendly bot will ask you to do so. +Under the foundation, all contributors to Mocha must sign the [JS Foundation CLA](https://js.foundation/CLA/) before their code can be merged. When sending a PR--if you have not already signed the CLA--a friendly bot will ask you to do so. Mocha remains licensed under the [MIT license](https://github.com/mochajs/mocha/blob/master/LICENSE). ## :bug: Bug Fix -- [#2535]: Fix crash when `--watch` encounters broken symlinks ([@villesau]) -- [#2593]: Fix (old) regression; incorrect symbol shown in `list` reporter ([@Aldaviva]) -- [#2584]: Fix potential error when running XUnit reporter ([@vobujs]) +- [#2535](https://github.com/mochajs/mocha/issues/2535): Fix crash when `--watch` encounters broken symlinks ([@villesau](https://github.com/villesau)) +- [#2593](https://github.com/mochajs/mocha/pull/2593): Fix (old) regression; incorrect symbol shown in `list` reporter ([@Aldaviva](https://github.com/Aldaviva)) +- [#2584](https://github.com/mochajs/mocha/issues/2584): Fix potential error when running XUnit reporter ([@vobujs](https://github.com/vobujs)) ## :tada: Enhancement -- [#2294]: Improve timeout error messaging ([@jeversmann], [@boneskull]) -- [#2520]: Add info about `--inspect` flag to CLI help ([@ughitsaaron]) +- [#2294](https://github.com/mochajs/mocha/issues/2294): Improve timeout error messaging ([@jeversmann](https://github.com/jeversmann), [@boneskull](https://github.com/boneskull)) +- [#2520](https://github.com/mochajs/mocha/pull/2520): Add info about `--inspect` flag to CLI help ([@ughitsaaron](https://github.com/ughitsaaron)) ## :nut_and_bolt: Other -- [#2570]: Use [karma-mocha](https://npmjs.com/package/karma-mocha) proper ([@boneskull]) -- Licenses updated to reflect new copyright, add link to license and browser matrix to `README.md` ([@boneskull], [@ScottFreeCode], [@dasilvacontin]) +- [#2570](https://github.com/mochajs/mocha/issues/2570): Use [karma-mocha](https://npmjs.com/package/karma-mocha) proper ([@boneskull](https://github.com/boneskull)) +- Licenses updated to reflect new copyright, add link to license and browser matrix to `README.md` ([@boneskull](https://github.com/boneskull), [@ScottFreeCode](https://github.com/ScottFreeCode), [@dasilvacontin](https://github.com/dasilvacontin)) -[#2294]: https://github.com/mochajs/mocha/issues/2294 -[#2535]: https://github.com/mochajs/mocha/issues/2535 -[#2520]: https://github.com/mochajs/mocha/pull/2520 -[#2593]: https://github.com/mochajs/mocha/pull/2593 -[#2584]: https://github.com/mochajs/mocha/issues/2584 -[#2570]: https://github.com/mochajs/mocha/issues/2570 -[@Aldaviva]: https://github.com/Aldaviva -[@jeversmann]: https://github.com/jeversmann -[@ughitsaaron]: https://github.com/ughitsaaron -[@villesau]: https://github.com/villesau -[@vobujs]: https://github.com/vobujs - -Thanks to all our contributors, sponsors and backers! Keep on the lookout for a public roadmap and new contribution guide coming soon. +Thanks to all our contributors, sponsors and backers! Keep on the lookout for a public roadmap and new contribution guide coming soon. # 3.1.2 / 2016-10-10 ## :bug: Bug Fix -- [#2528]: Recovery gracefully if an `Error`'s `stack` property isn't writable ([@boneskull]) - -[#2528]: https://github.com/mochajs/mocha/issues/2528 +- [#2528](https://github.com/mochajs/mocha/issues/2528): Recovery gracefully if an `Error`'s `stack` property isn't writable ([@boneskull](https://github.com/boneskull)) # 3.1.1 / 2016-10-09 ## :bug: Bug Fix -- [#1417]: Don't report `done()` was called multiple times when it wasn't ([@frankleonrose]) - -## :nut_and_bolt: Other +- [#1417](https://github.com/mochajs/mocha/issues/1417): Don't report `done()` was called multiple times when it wasn't ([@frankleonrose](https://github.com/frankleonrose)) -- [#2490]: Lint with [semistandard](https://npmjs.com/package/semistandard) config ([@makepanic]) -- [#2525]: Lint all `.js` files ([@boneskull]) -- [#2524]: Provide workaround for developers unable to run browser tests on macOS Sierra ([@boneskull]) +## :nut_and_bolt: Other -[#1417]: https://github.com/mochajs/mocha/issues/1417 -[#2490]: https://github.com/mochajs/mocha/issues/2490 -[#2525]: https://github.com/mochajs/mocha/issues/2525 -[#2524]: https://github.com/mochajs/mocha/issues/2524 -[@makepanic]: https://github.com/makepanic -[@frankleonrose]: https://github.com/frankleonrose +- [#2490](https://github.com/mochajs/mocha/issues/2490): Lint with [semistandard](https://npmjs.com/package/semistandard) config ([@makepanic](https://github.com/makepanic)) +- [#2525](https://github.com/mochajs/mocha/issues/2525): Lint all `.js` files ([@boneskull](https://github.com/boneskull)) +- [#2524](https://github.com/mochajs/mocha/issues/2524): Provide workaround for developers unable to run browser tests on macOS Sierra ([@boneskull](https://github.com/boneskull)) # 3.1.0 / 2016-09-27 ## :tada: Enhancement -- [#2357]: Support `--inspect` on command-line ([@simov]) -- [#2194]: Human-friendly error if no files are matched on command-line ([@Munter]) -- [#1744]: Human-friendly error if a Suite has no callback (BDD/TDD only) ([@anton]) +- [#2357](https://github.com/mochajs/mocha/issues/2357): Support `--inspect` on command-line ([@simov](https://github.com/simov)) +- [#2194](https://github.com/mochajs/mocha/issues/2194): Human-friendly error if no files are matched on command-line ([@Munter](https://github.com/munter)) +- [#1744](https://github.com/mochajs/mocha/issues/1744): Human-friendly error if a Suite has no callback (BDD/TDD only) ([@anton](https://github.com/anton)) ## :bug: Bug Fix -- [#2488]: Fix case in which *variables beginning with lowercase "D"* may not have been reported properly as global leaks ([@JustATrick]) :laughing: -- [#2465]: Always halt execution in async function when `this.skip()` is called ([@boneskull]) -- [#2445]: Exits with expected code 130 when `SIGINT` encountered; exit code can no longer rollover at 256 ([@Munter]) -- [#2315]: Fix uncaught TypeError thrown from callback stack ([@1999]) -- Fix broken `only()`/`skip()` in IE7/IE8 ([@boneskull]) -- [#2502]: Fix broken stack trace filter on Node.js under Windows ([@boneskull]) -- [#2496]: Fix diff output for objects instantiated with `String` constructor ([more](https://youtrack.jetbrains.com/issue/WEB-23383)) ([@boneskull]) - -[#2496]: https://github.com/mochajs/mocha/issues/2496 -[#2502]: https://github.com/mochajs/mocha/issues/2502 -[#2315]: https://github.com/mochajs/mocha/issues/2315 -[#2445]: https://github.com/mochajs/mocha/pull/2445 -[#2465]: https://github.com/mochajs/mocha/issues/2465 -[#2488]: https://github.com/mochajs/mocha/issues/2488 -[#1744]: https://github.com/mochajs/mocha/issues/1744 -[#2194]: https://github.com/mochajs/mocha/issues/2194 -[#2357]: https://github.com/mochajs/mocha/issues/2357 -[@1999]: https://github.com/1999 -[@JustATrick]: https://github.com/JustATrick -[@anton]: https://github.com/anton -[@simov]: https://github.com/simov +- [#2488](https://github.com/mochajs/mocha/issues/2488): Fix case in which _variables beginning with lowercase "D"_ may not have been reported properly as global leaks ([@JustATrick](https://github.com/JustATrick)) :laughing: +- [#2465](https://github.com/mochajs/mocha/issues/2465): Always halt execution in async function when `this.skip()` is called ([@boneskull](https://github.com/boneskull)) +- [#2445](https://github.com/mochajs/mocha/pull/2445): Exits with expected code 130 when `SIGINT` encountered; exit code can no longer rollover at 256 ([@Munter](https://github.com/munter)) +- [#2315](https://github.com/mochajs/mocha/issues/2315): Fix uncaught TypeError thrown from callback stack ([@1999](https://github.com/1999)) +- Fix broken `only()`/`skip()` in IE7/IE8 ([@boneskull](https://github.com/boneskull)) +- [#2502](https://github.com/mochajs/mocha/issues/2502): Fix broken stack trace filter on Node.js under Windows ([@boneskull](https://github.com/boneskull)) +- [#2496](https://github.com/mochajs/mocha/issues/2496): Fix diff output for objects instantiated with `String` constructor ([more](https://youtrack.jetbrains.com/issue/WEB-23383)) ([@boneskull](https://github.com/boneskull)) # 3.0.2 / 2016-08-08 ## :bug: Bug Fix -- [#2424]: Fix error loading Mocha via Require.js ([@boneskull]) -- [#2417]: Fix execution of *deeply* nested `describe.only()` suites ([@not-an-aardvark]) -- Remove references to `json-cov` and `html-cov` reporters in CLI ([@boneskull]) - -[#2417]: https://github.com/mochajs/mocha/issues/2417 -[#2424]: https://github.com/mochajs/mocha/issues/2424 +- [#2424](https://github.com/mochajs/mocha/issues/2424): Fix error loading Mocha via Require.js ([@boneskull](https://github.com/boneskull)) +- [#2417](https://github.com/mochajs/mocha/issues/2417): Fix execution of _deeply_ nested `describe.only()` suites ([@not-an-aardvark](https://github.com/not-an-aardvark)) +- Remove references to `json-cov` and `html-cov` reporters in CLI ([@boneskull](https://github.com/boneskull)) # 3.0.1 / 2016-08-03 ## :bug: Bug Fix -- [#2406]: Restore execution of nested `describe.only()` suites ([@not-an-aardvark]) - -[#2406]: https://github.com/mochajs/mocha/issues/2406 -[@not-an-aardvark]: https://github.com/not-an-aardvark +- [#2406](https://github.com/mochajs/mocha/issues/2406): Restore execution of nested `describe.only()` suites ([@not-an-aardvark](https://github.com/not-an-aardvark)) # 3.0.0 / 2016-07-31 ## :boom: Breaking Changes - :warning: Due to the increasing difficulty of applying security patches made within its dependency tree, as well as looming incompatibilities with Node.js v7.0, **Mocha no longer supports Node.js v0.8**. -- :warning: **Mocha may no longer be installed by versions of `npm` less than `1.4.0`.** Previously, this requirement only affected Mocha's development dependencies. In short, this allows Mocha to depend on packages which have dependencies fixed to major versions (`^`). + +- :warning: **Mocha may no longer be installed by versions of `npm` less than `1.4.0`.** Previously, this requirement only affected Mocha's development dependencies. In short, this allows Mocha to depend on packages which have dependencies fixed to major versions (`^`). + - `.only()` is no longer "fuzzy", can be used multiple times, and generally just works like you think it should. :joy: -- To avoid common bugs, when a test injects a callback function (suggesting asynchronous execution), calls it, *and* returns a `Promise`, Mocha will now throw an exception: - ```js +- To avoid common bugs, when a test injects a callback function (suggesting asynchronous execution), calls it, _and_ returns a `Promise`, Mocha will now throw an exception: + + \```js const assert = require('assert'); it('should complete this test', function (done) { - return new Promise(function (resolve) { - assert.ok(true); - resolve(); - }) - .then(done); + return new Promise(function (resolve) { + assert.ok(true); + resolve(); + }) + .then(done); }); - ``` + \``` The above test will fail with `Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both.`. -- When a test timeout value *greater than* `2147483648` is specified in any context (`--timeout`, `mocha.setup()`, per-suite, per-test, etc.), the timeout will be *disabled* and the test(s) will be allowed to run indefinitely. This is equivalent to specifying a timeout value of `0`. See [MDN](https://developer.mozilla.org/docs/Web/API/WindowTimers/setTimeout#Maximum_delay_value) for reasoning. + +- When a test timeout value _greater than_ `2147483648` is specified in any context (`--timeout`, `mocha.setup()`, per-suite, per-test, etc.), the timeout will be _disabled_ and the test(s) will be allowed to run indefinitely. This is equivalent to specifying a timeout value of `0`. See [MDN](https://developer.mozilla.org/docs/Web/API/WindowTimers/setTimeout#Maximum_delay_value) for reasoning. + - The `dot` reporter now uses more visually distinctive characters when indicating "pending" and "failed" tests. + - Mocha no longer supports [component](https://www.npmjs.com/package/component). + - The long-forsaken `HTMLCov` and `JSONCov` reporters--and any relationship to the "node-jscoverage" project--have been removed. + - `spec` reporter now omits leading carriage returns (`\r`) in non-TTY environment. ## :tada: Enhancements -- [#808]: Allow regular-expression-like strings in `--grep` and browser's `grep` querystring; enables flags such as `i` for case-insensitive matches and `u` for unicode. ([@a8m]) -- [#2000]: Use distinctive characters in `dot` reporter; `,` will denote a "pending" test and `!` will denote a "failing" test. ([@elliottcable]) -- [#1632]: Throw a useful exception when a suite or test lacks a title. ([@a8m]) -- [#1481]: Better `.only()` behavior. ([@a8m]) -- [#2334]: Allow `this.skip()` in async tests and hooks. ([@boneskull]) -- [#1320]: Throw a useful exception when test resolution method is overspecified. ([@jugglinmike]) -- [#2364]: Support `--preserve-symlinks`. ([@rosswarren]) +- [#808](https://github.com/mochajs/mocha/issues/808): Allow regular-expression-like strings in `--grep` and browser's `grep` querystring; enables flags such as `i` for case-insensitive matches and `u` for unicode. ([@a8m](https://github.com/a8m)) +- [#2000](https://github.com/mochajs/mocha/pull/2000): Use distinctive characters in `dot` reporter; `,` will denote a "pending" test and `!` will denote a "failing" test. ([@elliottcable](https://github.com/elliottcable)) +- [#1632](https://github.com/mochajs/mocha/issues/1632): Throw a useful exception when a suite or test lacks a title. ([@a8m](https://github.com/a8m)) +- [#1481](https://github.com/mochajs/mocha/issues/1481): Better `.only()` behavior. ([@a8m](https://github.com/a8m)) +- [#2334](https://github.com/mochajs/mocha/issues/2334): Allow `this.skip()` in async tests and hooks. ([@boneskull](https://github.com/boneskull)) +- [#1320](https://github.com/mochajs/mocha/pull/1320): Throw a useful exception when test resolution method is overspecified. ([@jugglinmike](https://github.com/jugglinmike)) +- [#2364](https://github.com/mochajs/mocha/pull/2364): Support `--preserve-symlinks`. ([@rosswarren](https://github.com/rosswarren)) ## :bug: Bug Fixes -- [#2259]: Restore ES3 compatibility. Specifically, support an environment lacking `Date.prototype.toISOString()`, `JSON`, or has a non-standard implementation of `JSON`. ([@ndhoule], [@boneskull]) -- [#2286]: Fix `after()` failing to execute if test skipped using `this.skip()` in `beforeEach()`; no longer marks the entire suite as "pending". ([@dasilvacontin], [@boneskull]) -- [#2208]: Fix function name display in `markdown` and `html` (browser) reporters. ([@ScottFreeCode]) -- [#2299]: Fix progress bar in `html` (browser) reporter. ([@AviVahl]) -- [#2307]: Fix `doc` reporter crashing when test fails. ([@jleyba]) -- [#2323]: Ensure browser entry point (`browser-entry.js`) is published to npm (for use with bundlers). ([@boneskull]) -- [#2310]: Ensure custom reporter with an absolute path works in Windows. ([@silentcloud]) -- [#2311]: Fix problem wherein calling `this.slow()` without a value would blast any previously set value. ([@boneskull]) -- [#1813]: Ensure Mocha's own test suite will run in Windows. ([@tswaters], [@TimothyGu], [@boneskull]) -- [#2317]: Ensure all interfaces are displayed in `--help` on CLI. ([@ScottFreeCode]) -- [#1644]: Don't exhibit undefined behavior when calling `this.timeout()` with very large values ([@callumacrae], [@boneskull]) -- [#2361]: Don't truncate name of thrown anonymous exception. ([@boneskull]) -- [#2367]: Fix invalid CSS. ([@bensontrent]) -- [#2401]: Remove carriage return before each test line in spec reporter. ([@Munter]) +- [#2259](https://github.com/mochajs/mocha/pull/2259): Restore ES3 compatibility. Specifically, support an environment lacking `Date.prototype.toISOString()`, `JSON`, or has a non-standard implementation of `JSON`. ([@ndhoule](https://github.com/ndhoule), [@boneskull](https://github.com/boneskull)) +- [#2286](https://github.com/mochajs/mocha/issues/2286): Fix `after()` failing to execute if test skipped using `this.skip()` in `beforeEach()`; no longer marks the entire suite as "pending". ([@dasilvacontin](https://github.com/dasilvacontin), [@boneskull](https://github.com/boneskull)) +- [#2208](https://github.com/mochajs/mocha/pull/2208): Fix function name display in `markdown` and `html` (browser) reporters. ([@ScottFreeCode](https://github.com/ScottFreeCode)) +- [#2299](https://github.com/mochajs/mocha/pull/2299): Fix progress bar in `html` (browser) reporter. ([@AviVahl](https://github.com/avivahl)) +- [#2307](https://github.com/mochajs/mocha/pull/2307): Fix `doc` reporter crashing when test fails. ([@jleyba](https://github.com/jleyba)) +- [#2323](https://github.com/mochajs/mocha/issues/2323): Ensure browser entry point (`browser-entry.js`) is published to npm (for use with bundlers). ([@boneskull](https://github.com/boneskull)) +- [#2310](https://github.com/mochajs/mocha/issues/2310): Ensure custom reporter with an absolute path works in Windows. ([@silentcloud](https://github.com/silentcloud)) +- [#2311](https://github.com/mochajs/mocha/issues/2311): Fix problem wherein calling `this.slow()` without a value would blast any previously set value. ([@boneskull](https://github.com/boneskull)) +- [#1813](https://github.com/mochajs/mocha/issues/1813): Ensure Mocha's own test suite will run in Windows. ([@tswaters](https://github.com/tswaters), [@TimothyGu](https://github.com/timothygu), [@boneskull](https://github.com/boneskull)) +- [#2317](https://github.com/mochajs/mocha/issues/2317): Ensure all interfaces are displayed in `--help` on CLI. ([@ScottFreeCode](https://github.com/ScottFreeCode)) +- [#1644](https://github.com/mochajs/mocha/issues/1644): Don't exhibit undefined behavior when calling `this.timeout()` with very large values ([@callumacrae](https://github.com/callumacrae), [@boneskull](https://github.com/boneskull)) +- [#2361](https://github.com/mochajs/mocha/pull/2361): Don't truncate name of thrown anonymous exception. ([@boneskull](https://github.com/boneskull)) +- [#2367](https://github.com/mochajs/mocha/pull/2367): Fix invalid CSS. ([@bensontrent](https://github.com/bensontrent)) +- [#2401](https://github.com/mochajs/mocha/pull/2401): Remove carriage return before each test line in spec reporter. ([@Munter](https://github.com/munter)) ## :nut_and_bolt: Other -- Upgrade production dependencies to address security advisories (and because now we can): `glob`, `commander`, `escape-string-regexp`, -and `supports-color`. ([@boneskull], [@RobLoach]) -- Add Windows to CI. ([@boneskull], [@TimothyGu]) -- Ensure appropriate `engines` field in `package.json`. ([@shinnn], [@boneskull]) -- [#2348]: Upgrade ESLint to v2 ([@anthony-redfox]) +- Upgrade production dependencies to address security advisories (and because now we can): `glob`, `commander`, `escape-string-regexp`, and `supports-color`. ([@boneskull](https://github.com/boneskull), [@RobLoach](https://github.com/robloach)) +- Add Windows to CI. ([@boneskull](https://github.com/boneskull), [@TimothyGu](https://github.com/timothygu)) +- Ensure appropriate `engines` field in `package.json`. ([@shinnn](https://github.com/shinnn), [@boneskull](https://github.com/boneskull)) +- [#2348](https://github.com/mochajs/mocha/issues/2348): Upgrade ESLint to v2 ([@anthony-redfox](https://github.com/anthony-redfox)) We :heart: our [backers and sponsors](https://opencollective.com/mochajs)! :shipit: -[#2401]: https://github.com/mochajs/mocha/pull/2401 -[#2348]: https://github.com/mochajs/mocha/issues/2348 -[#808]: https://github.com/mochajs/mocha/issues/808 -[#2361]: https://github.com/mochajs/mocha/pull/2361 -[#2367]: https://github.com/mochajs/mocha/pull/2367 -[#2364]: https://github.com/mochajs/mocha/pull/2364 -[#1320]: https://github.com/mochajs/mocha/pull/1320 -[#2307]: https://github.com/mochajs/mocha/pull/2307 -[#2259]: https://github.com/mochajs/mocha/pull/2259 -[#2208]: https://github.com/mochajs/mocha/pull/2208 -[#2299]: https://github.com/mochajs/mocha/pull/2299 -[#2286]: https://github.com/mochajs/mocha/issues/2286 -[#1644]: https://github.com/mochajs/mocha/issues/1644 -[#2310]: https://github.com/mochajs/mocha/issues/2310 -[#2311]: https://github.com/mochajs/mocha/issues/2311 -[#2323]: https://github.com/mochajs/mocha/issues/2323 -[#2000]: https://github.com/mochajs/mocha/pull/2000 -[#1632]: https://github.com/mochajs/mocha/issues/1632 -[#1813]: https://github.com/mochajs/mocha/issues/1813 -[#2334]: https://github.com/mochajs/mocha/issues/2334 -[#2317]: https://github.com/mochajs/mocha/issues/2317 -[#1481]: https://github.com/mochajs/mocha/issues/1481 -[@elliottcable]: https://github.com/elliottcable -[@RobLoach]: https://github.com/robloach -[@AviVahl]: https://github.com/avivahl -[@silentcloud]: https://github.com/silentcloud -[@tswaters]: https://github.com/tswaters -[@jleyba]: https://github.com/jleyba -[@TimothyGu]: https://github.com/timothygu -[@callumacrae]: https://github.com/callumacrae -[@shinnn]: https://github.com/shinnn -[@bensontrent]: https://github.com/bensontrent -[@jugglinmike]: https://github.com/jugglinmike -[@rosswarren]: https://github.com/rosswarren -[@anthony-redfox]: https://github.com/anthony-redfox -[@Munter]: https://github.com/munter - # 2.5.3 / 2016-05-25 -- [#2112] - Fix HTML reporter regression causing duplicate error output ([@danielstjules] via 6d24063) -- [#2119] - Make HTML reporter failure/passed links preventDefault to avoid SPA's hash navigation ([@jimenglish81] via 9e93efc) - -[@danielstjules]: https://github.com/danielstjules -[@jimenglish81]: https://github.com/jimenglish81 -[#2112]: https://github.com/mochajs/mocha/pull/2112 -[#2119]: https://github.com/mochajs/mocha/pull/2119 +- [#2112](https://github.com/mochajs/mocha/pull/2112) - Fix HTML reporter regression causing duplicate error output ([@danielstjules](https://github.com/danielstjules) via [`6d24063`](https://github.com/mochajs/mocha/commit/6d24063)) +- [#2119](https://github.com/mochajs/mocha/pull/2119) - Make HTML reporter failure/passed links preventDefault to avoid SPA's hash navigation ([@jimenglish81](https://github.com/jimenglish81) via [`9e93efc`](https://github.com/mochajs/mocha/commit/9e93efc)) # 2.5.2 / 2016-05-24 -- [#2178] - Avoid double and triple xUnit XML escaping ([@graingert] via 49b5ff1) - -[@graingert]: https://github.com/graingert -[#2178]: https://github.com/mochajs/mocha/pull/2178 +- [#2178](https://github.com/mochajs/mocha/pull/2178) - Avoid double and triple xUnit XML escaping ([@graingert](https://github.com/graingert) via [`49b5ff1`](https://github.com/mochajs/mocha/commit/49b5ff1)) # 2.5.1 / 2016-05-23 -- Fix [to-iso-string](https://npmjs.com/package/to-iso-string) dependency ([@boneskull] via bd9450b) +- Fix [to-iso-string](https://npmjs.com/package/to-iso-string) dependency ([@boneskull](https://github.com/boneskull) via [`bd9450b`](https://github.com/mochajs/mocha/commit/bd9450b)) -Thanks @entertainyou, @SimenB, @just-paja for the heads-up. +Thanks [**@entertainyou**](https://github.com/entertainyou), [**@SimenB**](https://github.com/SimenB), [**@just-paja**](https://github.com/just-paja) for the heads-up. # 2.5.0 / 2016-05-23 -> This has been awhile coming! We needed to feel confident that the next release wouldn't break browser compatibility (e.g. the last few patch releases). -> -> ### Browser Tests in CI -> -> We now run unit tests against PhantomJS v1.x and an assortment of browsers on [SauceLabs](https://saucelabs.com), including: -> - Internet Explorer v8.0 -> - Chrome (latest) -> - Firefox (latest) -> - Safari (latest) -> - Microsoft Edge (latest) -> -> To accomplish this, we now run Mocha's unit tests (and a handful of integration tests) via [Karma](https://npmjs.com/package/karma) and a modified [karma-mocha](https://npmjs.com/package/karma-mocha). Along the way, we had to solve issue [#880] (apologies to @mderijcke and @sukima who had PRs addressing this), as well as replace most usages of [should](https://npmjs.com/package/should) with [expect.js](https://npmjs.com/package/expect.js) for IE8. -> -> Going forward, when sending PRs, your code will *only* run against PhantomJS v1.x (and not hit SauceLabs) [because security](https://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests). -> -> ### Node.js 6.x -> Node.js 6.x "just worked" before, but now it's in the CI matrix, so it's "officially" supported. Mocha *still retains support* for Node.js 0.8.x. -> -> ### "Minor" Release -> You'll see mostly bug fixes below, but also a couple features--as such, it's a "minor" release. -> -> ### TYVM -> -> Thanks to everyone who contributed, and our fabulous [sponsors and backers](https://opencollective.com/mochajs)! - -- [#2079] - Add browser checks to CI; update [browserify](https://npmjs.com/package/browserify) to v13.0.0 ([@dasilvacontin], [@ScottFreeCode], [@boneskull] via c04c1d7, 0b1e9b3, 0dde0fa, f8a3d86, 9e8cbaa) -- [#880] - Make Mocha browserifyable ([@boneskull] via 524862b) -- [#2121] - Update [glob](https://npmjs.com/package/glob) to v3.2.11 ([@astorije] via 7920fc4) -- [#2126] - Fix dupe error messages in stack trace filter ([@Turbo87] via 4301caa) -- [#2109] - Fix certain diffs when objects cannot be coerced into primitives ([@joshlory] via 61fbb7f) -- [#1827] - Fix TWBS/`mocha.css` collisions ([@irnc] via 0543798) -- [#1760], [#1936] - Fix `this.skip()` in HTML reporter ([@mislav] via cb4248b) -- [#2115] - Fix exceptions thrown from hooks in HTML reporter ([@danielstjules] via e290bc0) -- [#2089] - Handle Symbol values in `util.stringify()` ([@ryym] via ea61d05) -- [#2097] - Fix diff for objects overriding `Object.prototype.hasOwnProperty` ([@mantoni] via b20fdfe) -- [#2101] - Properly handle non-string "messages" thrown from assertion libraries ([@jkimbo] via 9c41051) -- [#2124] - Update [growl](https://npmjs.com/package/growl) ([@benjamine] via 9ae6a85) -- [#2162], [#2205] - JSDoc fixes ([@OlegTsyba] via 8031f20, [@ScottFreeCode] via f83b1d9) -- [#2132] - Remove Growl-related cruft ([@julienw] via 00d6469) -- [#2172] - Add [OpenCollective](https://opencollective.com) badge, sponsors & backers ([@xdamman], [@boneskull] via caee94f) -- [#1841] - Add new logo, banner assets ([@dasilvacontin] via 00fd0e1) -- [#2214] - Update `README.md` header ([@dasilvacontin] via c0f9be2) -- [#2236] - Better checks for Node.js v0.8 compatibility in CI ([@dasilvacontin] via ba5637d) -- [#2239] - Add Node.js v6.x to CI matrix ([@boneskull] via 3904da4) - -[#880]: https://github.com/mochajs/mocha/issues/880 -[#1841]: https://github.com/mochajs/mocha/pull/1841 -[#2239]: https://github.com/mochajs/mocha/issues/2239 -[#2153]: https://github.com/mochajs/mocha/pull/2153 -[#2214]: https://github.com/mochajs/mocha/pull/2214 -[#2236]: https://github.com/mochajs/mocha/pull/2236 -[#2079]: https://github.com/mochajs/mocha/issues/2079 -[#2231]: https://github.com/mochajs/mocha/pull/2231 -[#2089]: https://github.com/mochajs/mocha/issues/2089 -[#2097]: https://github.com/mochajs/mocha/pull/2097 -[#1760]: https://github.com/mochajs/mocha/issues/1760 -[#1936]: https://github.com/mochajs/mocha/issues/1936 -[#2115]: https://github.com/mochajs/mocha/pull/2115 -[#1827]: https://github.com/mochajs/mocha/pull/1827 -[#2101]: https://github.com/mochajs/mocha/pull/2101 -[#2124]: https://github.com/mochajs/mocha/pull/2124 -[#2109]: https://github.com/mochajs/mocha/issues/2109 -[#2162]: https://github.com/mochajs/mocha/pull/2162 -[#2132]: https://github.com/mochajs/mocha/issues/2132 -[#2126]: https://github.com/mochajs/mocha/issues/2126 -[#2121]: https://github.com/mochajs/mocha/issues/2121 -[#2205]: https://github.com/mochajs/mocha/pull/2205 -[#2172]: https://github.com/mochajs/mocha/pull/2172 -[@xdamman]: https://github.com/xdamman -[@Turbo87]: https://github.com/Turbo87 -[@OlegTsyba]: https://github.com/OlegTsyba -[@ryym]: https://github.com/ryym -[@mantoni]: https://github.com/mantoni -[@mislav]: https://github.com/mislav -[@irnc]: https://github.com/irnc -[@jkimbo]: https://github.com/jkimbo -[@benjamine]: https://github.com/benjamine -[@joshlory]: https://github.com/joshlory -[@julienw]: https://github.com/julienw -[@ScottFreeCode]: https://github.com/ScottFreeCode -[@astorije]: https://github.com/astorije -[@dasilvacontin]: https://github.com/dasilvacontin - -2.4.5 / 2016-01-28 -================== - -* [#2080], [#2078], [#2072], [#2073], [#1200] - Revert changes to console colors in changeset [1192914](https://github.com/mochajs/mocha/commit/119291449cd03a11cdeda9e37cf718a69a012896) and subsequent related changes thereafter. Restores compatibility with IE8 & PhantomJS. See also [mantoni/mochify.js#129](https://github.com/mantoni/mochify.js/issues/129) and [openlayers/ol3#4746](https://github.com/openlayers/ol3/pull/4746) ([@boneskull]) -* [#2082] - Fix several test assertions ([@mislav]) - -[#1200]: https://github.com/mochajs/mocha/issues/1200 -[#2082]: https://github.com/mochajs/mocha/pull/2082 - -2.4.4 / 2016-01-27 -================== - -* [#2080] - Fix broken RequireJS compatibility ([@boneskull]) - -[#2080]: https://github.com/mochajs/mocha/issues/2080 - -2.4.3 / 2016-01-27 -================== - -* [#2078] - Fix broken IE8 ([@boneskull]) - -[#2078]: https://github.com/mochajs/mocha/issues/2078 - -2.4.2 / 2016-01-26 -================== - -* [#2053] - Fix web worker compatibility ([@mislav]) -* [#2072] - Fix Windows color output ([@thedark1337]) -* [#2073] - Fix colors in `progress` and `landing` reporters ([@gyandeeps]) - -[#2053]: https://github.com/mochajs/mocha/pull/2053 -[#2072]: https://github.com/mochajs/mocha/pull/2072 -[#2073]: https://github.com/mochajs/mocha/pull/2073 -[@gyandeeps]: https://github.com/gyandeeps -[@thedark1337]: https://github.com/thedark1337 - -2.4.1 / 2016-01-26 -================== - -* [#2067] - Fix HTML/doc reporter regressions ([@danielstjules]) - -[#2067]: https://github.com/mochajs/mocha/pull/2067 - -2.4.0 / 2016-01-25 -================== - -* [#1945] - Correctly skip tests when skipping in suite's before() ([@ryanshawty]) -* [#2056] - chore(license): update license year to 2016 ([@pra85]) -* [#2048] - Fix `this.skip` from spec with HTML reporter ([@mislav]) -* [#2033] - Update tests for newer versions of should.js ([@tomhughes]) -* [#2037] - Fix for memory leak caused by referenced to deferred test ([@bd82]) -* [#2038] - Also run Travis-CI on node.js 4 & 5 ([@bd82]) -* [#2028] - Remove reference to test before afterAll hook runs ([@stonelgh]) -* Bump mkdirp to 0.5.1 to support strict mode ([@danielstjules]) -* [#1977] - safely stringify PhantomJS undefined value ([@ahamid]) -* Add the ability to retry tests ([@@longlho]) -* [#1982] - Enable --log-timer-events option [@Alaneor] -* Fix #1980: Load mocha.opts from bin/mocha and bin/_mocha ([@danielstjules]) -* [#1976] - Simplify function call ([@iclanzan]) -* [#1963] - Add support --perf-basic-prof ([@robraux]) -* [#1981] - Fix HTML reporter handling of done and exceptions ([@Standard8]) -* [#1993] - propagate "file" property for "exports" interface ([@segrey]) -* [#1999] - Add support for strict mode ([@tmont]) -* [#2005] - XUnit Reporter Writes to stdout, falls back to console.log ([@jonnyreeves]) -* [#2021] - Fix non ES5 compliant regexp ([@zetaben]) -* [#1965] - Don't double install BDD UI ([@cowboyd]) -* [#1995] - Make sure the xunit output dir exists before writing to it ([@ianwremmel]) -* Use chalk for the base reporter colors; closes #1200 ([@boneskull]) -* Fix requiring custom interfaces ([@jgkim]) -* [#1967] Silence Bluebird js warnings ([@krisr]) - -[#1945]: https://github.com/mochajs/mocha/pull/1945 -[#2056]: https://github.com/mochajs/mocha/pull/2056 -[#2048]: https://github.com/mochajs/mocha/pull/2048 -[#2033]: https://github.com/mochajs/mocha/pull/2033 -[#2037]: https://github.com/mochajs/mocha/pull/2037 -[#2038]: https://github.com/mochajs/mocha/pull/2038 -[#2028]: https://github.com/mochajs/mocha/pull/2028 -[#1977]: https://github.com/mochajs/mocha/pull/1977 -[#1982]: https://github.com/mochajs/mocha/pull/1982 -[#1976]: https://github.com/mochajs/mocha/pull/1976 -[#1963]: https://github.com/mochajs/mocha/pull/1963 -[#1981]: https://github.com/mochajs/mocha/pull/1981 -[#1993]: https://github.com/mochajs/mocha/pull/1993 -[#1999]: https://github.com/mochajs/mocha/pull/1999 -[#2005]: https://github.com/mochajs/mocha/pull/2005 -[#2021]: https://github.com/mochajs/mocha/pull/2021 -[1965#]: https://github.com/mochajs/mocha/pull/1965 -[#1995]: https://github.com/mochajs/mocha/pull/1995 -[#1967]: https://github.com/mochajs/mocha/pull/1967 -[@ryanshawty]: https://github.com/ryanshawty -[@pra85]: https://github.com/pra85 -[@mislav]: https://github.com/mislav -[@tomhughes]: https://github.com/tomhughes -[@bd82]: https://github.com/bd82 -[@stonelgh]: https://github.com/stonelgh -[@danielstjules]: https://github.com/danielstjules -[@ahamid]: https://github.com/ahamid -[@longlho]: https://github.com/longlho -[@Alaneor]: https://github.com/Alaneor -[@iclanzan]: https://github.com/iclanzan -[@robraux]: https://github.com/robraux -[@Standard8]: https://github.com/Standard8 -[@segrey]: https://github.com/segrey -[@tmont]: https://github.com/tmont -[@jonnyreeves]: https://github.com/jonnyreeves -[@zetaben]: https://github.com/zetaben -[@cowboyd]: https://github.com/cowboyd -[@ianwremmel]: https://github.com/ianwremmel -[@boneskull]: https://github.com/boneskull -[@jgkim]: https://github.com/jgkim -[@krisr]: https://github.com/krisr - -2.3.4 / 2015-11-15 -================== - - * Update debug dependency to 2.2.0 - * remove duplication of mocha.opts on process.argv - * Fix typo in test/reporters/nyan.js - -2.3.3 / 2015-09-19 -================== - - * [#1875] - Fix Markdown reporter exceeds maximum call stack size ([@danielstjules]) - * [#1864] - Fix xunit missing output with --reporter-options output ([@danielstjules]) - * [#1846] - Support all harmony flags ([@danielstjules]) - * Fix fragile xunit reporter spec ([@danielstjules]) - * [#1669] - Fix catch uncaught errors outside test suite execution ([@danielstjules]) - * [#1868] - Revert jade to support npm < v1.3.7 ([@danielstjules]) - * [#1766] - Don't remove modules/components from stack trace in the browser ([@danielstjules]) - * [#1798] - Fix correctly attribute mutiple done err with hooks ([@danielstjules]) - * Fix use utils.reduce for IE8 compatibility ([@wsw0108]) - * Some linting errors fixed by [@danielstjules] - * Call the inspect() function if message is not set ([@kevinburke]) - -[#1875]: https://github.com/mochajs/mocha/issues/1875 -[#1864]: https://github.com/mochajs/mocha/issues/1864 -[#1846]: https://github.com/mochajs/mocha/issues/1846 -[#1669]: https://github.com/mochajs/mocha/issues/1669 -[#1868]: https://github.com/mochajs/mocha/issues/1868 -[#1766]: https://github.com/mochajs/mocha/issues/1766 -[#1798]: https://github.com/mochajs/mocha/issues/1798 -[@danielstjules]: https://github.com/danielstjules -[@wsw0108]: https://github.com/wsw0108 -[@kevinburke]: https://github.com/kevinburke - -2.3.2 / 2015-09-07 -================== - * [#1868] - Fix compatibility with older versions of NPM ([@boneskull]) - - [#1868]: https://github.com/mochajs/mocha/issues/1868 - -2.3.1 / 2015-09-06 -================== - - * [#1812] - Fix: Bail flag causes before() hooks to be run even after a failure ([@aaroncrows]) - - [#1812]: https://github.com/mochajs/mocha/issues/1812 - [aaroncrows]: https://github.com/aaroncrows - -2.3.0 / 2015-08-30 -================== - - * [#553] - added --allowUncaught option ([@amsul]) - * [#1490] - Allow --async-only to be satisfied by returning a promise ([@jlai]) - * [#1829] - support --max-old-space-size ([@gigadude]) - * [#1811] - upgrade Jade dependency ([@outsideris]) - * [#1769] - Fix async hook error handling ([@ajaykodali]) - * [#1230] - More descriptive beforeEach/afterEach messages ([@duncanbeevers]) - * [#1787] - Scope loading behaviour instead of using early return ([@aryeguy]) - * [#1789] - Fix: html-runner crashing ([@sunesimonsen]) - * [#1749] - Fix maximum call stack error on large amount of tests ([@tinganho]) - * [#1230] - Decorate failed hook titles with test title ([@duncanbeevers]) - * [#1260] - Build using Browserify ([@ndhoule]) - * [#1728] - Don't use `__proto__` ([@ndhoule]) - * [#1781] - Fix hook error tests ([@glenjamin]) - * [#1754] - Allow boolean --reporter-options ([@papandreou]) - * [#1766] - Fix overly aggressive stack suppression ([@moll]) - * [#1752] - Avoid potential infinite loop ([@gsilk]) - * [#1761] - Fix problems running under PhantomJS ([@chromakode]) - * [#1700] - Fix more problems running under PhantomJS ([@jbnicolai]) - * [#1774] - Support escaped spaces in CLI options ([@adamgruber]) - * [#1687] - Fix HTML reporter links with special chars ([@benvinegar]) - * [#1359] - Adopt code style and enforce it using ESLint ([@ndhoule] w/ assist from [@jbnicolai] & [@boneskull]) - * various refactors ([@jbnicolai]) - * [#1758] - Add cross-frame compatible Error checking ([@outdooricon]) - * [#1741] - Remove moot `version` property from bower.json ([@kkirsche]) - * [#1739] - Improve `HISTORY.md` ([@rstacruz]) - * [#1730] - Support more io.js flags ([@ryedog]) - * [#1349] - Allow HTML in HTML reporter errors ([@papandreou] / [@sunesimonsen]) - * [#1572] - Prevent default browser behavior for failure/pass links ([@jschilli]) - * [#1630] - Support underscored harmony flags ([@dominicbarnes]) - * [#1718] - Support more harmony flags ([@slyg]) - * [#1689] - Add stack to JSON-stream reporter ([@jonathandelgado]) - * [#1654] - Fix `ReferenceError` "location is not defined" ([@jakemmarsh]) - - [#553]: https://github.com/mochajs/mocha/issues/553 - [#1490]: https://github.com/mochajs/mocha/issues/1490 - [#1829]: https://github.com/mochajs/mocha/issues/1829 - [#1811]: https://github.com/mochajs/mocha/issues/1811 - [#1769]: https://github.com/mochajs/mocha/issues/1769 - [#1230]: https://github.com/mochajs/mocha/issues/1230 - [#1787]: https://github.com/mochajs/mocha/issues/1787 - [#1789]: https://github.com/mochajs/mocha/issues/1789 - [#1749]: https://github.com/mochajs/mocha/issues/1749 - [#1230]: https://github.com/mochajs/mocha/issues/1230 - [#1260]: https://github.com/mochajs/mocha/issues/1260 - [#1728]: https://github.com/mochajs/mocha/issues/1728 - [#1781]: https://github.com/mochajs/mocha/issues/1781 - [#1754]: https://github.com/mochajs/mocha/issues/1754 - [#1766]: https://github.com/mochajs/mocha/issues/1766 - [#1752]: https://github.com/mochajs/mocha/issues/1752 - [#1761]: https://github.com/mochajs/mocha/issues/1761 - [#1700]: https://github.com/mochajs/mocha/issues/1700 - [#1774]: https://github.com/mochajs/mocha/issues/1774 - [#1687]: https://github.com/mochajs/mocha/issues/1687 - [#1359]: https://github.com/mochajs/mocha/issues/1359 - [#1758]: https://github.com/mochajs/mocha/issues/1758 - [#1741]: https://github.com/mochajs/mocha/issues/1741 - [#1739]: https://github.com/mochajs/mocha/issues/1739 - [#1730]: https://github.com/mochajs/mocha/issues/1730 - [#1349]: https://github.com/mochajs/mocha/issues/1349 - [#1572]: https://github.com/mochajs/mocha/issues/1572 - [#1630]: https://github.com/mochajs/mocha/issues/1630 - [#1718]: https://github.com/mochajs/mocha/issues/1718 - [#1689]: https://github.com/mochajs/mocha/issues/1689 - [#1654]: https://github.com/mochajs/mocha/issues/1654 - [@adamgruber]: https://github.com/adamgruber - [@ajaykodali]: https://github.com/ajaykodali - [@amsul]: https://github.com/amsul - [@aryeguy]: https://github.com/aryeguy - [@benvinegar]: https://github.com/benvinegar - [@boneskull]: https://github.com/boneskull - [@chromakode]: https://github.com/chromakode - [@dominicbarnes]: https://github.com/dominicbarnes - [@duncanbeevers]: https://github.com/duncanbeevers - [@gigadude]: https://github.com/gigadude - [@glenjamin]: https://github.com/glenjamin - [@gsilk]: https://github.com/gsilk - [@jakemmarsh]: https://github.com/jakemmarsh - [@jbnicolai]: https://github.com/jbnicolai - [@jlai]: https://github.com/jlai - [@jonathandelgado]: https://github.com/jonathandelgado - [@jschilli]: https://github.com/jschilli - [@kkirsche]: https://github.com/kkirsche - [@moll]: https://github.com/moll - [@ndhoule]: https://github.com/ndhoule - [@outdooricon]: https://github.com/outdooricon - [@outsideris]: https://github.com/outsideris - [@papandreou]: https://github.com/papandreou - [@rstacruz]: https://github.com/rstacruz - [@ryedog]: https://github.com/ryedog - [@slyg]: https://github.com/slyg - [@sunesimonsen]: https://github.com/sunesimonsen - [@tinganho]: https://github.com/tinganho - -2.2.5 / 2015-05-14 -================== - - * [#1699] - Upgrade jsdiff to v1.4.0 ([@nylen]) - * [#1648] - fix diff background colors in the console ([@nylen]) - * [#1327] - fix tests running twice, a regression issue. ([#1686], [@danielstjules]) - * [#1675] - add integration tests ([@danielstjules]) - * [#1682] - use a valid SPDX license identifier in package.json ([@kemitchell]) - * [#1660] - fix assertion of invalid dates ([#1661], [@a8m]) - * [#1241] - fix issue with multiline diffs appearing as single line ([#1655], [@a8m]) - -[#1699]: https://github.com/mochajs/mocha/issues/1699 -[#1648]: https://github.com/mochajs/mocha/issues/1648 -[#1327]: https://github.com/mochajs/mocha/issues/1327 -[#1686]: https://github.com/mochajs/mocha/issues/1686 -[#1675]: https://github.com/mochajs/mocha/issues/1675 -[#1682]: https://github.com/mochajs/mocha/issues/1682 -[#1660]: https://github.com/mochajs/mocha/issues/1660 -[#1661]: https://github.com/mochajs/mocha/issues/1661 -[#1241]: https://github.com/mochajs/mocha/issues/1241 -[#1655]: https://github.com/mochajs/mocha/issues/1655 -[@nylen]: https://github.com/nylen -[@danielstjules]: https://github.com/danielstjules -[@kemitchell]: https://github.com/kemitchell -[@a8m]: https://github.com/a8m - -2.2.4 / 2015-04-08 -================== - - * Load mocha.opts in _mocha for now (close #1645) - -2.2.3 / 2015-04-07 -================== - - * fix(reporter/base): string diff - issue #1241 - * fix(reporter/base): string diff - issue #1241 - * fix(reporter/base): don't show diffs for errors without expectation - * fix(reporter/base): don't assume error message is first line of stack - * improve: dry up reporter/base test - * fix(reporter/base): explicitly ignore showDiff #1614 - * Add iojs to travis build - * Pass `--allow-natives-syntax` flag to node. - * Support --harmony_classes flag for io.js - * Fix 1556: Update utils.clean to handle newlines in func declarations - * Fix 1606: fix err handling in IE <= 8 and non-ES5 browsers - * Fix 1585: make _mocha executable again - * chore(package.json): add a8m as a contributor - * Fixed broken link on html-cov reporter - * support --es_staging flag - * fix issue where menu overlaps content. - * update contributors in package.json - * Remove trailing whitespace from reporter output - * Remove contributors list from readme - * log third-party reporter errors - * [Fix] Exclude not own properties when looping on options - * fix: support node args in mocha.opts (close #1573) - * fix(reporter/base): string diff - issue #1241 - -2.2.1 / 2015-03-09 -================== - - * Fix passing of args intended for node/iojs. - -2.2.0 / 2015-03-06 -================== - - * Update mocha.js - * Add --fgrep. Use grep for RegExp, fgrep for str - * Ignore async global errors after spec resolution - * Fixing errors that prevent mocha.js from loading in the browser - fixes #1558 - * fix(utils): issue #1558 + make - * add ability to delay root suite; closes #362, closes #1124 - * fix insanity in http tests - * update travis: add node 0.12, add gitter, remove slack - * building - * resolve #1548: ensure the environment's "node" executable is used - * reporters/base: use supports-color to detect colorable term - * travis: use docker containers - * small fix: commander option for --expose-gc - * Ignore asynchronous errors after global failure - * Improve error output when a test fails with a non-error - * updated travis badge, uses svg instead of img - * Allow skip from test context for #332 - * [JSHINT] Unnecessary semicolon fixed in bin/_mocha - * Added a reminder about the done() callback to test timeout error messages - * fixes #1496, in Mocha.run(fn), check if fn exists before executing it, added tests too - * Add Harmony Proxy flag for iojs - * test(utils|ms|*): test existing units - * add support for some iojs flags - * fix(utils.stringify): issue #1229, diff viewer - * Remove slack link - * Prevent multiple 'grep=' querystring params in html reporter - * Use grep as regexp (close #1381) - * utils.stringify should handle objects without an Object prototype - * in runnable test, comparing to undefined error's message rather than a literal - * Fix test running output truncation on async STDIO - * ammended for deprecated customFds option in child_process - -2.1.0 / 2014-12-23 -================== - - * showDiff: don’t stringify strings - * Clean up unused module dependencies. - * Filter zero-length strings from mocha.opts - * only write to stdout in reporters - * Revert "only write to stdout in reporters" - * Print colored output only to a tty - * update summary in README.md - * rename Readme.md/History.md to README.md/HISTORY.md because neurotic - * add .mailmap to fix "git shortlog" or "git summary" output - * fixes #1461: nyan-reporter now respects Base.useColors, fixed bug where Base.color would not return a string when str wasn't a string. - * Use existing test URL builder in failed replay links - * modify .travis.yml: use travis_retry; closes #1449 - * fix -t 0 behavior; closes #1446 - * fix tests (whoops) - * improve diff behavior - * Preserve pathname when linking to individual tests - * Fix test - * Tiny typo in comments fixed - * after hooks now being called on failed tests when using bail, fixes #1093 - * fix throwing undefined/null now makes tests fail, fixes #1395 - * compiler extensions are added as watched extensions, removed non-standard extensions from watch regex, resolves #1221 - * prefix/namespace for suite titles in markdown reporter, fixes #554 - * fix more bad markdown in CONTRIBUTING.md - * fix bad markdown in CONTRIBUTING.md - * add setImmediate/clearImmediate to globals; closes #1435 - * Fix buffer diffs (closes #1132, closes #1433) - * add a CONTRIBUTING.md. closes #882 - * fix intermittent build failures (maybe). closes #1407 - * add Slack notification to .travis.yml - * Fix slack link - * Add slack room to readme - * Update maintainers - * update maintainers and contributors - * resolves #1393: kill children with more effort on SIGINT - * xunit reporter support for optionally writing to a file - * if a reporter has a .done method, call it before exiting - * add support for reporter options - * only write to stdout in reporters - -2.0.0 / 2014-10-21 -================== - - * remove: support for node 0.6.x, 0.4.x - * fix: landing reporter with non ansi characters (#211) - * fix: html reporter - preserve query params when navigating to suites/tests (#1358) - * fix: json stream reporter add error message to failed test - * fix: fixes for visionmedia -> mochajs - * fix: use stdio, fixes node deprecation warnings (#1391) - -1.21.5 / 2014-10-11 -================== - - * fix: build for NodeJS v0.6.x - * fix: do not attempt to highlight syntax when non-HTML reporter is used - * update: escape-string-regexp to 1.0.2. - * fix: botched indentation in canonicalize() - * fix: .gitignore: ignore .patch and .diff files - * fix: changed 'Catched' to 'Caught' in uncaught exception error handler messages - * add: `pending` field for json reporter - * fix: Runner.prototype.uncaught: don't double-end runnables that already have a state. - * fix: --recursive, broken by f0facd2e - * update: replaces escapeRegexp with the escape-string-regexp package. - * update: commander to 2.3.0. - * update: diff to 1.0.8. - * fix: ability to disable syntax highlighting (#1329) - * fix: added empty object to errorJSON() call to catch when no error is present - * fix: never time out after calling enableTimeouts(false) - * fix: timeout(0) will work at suite level (#1300) - * Fix for --watch+only() issue (#888 ) - * fix: respect err.showDiff, add Base reporter test (#810) - -1.22.1-3 / 2014-07-27 -================== - - * fix: disabling timeouts with this.timeout(0) (#1301) - -1.22.1-3 / 2014-07-27 -================== - - * fix: local uis and reporters (#1288) - * fix: building 1.21.0's changes in the browser (#1284) - -1.21.0 / 2014-07-23 -================== - - * add: --no-timeouts option (#1262, #1268) - * add: --*- deprecation node flags (#1217) - * add: --watch-extensions argument (#1247) - * change: spec reporter is default (#1228) - * fix: diff output showing incorrect +/- (#1182) - * fix: diffs of circular structures (#1179) - * fix: re-render the progress bar when progress has changed only (#1151) - * fix support for environments with global and window (#1159) - * fix: reverting to previously defined onerror handler (#1178) - * fix: stringify non error objects passed to done() (#1270) - * fix: using local ui, reporters (#1267) - * fix: cleaning es6 arrows (#1176) - * fix: don't include attrs in failure tag for xunit (#1244) - * fix: fail tests that return a promise if promise is rejected w/o a reason (#1224) - * fix: showing failed tests in doc reporter (#1117) - * fix: dot reporter dots being off (#1204) - * fix: catch empty throws (#1219) - * fix: honoring timeout for sync operations (#1242) - * update: growl to 1.8.0 - -1.20.1 / 2014-06-03 -================== - - * update: should dev dependency to ~4.0.0 (#1231) - -1.20.0 / 2014-05-28 -================== - - * add: filenames to suite objects (#1222) - -1.19.0 / 2014-05-17 -================== - - * add: browser script option to package.json - * add: export file in Mocha.Test objects (#1174) - * add: add docs for wrapped node flags - * fix: mocha.run() to return error status in browser (#1216) - * fix: clean() to show failure details (#1205) - * fix: regex that generates html for new keyword (#1201) - * fix: sibling suites have inherited but separate contexts (#1164) - - -1.18.2 / 2014-03-18 -================== - - * fix: html runner was prevented from using #mocha as the default root el (#1162) - -1.18.1 / 2014-03-18 -================== - - * fix: named before/after hooks in bdd, tdd, qunit interfaces (#1161) - -1.18.0 / 2014-03-13 -================== - - * add: promise support (#329) - * add: named before/after hooks (#966) - -1.17.1 / 2014-01-22 -================== - - * fix: expected messages in should.js (should.js#168) - * fix: expect errno global in node versions < v0.9.11 (#1111) - * fix: unreliable checkGlobals optimization (#1110) - -1.17.0 / 2014-01-09 -================== - - * add: able to require globals (describe, it, etc.) through mocha (#1077) - * fix: abort previous run on --watch change (#1100) - * fix: reset context for each --watch triggered run (#1099) - * fix: error when cli can't resolve path or pattern (#799) - * fix: canonicalize objects before stringifying and diffing them (#1079) - * fix: make CR call behave like carriage return for non tty (#1087) - - -1.16.2 / 2013-12-23 -================== - - * fix: couple issues with ie 8 (#1082, #1081) - * fix: issue running the xunit reporter in browsers (#1068) - * fix: issue with firefox < 3.5 (#725) - - -1.16.1 / 2013-12-19 -================== - - * fix: recompiled for missed changes from the last release - - -1.16.0 / 2013-12-19 -================== - - * add: Runnable.globals(arr) for per test global whitelist (#1046) - * add: mocha.throwError(err) for assertion libs to call (#985) - * remove: --watch's spinner (#806) - * fix: duplicate test output for multi-line specs in spec reporter (#1006) - * fix: gracefully exit on SIGINT (#1063) - * fix expose the specified ui only in the browser (#984) - * fix: ensure process exit code is preserved when using --no-exit (#1059) - * fix: return true from window.onerror handler (#868) - * fix: xunit reporter to use process.stdout.write (#1068) - * fix: utils.clean(str) indentation (#761) - * fix: xunit reporter returning test duration a NaN (#1039) - -1.15.1 / 2013-12-03 -================== - - * fix: recompiled for missed changes from the last release - -1.15.0 / 2013-12-02 -================== - - * add: `--no-exit` to prevent `process.exit()` (#1018) - * fix: using inline diffs (#1044) - * fix: show pending test details in xunit reporter (#1051) - * fix: faster global leak detection (#1024) - * fix: yui compression (#1035) - * fix: wrapping long lines in test results (#1030, #1031) - * fix: handle errors in hooks (#1043) - -1.14.0 / 2013-11-02 -================== - - * add: unified diff (#862) - * add: set MOCHA_COLORS env var to use colors (#965) - * add: able to override tests links in html reporters (#776) - * remove: teamcity reporter (#954) - * update: commander dependency to 2.0.0 (#1010) - * fix: mocha --ui will try to require the ui if not built in, as --reporter does (#1022) - * fix: send cursor commands only if isatty (#184, #1003) - * fix: include assertion message in base reporter (#993, #991) - * fix: consistent return of it, it.only, and describe, describe.only (#840) - -1.13.0 / 2013-09-15 -================== - - * add: sort test files with --sort (#813) - * update: diff depedency to 1.0.7 - * update: glob dependency to 3.2.3 (#927) - * fix: diffs show whitespace differences (#976) - * fix: improve global leaks (#783) - * fix: firefox window.getInterface leak - * fix: accessing iframe via window[iframeIndex] leak - * fix: faster global leak checking - * fix: reporter pending css selector (#970) - -1.12.1 / 2013-08-29 -================== - - * remove test.js from .gitignore - * update included version of ms.js - -1.12.0 / 2013-07-01 -================== - - * add: prevent diffs for differing types. Closes #900 - * add `Mocha.process` hack for phantomjs - * fix: use compilers with requires - * fix regexps in diffs. Closes #890 - * fix xunit NaN on failure. Closes #894 - * fix: strip tab indentation in `clean` utility method - * fix: textmate bundle installation - -1.11.0 / 2013-06-12 -================== - - * add --prof support - * add --harmony support - * add --harmony-generators support - * add "Uncaught " prefix to uncaught exceptions - * add web workers support - * add `suite.skip()` - * change to output # of pending / passing even on failures. Closes #872 - * fix: prevent hooks from being called if we are bailing - * fix `this.timeout(0)` - -1.10.0 / 2013-05-21 -================== - - * add add better globbing support for windows via `glob` module - * add support to pass through flags such as --debug-brk=1234. Closes #852 - * add test.only, test.skip to qunit interface - * change to always use word-based diffs for now. Closes #733 - * change `mocha init` tests.html to index.html - * fix `process` global leak in the browser - * fix: use resolve() instead of join() for --require - * fix: filterLeaks() condition to not consider indices in global object as leaks - * fix: restrict mocha.css styling to #mocha id - * fix: save timer references to avoid Sinon interfering in the browser build. - -1.9.0 / 2013-04-03 -================== - - * add improved setImmediate implementation - * replace --ignore-leaks with --check-leaks - * change default of ignoreLeaks to true. Closes #791 - * remove scrolling for HTML reporter - * fix retina support - * fix tmbundle, restrict to js scope - -1.8.2 / 2013-03-11 -================== - - * add `setImmediate` support for 0.10.x - * fix mocha -w spinner on windows - -1.8.1 / 2013-01-09 -================== - - * fix .bail() arity check causing it to default to true - -1.8.0 / 2013-01-08 -================== - - * add Mocha() options bail support - * add `Mocha#bail()` method - * add instanceof check back for inheriting from Error - * add component.json - * add diff.js to browser build - * update growl - * fix TAP reporter failures comment :D - -1.7.4 / 2012-12-06 -================== - - * add total number of passes and failures to TAP - * remove .bind() calls. re #680 - * fix indexOf. Closes #680 - -1.7.3 / 2012-11-30 -================== - - * fix uncaught error support for the browser - * revert uncaught "fix" which breaks node - -1.7.2 / 2012-11-28 -================== - - * fix uncaught errors to expose the original error message - -1.7.0 / 2012-11-07 -================== - - * add `--async-only` support to prevent false positives for missing `done()` - * add sorting by filename in code coverage - * add HTML 5 doctype to browser template. - * add play button to html reporter to rerun a single test - * add `this.timeout(ms)` as Suite#timeout(ms). Closes #599 - * update growl dependency to 1.6.x - * fix encoding of test-case ?grep. Closes #637 - * fix unicode chars on windows - * fix dom globals in Opera/IE. Closes #243 - * fix markdown reporter a tags - * fix `this.timeout("5s")` support - -1.6.0 / 2012-10-02 -================== - - * add object diffs when `err.showDiff` is present - * add hiding of empty suites when pass/failures are toggled - * add faster `.length` checks to `checkGlobals()` before performing the filter - -1.5.0 / 2012-09-21 -================== - - * add `ms()` to `.slow()` and `.timeout()` - * add `Mocha#checkLeaks()` to re-enable global leak checks - * add `this.slow()` option [aheckmann] - * add tab, CR, LF to error diffs for now - * add faster `.checkGlobals()` solution [guille] - * remove `fn.call()` from reduce util - * remove `fn.call()` from filter util - * fix forEach. Closes #582 - * fix relaying of signals [TooTallNate] - * fix TAP reporter grep number - -1.4.2 / 2012-09-01 -================== - - * add support to multiple `Mocha#globals()` calls, and strings - * add `mocha.reporter()` constructor support [jfirebaugh] - * add `mocha.timeout()` - * move query-string parser to utils.js - * move highlight code to utils.js - * fix third-party reporter support [exogen] - * fix client-side API to match node-side [jfirebaugh] - * fix mocha in iframe [joliss] - -1.4.1 / 2012-08-28 -================== - - * add missing `Markdown` export - * fix `Mocha#grep()`, escape regexp strings - * fix reference error when `devicePixelRatio` is not defined. Closes #549 - -1.4.0 / 2012-08-22 -================== - - * add mkdir -p to `mocha init`. Closes #539 - * add `.only()`. Closes #524 - * add `.skip()`. Closes #524 - * change str.trim() to use utils.trim(). Closes #533 - * fix HTML progress indicator retina display - * fix url-encoding of click-to-grep HTML functionality - -1.3.2 / 2012-08-01 -================== - - * fix exports double-execution regression. Closes #531 - -1.3.1 / 2012-08-01 -================== - - * add passes/failures toggling to HTML reporter - * add pending state to `xit()` and `xdescribe()` [Brian Moore] - * add the @charset "UTF-8"; to fix #522 with FireFox. [Jonathan Creamer] - * add border-bottom to #stats links - * add check for runnable in `Runner#uncaught()`. Closes #494 - * add 0.4 and 0.6 back to travis.yml - * add `-E, --growl-errors` to growl on failures only - * add prefixes to debug() names. Closes #497 - * add `Mocha#invert()` to js api - * change dot reporter to use sexy unicode dots - * fix error when clicking pending test in HTML reporter - * fix `make tm` - -1.3.0 / 2012-07-05 -================== - - * add window scrolling to `HTML` reporter - * add v8 `--trace-*` option support - * add support for custom reports via `--reporter MODULE` - * add `--invert` switch to invert `--grep` matches - * fix export of `Nyan` reporter. Closes #495 - * fix escaping of `HTML` suite titles. Closes #486 - * fix `done()` called multiple times with an error test - * change `--grep` - regexp escape the input - -1.2.2 / 2012-06-28 -================== - - * Added 0.8.0 support - -1.2.1 / 2012-06-25 -================== - - * Added `this.test.error(err)` support to after each hooks. Closes #287 - * Added: export top-level suite on global mocha object (mocha.suite). Closes #448 - * Fixed `js` code block format error in markdown reporter - * Fixed deprecation warning when using `path.existsSync` - * Fixed --globals with wildcard - * Fixed chars in nyan when his head moves back - * Remove `--growl` from test/mocha.opts. Closes #289 - -1.2.0 / 2012-06-17 -================== - - * Added `nyan` reporter [Atsuya Takagi] - * Added `mocha init ` to copy client files - * Added "specify" synonym for "it" [domenic] - * Added global leak wildcard support [nathanbowser] - * Fixed runner emitter leak. closes #432 - * Fixed omission of .js extension. Closes #454 - -1.1.0 / 2012-05-30 -================== - - * Added: check each `mocha(1)` arg for directories to walk - * Added `--recursive` [tricknotes] - * Added `context` for BDD [hokaccha] - * Added styling for new clickable titles - * Added clickable suite titles to HTML reporter - * Added warning when strings are thrown as errors - * Changed: green arrows again in HTML reporter styling - * Changed ul/li elements instead of divs for better copy-and-pasting [joliss] - * Fixed issue #325 - add better grep support to js api - * Fixed: save timer references to avoid Sinon interfering. - -1.0.3 / 2012-04-30 -================== - - * Fixed string diff newlines - * Fixed: removed mocha.css target. Closes #401 - -1.0.2 / 2012-04-25 -================== - - * Added HTML reporter duration. Closes #47 - * Fixed: one postMessage event listener [exogen] - * Fixed: allow --globals to be used multiple times. Closes #100 [brendannee] - * Fixed #158: removes jquery include from browser tests - * Fixed grep. Closes #372 [brendannee] - * Fixed #166 - When grepping don't display the empty suites - * Removed test/browser/style.css. Closes #385 - -1.0.1 / 2012-04-04 -================== - - * Fixed `.timeout()` in hooks - * Fixed: allow callback for `mocha.run()` in client version - * Fixed browser hook error display. Closes #361 - -1.0.0 / 2012-03-24 -================== - - * Added js API. Closes #265 - * Added: initial run of tests with `--watch`. Closes #345 - * Added: mark `location` as a global on the CS. Closes #311 - * Added `markdown` reporter (github flavour) - * Added: scrolling menu to coverage.html. Closes #335 - * Added source line to html report for Safari [Tyson Tate] - * Added "min" reporter, useful for `--watch` [Jakub Nešetřil] - * Added support for arbitrary compilers via . Closes #338 [Ian Young] - * Added Teamcity export to lib/reporters/index [Michael Riley] - * Fixed chopping of first char in error reporting. Closes #334 [reported by topfunky] - * Fixed terrible FF / Opera stack traces - -0.14.1 / 2012-03-06 -================== - - * Added lib-cov to _.npmignore_ - * Added reporter to `mocha.run([reporter])` as argument - * Added some margin-top to the HTML reporter - * Removed jQuery dependency - * Fixed `--watch`: purge require cache. Closes #266 - -0.14.0 / 2012-03-01 -================== - - * Added string diff support for terminal reporters - -0.13.0 / 2012-02-23 -================== - - * Added preliminary test coverage support. Closes #5 - * Added `HTMLCov` reporter - * Added `JSONCov` reporter [kunklejr] - * Added `xdescribe()` and `xit()` to the BDD interface. Closes #263 (docs * Changed: make json reporter output pretty json - * Fixed node-inspector support, swapped `--debug` for `debug` to match node. -needed) -Closes #247 - -0.12.1 / 2012-02-14 -================== - - * Added `npm docs mocha` support [TooTallNate] - * Added a `Context` object used for hook and test-case this. Closes #253 - * Fixed `Suite#clone()` `.ctx` reference. Closes #262 - -0.12.0 / 2012-02-02 -================== - - * Added .coffee `--watch` support. Closes #242 - * Added support to `--require` files relative to the CWD. Closes #241 - * Added quick n dirty syntax highlighting. Closes #248 - * Changed: made HTML progress indicator smaller - * Fixed xunit errors attribute [dhendo] - -0.10.2 / 2012-01-21 -================== - - * Fixed suite count in reporter stats. Closes #222 - * Fixed `done()` after timeout error reporting [Phil Sung] - * Changed the 0-based errors to 1 - -0.10.1 / 2012-01-17 -================== - - * Added support for node 0.7.x - * Fixed absolute path support. Closes #215 [kompiro] - * Fixed `--no-colors` option [Jussi Virtanen] - * Fixed Arial CSS typo in the correct file - -0.10.0 / 2012-01-13 -================== - - * Added `-b, --bail` to exit on first exception [guillermo] - * Added support for `-gc` / `--expose-gc` [TooTallNate] - * Added `qunit`-inspired interface - * Added MIT LICENSE. Closes #194 - * Added: `--watch` all .js in the CWD. Closes #139 - * Fixed `self.test` reference in runner. Closes #189 - * Fixed double reporting of uncaught exceptions after timeout. Closes #195 - -0.8.2 / 2012-01-05 -================== - - * Added test-case context support. Closes #113 - * Fixed exit status. Closes #187 - * Update commander. Closes #190 - -0.8.1 / 2011-12-30 -================== +This has been awhile coming! We needed to feel confident that the next release wouldn't break browser compatibility (e.g. the last few patch releases). + +## Browser Tests in CI + +We now run unit tests against PhantomJS v1.x and an assortment of browsers on [SauceLabs](https://saucelabs.com), including: + +- Internet Explorer v8.0 +- Chrome (latest) +- Firefox (latest) +- Safari (latest) +- Microsoft Edge (latest) + +To accomplish this, we now run Mocha's unit tests (and a handful of integration tests) via [Karma](https://npmjs.com/package/karma) and a modified [karma-mocha](https://npmjs.com/package/karma-mocha). Along the way, we had to solve issue [#880](https://github.com/mochajs/mocha/issues/880) (apologies to [**@mderijcke**](https://github.com/mderijcke) and [**@sukima**](https://github.com/sukima) who had PRs addressing this), as well as replace most usages of [should](https://npmjs.com/package/should) with [expect.js](https://npmjs.com/package/expect.js) for IE8. + +Going forward, when sending PRs, your code will _only_ run against PhantomJS v1.x (and not hit SauceLabs) [because security](https://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests). + +## Node.js 6.x + +Node.js 6.x "just worked" before, but now it's in the CI matrix, so it's "officially" supported. Mocha _still retains support_ for Node.js 0.8.x. + +## "Minor" Release + +You'll see mostly bug fixes below, but also a couple features--as such, it's a "minor" release. + +## TYVM + +Thanks to everyone who contributed, and our fabulous [sponsors and backers](https://opencollective.com/mochajs)! + +- [#2079](https://github.com/mochajs/mocha/issues/2079) - Add browser checks to CI; update [browserify](https://npmjs.com/package/browserify) to v13.0.0 ([@dasilvacontin](https://github.com/dasilvacontin), [@ScottFreeCode](https://github.com/ScottFreeCode), [@boneskull](https://github.com/boneskull) via [`c04c1d7`](https://github.com/mochajs/mocha/commit/c04c1d7), [`0b1e9b3`](https://github.com/mochajs/mocha/commit/0b1e9b3), [`0dde0fa`](https://github.com/mochajs/mocha/commit/0dde0fa), [`f8a3d86`](https://github.com/mochajs/mocha/commit/f8a3d86), [`9e8cbaa`](https://github.com/mochajs/mocha/commit/9e8cbaa)) +- [#880](https://github.com/mochajs/mocha/issues/880) - Make Mocha browserifyable ([@boneskull](https://github.com/boneskull) via [`524862b`](https://github.com/mochajs/mocha/commit/524862b)) +- [#2121](https://github.com/mochajs/mocha/issues/2121) - Update [glob](https://npmjs.com/package/glob) to v3.2.11 ([@astorije](https://github.com/astorije) via [`7920fc4`](https://github.com/mochajs/mocha/commit/7920fc4)) +- [#2126](https://github.com/mochajs/mocha/issues/2126) - Fix dupe error messages in stack trace filter ([@Turbo87](https://github.com/Turbo87) via [`4301caa`](https://github.com/mochajs/mocha/commit/4301caa)) +- [#2109](https://github.com/mochajs/mocha/issues/2109) - Fix certain diffs when objects cannot be coerced into primitives ([@joshlory](https://github.com/joshlory) via [`61fbb7f`](https://github.com/mochajs/mocha/commit/61fbb7f)) +- [#1827](https://github.com/mochajs/mocha/pull/1827) - Fix TWBS/`mocha.css` collisions ([@irnc](https://github.com/irnc) via [`0543798`](https://github.com/mochajs/mocha/commit/0543798)) +- [#1760](https://github.com/mochajs/mocha/issues/1760), [#1936](https://github.com/mochajs/mocha/issues/1936) - Fix `this.skip()` in HTML reporter ([@mislav](https://github.com/mislav) via [`cb4248b`](https://github.com/mochajs/mocha/commit/cb4248b)) +- [#2115](https://github.com/mochajs/mocha/pull/2115) - Fix exceptions thrown from hooks in HTML reporter ([@danielstjules](https://github.com/danielstjules) via [`e290bc0`](https://github.com/mochajs/mocha/commit/e290bc0)) +- [#2089](https://github.com/mochajs/mocha/issues/2089) - Handle Symbol values in `util.stringify()` ([@ryym](https://github.com/ryym) via [`ea61d05`](https://github.com/mochajs/mocha/commit/ea61d05)) +- [#2097](https://github.com/mochajs/mocha/pull/2097) - Fix diff for objects overriding `Object.prototype.hasOwnProperty` ([@mantoni](https://github.com/mantoni) via [`b20fdfe`](https://github.com/mochajs/mocha/commit/b20fdfe)) +- [#2101](https://github.com/mochajs/mocha/pull/2101) - Properly handle non-string "messages" thrown from assertion libraries ([@jkimbo](https://github.com/jkimbo) via [`9c41051`](https://github.com/mochajs/mocha/commit/9c41051)) +- [#2124](https://github.com/mochajs/mocha/pull/2124) - Update [growl](https://npmjs.com/package/growl) ([@benjamine](https://github.com/benjamine) via [`9ae6a85`](https://github.com/mochajs/mocha/commit/9ae6a85)) +- [#2162](https://github.com/mochajs/mocha/pull/2162), [#2205](https://github.com/mochajs/mocha/pull/2205) - JSDoc fixes ([@OlegTsyba](https://github.com/OlegTsyba) via [`8031f20`](https://github.com/mochajs/mocha/commit/8031f20), [@ScottFreeCode](https://github.com/ScottFreeCode) via [`f83b1d9`](https://github.com/mochajs/mocha/commit/f83b1d9)) +- [#2132](https://github.com/mochajs/mocha/issues/2132) - Remove Growl-related cruft ([@julienw](https://github.com/julienw) via [`00d6469`](https://github.com/mochajs/mocha/commit/00d6469)) +- [#2172](https://github.com/mochajs/mocha/pull/2172) - Add [OpenCollective](https://opencollective.com) badge, sponsors & backers ([@xdamman](https://github.com/xdamman), [@boneskull](https://github.com/boneskull) via [`caee94f`](https://github.com/mochajs/mocha/commit/caee94f)) +- [#1841](https://github.com/mochajs/mocha/pull/1841) - Add new logo, banner assets ([@dasilvacontin](https://github.com/dasilvacontin) via [`00fd0e1`](https://github.com/mochajs/mocha/commit/00fd0e1)) +- [#2214](https://github.com/mochajs/mocha/pull/2214) - Update `README.md` header ([@dasilvacontin](https://github.com/dasilvacontin) via [`c0f9be2`](https://github.com/mochajs/mocha/commit/c0f9be2)) +- [#2236](https://github.com/mochajs/mocha/pull/2236) - Better checks for Node.js v0.8 compatibility in CI ([@dasilvacontin](https://github.com/dasilvacontin) via [`ba5637d`](https://github.com/mochajs/mocha/commit/ba5637d)) +- [#2239](https://github.com/mochajs/mocha/issues/2239) - Add Node.js v6.x to CI matrix ([@boneskull](https://github.com/boneskull) via [`3904da4`](https://github.com/mochajs/mocha/commit/3904da4)) + +# 2.4.5 / 2016-01-28 + +- [#2080](https://github.com/mochajs/mocha/issues/2080), [#2078](https://github.com/mochajs/mocha/issues/2078), [#2072](https://github.com/mochajs/mocha/pull/2072), [#2073](https://github.com/mochajs/mocha/pull/2073), [#1200](https://github.com/mochajs/mocha/issues/1200) - Revert changes to console colors in changeset [1192914](https://github.com/mochajs/mocha/commit/119291449cd03a11cdeda9e37cf718a69a012896) and subsequent related changes thereafter. Restores compatibility with IE8 & PhantomJS. See also [mantoni/mochify.js#129](https://github.com/mantoni/mochify.js/issues/129) and [openlayers/ol3#4746](https://github.com/openlayers/ol3/pull/4746) ([@boneskull](https://github.com/boneskull)) +- [#2082](https://github.com/mochajs/mocha/pull/2082) - Fix several test assertions ([@mislav](https://github.com/mislav)) + +# 2.4.4 / 2016-01-27 + +- [#2080](https://github.com/mochajs/mocha/issues/2080) - Fix broken RequireJS compatibility ([@boneskull](https://github.com/boneskull)) + +# 2.4.3 / 2016-01-27 + +- [#2078](https://github.com/mochajs/mocha/issues/2078) - Fix broken IE8 ([@boneskull](https://github.com/boneskull)) + +# 2.4.2 / 2016-01-26 + +- [#2053](https://github.com/mochajs/mocha/pull/2053) - Fix web worker compatibility ([@mislav](https://github.com/mislav)) +- [#2072](https://github.com/mochajs/mocha/pull/2072) - Fix Windows color output ([@thedark1337](https://github.com/thedark1337)) +- [#2073](https://github.com/mochajs/mocha/pull/2073) - Fix colors in `progress` and `landing` reporters ([@gyandeeps](https://github.com/gyandeeps)) + +# 2.4.1 / 2016-01-26 + +- [#2067](https://github.com/mochajs/mocha/pull/2067) - Fix HTML/doc reporter regressions ([@danielstjules](https://github.com/danielstjules)) + +# 2.4.0 / 2016-01-25 + +- [#1945](https://github.com/mochajs/mocha/pull/1945) - Correctly skip tests when skipping in suite's before() ([@ryanshawty](https://github.com/ryanshawty)) +- [#2056](https://github.com/mochajs/mocha/pull/2056) - chore(license): update license year to 2016 ([@pra85](https://github.com/pra85)) +- [#2048](https://github.com/mochajs/mocha/pull/2048) - Fix `this.skip` from spec with HTML reporter ([@mislav](https://github.com/mislav)) +- [#2033](https://github.com/mochajs/mocha/pull/2033) - Update tests for newer versions of should.js ([@tomhughes](https://github.com/tomhughes)) +- [#2037](https://github.com/mochajs/mocha/pull/2037) - Fix for memory leak caused by referenced to deferred test ([@bd82](https://github.com/bd82)) +- [#2038](https://github.com/mochajs/mocha/pull/2038) - Also run Travis-CI on node.js 4 & 5 ([@bd82](https://github.com/bd82)) +- [#2028](https://github.com/mochajs/mocha/pull/2028) - Remove reference to test before afterAll hook runs ([@stonelgh](https://github.com/stonelgh)) +- Bump mkdirp to 0.5.1 to support strict mode ([@danielstjules](https://github.com/danielstjules)) +- [#1977](https://github.com/mochajs/mocha/pull/1977) - safely stringify PhantomJS undefined value ([@ahamid](https://github.com/ahamid)) +- Add the ability to retry tests ([@@longlho]) +- [#1982](https://github.com/mochajs/mocha/pull/1982) - Enable --log-timer-events option [@Alaneor](https://github.com/Alaneor) +- Fix [#1980](https://github.com/mochajs/mocha/issues/1980): Load mocha.opts from bin/mocha and bin/\_mocha ([@danielstjules](https://github.com/danielstjules)) +- [#1976](https://github.com/mochajs/mocha/pull/1976) - Simplify function call ([@iclanzan](https://github.com/iclanzan)) +- [#1963](https://github.com/mochajs/mocha/pull/1963) - Add support --perf-basic-prof ([@robraux](https://github.com/robraux)) +- [#1981](https://github.com/mochajs/mocha/pull/1981) - Fix HTML reporter handling of done and exceptions ([@Standard8](https://github.com/Standard8)) +- [#1993](https://github.com/mochajs/mocha/pull/1993) - propagate "file" property for "exports" interface ([@segrey](https://github.com/segrey)) +- [#1999](https://github.com/mochajs/mocha/pull/1999) - Add support for strict mode ([@tmont](https://github.com/tmont)) +- [#2005](https://github.com/mochajs/mocha/pull/2005) - XUnit Reporter Writes to stdout, falls back to console.log ([@jonnyreeves](https://github.com/jonnyreeves)) +- [#2021](https://github.com/mochajs/mocha/pull/2021) - Fix non ES5 compliant regexp ([@zetaben](https://github.com/zetaben)) +- [#1965] - Don't double install BDD UI ([@cowboyd](https://github.com/cowboyd)) +- [#1995](https://github.com/mochajs/mocha/pull/1995) - Make sure the xunit output dir exists before writing to it ([@ianwremmel](https://github.com/ianwremmel)) +- Use chalk for the base reporter colors; closes [#1200](https://github.com/mochajs/mocha/issues/1200) ([@boneskull](https://github.com/boneskull)) +- Fix requiring custom interfaces ([@jgkim](https://github.com/jgkim)) +- [#1967](https://github.com/mochajs/mocha/pull/1967) Silence Bluebird js warnings ([@krisr](https://github.com/krisr)) + +# 2.3.4 / 2015-11-15 + +- Update debug dependency to 2.2.0 +- remove duplication of mocha.opts on process.argv +- Fix typo in test/reporters/nyan.js + +# 2.3.3 / 2015-09-19 + +- [#1875](https://github.com/mochajs/mocha/issues/1875) - Fix Markdown reporter exceeds maximum call stack size ([@danielstjules](https://github.com/danielstjules)) +- [#1864](https://github.com/mochajs/mocha/issues/1864) - Fix xunit missing output with --reporter-options output ([@danielstjules](https://github.com/danielstjules)) +- [#1846](https://github.com/mochajs/mocha/issues/1846) - Support all harmony flags ([@danielstjules](https://github.com/danielstjules)) +- Fix fragile xunit reporter spec ([@danielstjules](https://github.com/danielstjules)) +- [#1669](https://github.com/mochajs/mocha/issues/1669) - Fix catch uncaught errors outside test suite execution ([@danielstjules](https://github.com/danielstjules)) +- [#1868](https://github.com/mochajs/mocha/issues/1868) - Revert jade to support npm < v1.3.7 ([@danielstjules](https://github.com/danielstjules)) +- [#1766](https://github.com/mochajs/mocha/issues/1766) - Don't remove modules/components from stack trace in the browser ([@danielstjules](https://github.com/danielstjules)) +- [#1798](https://github.com/mochajs/mocha/issues/1798) - Fix correctly attribute mutiple done err with hooks ([@danielstjules](https://github.com/danielstjules)) +- Fix use utils.reduce for IE8 compatibility ([@wsw0108](https://github.com/wsw0108)) +- Some linting errors fixed by [@danielstjules](https://github.com/danielstjules) +- Call the inspect() function if message is not set ([@kevinburke](https://github.com/kevinburke)) + +# 2.3.2 / 2015-09-07 + +- [#1868](https://github.com/mochajs/mocha/issues/1868) - Fix compatibility with older versions of NPM ([@boneskull](https://github.com/boneskull)) + +# 2.3.1 / 2015-09-06 + +- [#1812](https://github.com/mochajs/mocha/issues/1812) - Fix: Bail flag causes before() hooks to be run even after a failure ([@aaroncrows]) + +# 2.3.0 / 2015-08-30 + +- [#553](https://github.com/mochajs/mocha/issues/553) - added --allowUncaught option ([@amsul](https://github.com/amsul)) +- [#1490](https://github.com/mochajs/mocha/issues/1490) - Allow --async-only to be satisfied by returning a promise ([@jlai](https://github.com/jlai)) +- [#1829](https://github.com/mochajs/mocha/issues/1829) - support --max-old-space-size ([@gigadude](https://github.com/gigadude)) +- [#1811](https://github.com/mochajs/mocha/issues/1811) - upgrade Jade dependency ([@outsideris](https://github.com/outsideris)) +- [#1769](https://github.com/mochajs/mocha/issues/1769) - Fix async hook error handling ([@ajaykodali](https://github.com/ajaykodali)) +- [#1230](https://github.com/mochajs/mocha/issues/1230) - More descriptive beforeEach/afterEach messages ([@duncanbeevers](https://github.com/duncanbeevers)) +- [#1787](https://github.com/mochajs/mocha/issues/1787) - Scope loading behaviour instead of using early return ([@aryeguy](https://github.com/aryeguy)) +- [#1789](https://github.com/mochajs/mocha/issues/1789) - Fix: html-runner crashing ([@sunesimonsen](https://github.com/sunesimonsen)) +- [#1749](https://github.com/mochajs/mocha/issues/1749) - Fix maximum call stack error on large amount of tests ([@tinganho](https://github.com/tinganho)) +- [#1230](https://github.com/mochajs/mocha/issues/1230) - Decorate failed hook titles with test title ([@duncanbeevers](https://github.com/duncanbeevers)) +- [#1260](https://github.com/mochajs/mocha/issues/1260) - Build using Browserify ([@ndhoule](https://github.com/ndhoule)) +- [#1728](https://github.com/mochajs/mocha/issues/1728) - Don't use `__proto__` ([@ndhoule](https://github.com/ndhoule)) +- [#1781](https://github.com/mochajs/mocha/issues/1781) - Fix hook error tests ([@glenjamin](https://github.com/glenjamin)) +- [#1754](https://github.com/mochajs/mocha/issues/1754) - Allow boolean --reporter-options ([@papandreou](https://github.com/papandreou)) +- [#1766](https://github.com/mochajs/mocha/issues/1766) - Fix overly aggressive stack suppression ([@moll](https://github.com/moll)) +- [#1752](https://github.com/mochajs/mocha/issues/1752) - Avoid potential infinite loop ([@gsilk](https://github.com/gsilk)) +- [#1761](https://github.com/mochajs/mocha/issues/1761) - Fix problems running under PhantomJS ([@chromakode](https://github.com/chromakode)) +- [#1700](https://github.com/mochajs/mocha/issues/1700) - Fix more problems running under PhantomJS ([@jbnicolai](https://github.com/jbnicolai)) +- [#1774](https://github.com/mochajs/mocha/issues/1774) - Support escaped spaces in CLI options ([@adamgruber](https://github.com/adamgruber)) +- [#1687](https://github.com/mochajs/mocha/issues/1687) - Fix HTML reporter links with special chars ([@benvinegar](https://github.com/benvinegar)) +- [#1359](https://github.com/mochajs/mocha/issues/1359) - Adopt code style and enforce it using ESLint ([@ndhoule](https://github.com/ndhoule) w/ assist from [@jbnicolai](https://github.com/jbnicolai) & [@boneskull](https://github.com/boneskull)) +- various refactors ([@jbnicolai](https://github.com/jbnicolai)) +- [#1758](https://github.com/mochajs/mocha/issues/1758) - Add cross-frame compatible Error checking ([@outdooricon](https://github.com/outdooricon)) +- [#1741](https://github.com/mochajs/mocha/issues/1741) - Remove moot `version` property from bower.json ([@kkirsche](https://github.com/kkirsche)) +- [#1739](https://github.com/mochajs/mocha/issues/1739) - Improve `HISTORY.md` ([@rstacruz](https://github.com/rstacruz)) +- [#1730](https://github.com/mochajs/mocha/issues/1730) - Support more io.js flags ([@ryedog](https://github.com/ryedog)) +- [#1349](https://github.com/mochajs/mocha/issues/1349) - Allow HTML in HTML reporter errors ([@papandreou](https://github.com/papandreou) / [@sunesimonsen](https://github.com/sunesimonsen)) +- [#1572](https://github.com/mochajs/mocha/issues/1572) - Prevent default browser behavior for failure/pass links ([@jschilli](https://github.com/jschilli)) +- [#1630](https://github.com/mochajs/mocha/issues/1630) - Support underscored harmony flags ([@dominicbarnes](https://github.com/dominicbarnes)) +- [#1718](https://github.com/mochajs/mocha/issues/1718) - Support more harmony flags ([@slyg](https://github.com/slyg)) +- [#1689](https://github.com/mochajs/mocha/issues/1689) - Add stack to JSON-stream reporter ([@jonathandelgado](https://github.com/jonathandelgado)) +- [#1654](https://github.com/mochajs/mocha/issues/1654) - Fix `ReferenceError` "location is not defined" ([@jakemmarsh](https://github.com/jakemmarsh)) + +# 2.2.5 / 2015-05-14 + +- [#1699](https://github.com/mochajs/mocha/issues/1699) - Upgrade jsdiff to v1.4.0 ([@nylen](https://github.com/nylen)) +- [#1648](https://github.com/mochajs/mocha/issues/1648) - fix diff background colors in the console ([@nylen](https://github.com/nylen)) +- [#1327](https://github.com/mochajs/mocha/issues/1327) - fix tests running twice, a regression issue. ([#1686](https://github.com/mochajs/mocha/issues/1686), [@danielstjules](https://github.com/danielstjules)) +- [#1675](https://github.com/mochajs/mocha/issues/1675) - add integration tests ([@danielstjules](https://github.com/danielstjules)) +- [#1682](https://github.com/mochajs/mocha/issues/1682) - use a valid SPDX license identifier in package.json ([@kemitchell](https://github.com/kemitchell)) +- [#1660](https://github.com/mochajs/mocha/issues/1660) - fix assertion of invalid dates ([#1661](https://github.com/mochajs/mocha/issues/1661), [@a8m](https://github.com/a8m)) +- [#1241](https://github.com/mochajs/mocha/issues/1241) - fix issue with multiline diffs appearing as single line ([#1655](https://github.com/mochajs/mocha/issues/1655), [@a8m](https://github.com/a8m)) + +# 2.2.4 / 2015-04-08 + +- Load mocha.opts in \_mocha for now (close [#1645](https://github.com/mochajs/mocha/issues/1645)) + +# 2.2.3 / 2015-04-07 + +- fix(reporter/base): string diff - issue [#1241](https://github.com/mochajs/mocha/issues/1241) +- fix(reporter/base): string diff - issue [#1241](https://github.com/mochajs/mocha/issues/1241) +- fix(reporter/base): don't show diffs for errors without expectation +- fix(reporter/base): don't assume error message is first line of stack +- improve: dry up reporter/base test +- fix(reporter/base): explicitly ignore showDiff [#1614](https://github.com/mochajs/mocha/issues/1614) +- Add iojs to travis build +- Pass `--allow-natives-syntax` flag to node. +- Support --harmony_classes flag for io.js +- Fix 1556: Update utils.clean to handle newlines in func declarations +- Fix 1606: fix err handling in IE <= 8 and non-ES5 browsers +- Fix 1585: make \_mocha executable again +- chore(package.json): add a8m as a contributor +- Fixed broken link on html-cov reporter +- support --es_staging flag +- fix issue where menu overlaps content. +- update contributors in package.json +- Remove trailing whitespace from reporter output +- Remove contributors list from readme +- log third-party reporter errors +- [Fix] Exclude not own properties when looping on options +- fix: support node args in mocha.opts (close [#1573](https://github.com/mochajs/mocha/issues/1573)) +- fix(reporter/base): string diff - issue [#1241](https://github.com/mochajs/mocha/issues/1241) + +# 2.2.1 / 2015-03-09 + +- Fix passing of args intended for node/iojs. + +# 2.2.0 / 2015-03-06 + +- Update mocha.js +- Add --fgrep. Use grep for RegExp, fgrep for str +- Ignore async global errors after spec resolution +- Fixing errors that prevent mocha.js from loading in the browser - fixes [#1558](https://github.com/mochajs/mocha/issues/1558) +- fix(utils): issue [#1558](https://github.com/mochajs/mocha/issues/1558) + make +- add ability to delay root suite; closes [#362](https://github.com/mochajs/mocha/issues/362), closes [#1124](https://github.com/mochajs/mocha/issues/1124) +- fix insanity in http tests +- update travis: add node 0.12, add gitter, remove slack +- building +- resolve [#1548](https://github.com/mochajs/mocha/issues/1548): ensure the environment's "node" executable is used +- reporters/base: use supports-color to detect colorable term +- travis: use docker containers +- small fix: commander option for --expose-gc +- Ignore asynchronous errors after global failure +- Improve error output when a test fails with a non-error +- updated travis badge, uses svg instead of img +- Allow skip from test context for [#332](https://github.com/mochajs/mocha/issues/332) +- [JSHINT] Unnecessary semicolon fixed in bin/\_mocha +- Added a reminder about the done() callback to test timeout error messages +- fixes [#1496](https://github.com/mochajs/mocha/issues/1496), in Mocha.run(fn), check if fn exists before executing it, added tests too +- Add Harmony Proxy flag for iojs +- test(utils|ms|\*): test existing units +- add support for some iojs flags +- fix(utils.stringify): issue [#1229](https://github.com/mochajs/mocha/issues/1229), diff viewer +- Remove slack link +- Prevent multiple 'grep=' querystring params in html reporter +- Use grep as regexp (close [#1381](https://github.com/mochajs/mocha/issues/1381)) +- utils.stringify should handle objects without an Object prototype +- in runnable test, comparing to undefined error's message rather than a literal +- Fix test running output truncation on async STDIO +- amended for deprecated customFds option in child_process + +# 2.1.0 / 2014-12-23 + +- showDiff: don’t stringify strings +- Clean up unused module dependencies. +- Filter zero-length strings from mocha.opts +- only write to stdout in reporters +- Revert "only write to stdout in reporters" +- Print colored output only to a tty +- update summary in README.md +- rename Readme.md/History.md to README.md/HISTORY.md because neurotic +- add .mailmap to fix "git shortlog" or "git summary" output +- fixes [#1461](https://github.com/mochajs/mocha/issues/1461): nyan-reporter now respects Base.useColors, fixed bug where Base.color would not return a string when str wasn't a string. +- Use existing test URL builder in failed replay links +- modify .travis.yml: use travis_retry; closes [#1449](https://github.com/mochajs/mocha/issues/1449) +- fix -t 0 behavior; closes [#1446](https://github.com/mochajs/mocha/issues/1446) +- fix tests (whoops) +- improve diff behavior +- Preserve pathname when linking to individual tests +- Fix test +- Tiny typo in comments fixed +- after hooks now being called on failed tests when using bail, fixes [#1093](https://github.com/mochajs/mocha/issues/1093) +- fix throwing undefined/null now makes tests fail, fixes [#1395](https://github.com/mochajs/mocha/issues/1395) +- compiler extensions are added as watched extensions, removed non-standard extensions from watch regex, resolves [#1221](https://github.com/mochajs/mocha/issues/1221) +- prefix/namespace for suite titles in markdown reporter, fixes [#554](https://github.com/mochajs/mocha/issues/554) +- fix more bad markdown in CONTRIBUTING.md +- fix bad markdown in CONTRIBUTING.md +- add setImmediate/clearImmediate to globals; closes [#1435](https://github.com/mochajs/mocha/issues/1435) +- Fix buffer diffs (closes [#1132](https://github.com/mochajs/mocha/issues/1132), closes [#1433](https://github.com/mochajs/mocha/issues/1433)) +- add a CONTRIBUTING.md. closes [#882](https://github.com/mochajs/mocha/issues/882) +- fix intermittent build failures (maybe). closes [#1407](https://github.com/mochajs/mocha/issues/1407) +- add Slack notification to .travis.yml +- Fix slack link +- Add slack room to readme +- Update maintainers +- update maintainers and contributors +- resolves [#1393](https://github.com/mochajs/mocha/issues/1393): kill children with more effort on SIGINT +- xunit reporter support for optionally writing to a file +- if a reporter has a .done method, call it before exiting +- add support for reporter options +- only write to stdout in reporters + +# 2.0.0 / 2014-10-21 + +- remove: support for node 0.6.x, 0.4.x +- fix: landing reporter with non ansi characters ([#211](https://github.com/mochajs/mocha/issues/211)) +- fix: html reporter - preserve query params when navigating to suites/tests ([#1358](https://github.com/mochajs/mocha/issues/1358)) +- fix: json stream reporter add error message to failed test +- fix: fixes for visionmedia -> mochajs +- fix: use stdio, fixes node deprecation warnings ([#1391](https://github.com/mochajs/mocha/issues/1391)) + +# 1.21.5 / 2014-10-11 + +- fix: build for NodeJS v0.6.x +- fix: do not attempt to highlight syntax when non-HTML reporter is used +- update: escape-string-regexp to 1.0.2. +- fix: botched indentation in canonicalize() +- fix: .gitignore: ignore .patch and .diff files +- fix: changed 'Catched' to 'Caught' in uncaught exception error handler messages +- add: `pending` field for json reporter +- fix: Runner.prototype.uncaught: don't double-end runnables that already have a state. +- fix: --recursive, broken by [`f0facd2`](https://github.com/mochajs/mocha/commit/f0facd2e) +- update: replaces escapeRegexp with the escape-string-regexp package. +- update: commander to 2.3.0. +- update: diff to 1.0.8. +- fix: ability to disable syntax highlighting ([#1329](https://github.com/mochajs/mocha/issues/1329)) +- fix: added empty object to errorJSON() call to catch when no error is present +- fix: never time out after calling enableTimeouts(false) +- fix: timeout(0) will work at suite level ([#1300](https://github.com/mochajs/mocha/issues/1300)) +- Fix for --watch+only() issue ([#888](https://github.com/mochajs/mocha/issues/888) ) +- fix: respect err.showDiff, add Base reporter test ([#810](https://github.com/mochajs/mocha/issues/810)) + +# 1.22.1-3 / 2014-07-27 + +- fix: disabling timeouts with this.timeout(0) ([#1301](https://github.com/mochajs/mocha/issues/1301)) + +# 1.22.1-3 / 2014-07-27 + +- fix: local uis and reporters ([#1288](https://github.com/mochajs/mocha/issues/1288)) +- fix: building 1.21.0's changes in the browser ([#1284](https://github.com/mochajs/mocha/issues/1284)) + +# 1.21.0 / 2014-07-23 + +- add: --no-timeouts option ([#1262](https://github.com/mochajs/mocha/issues/1262), [#1268](https://github.com/mochajs/mocha/issues/1268)) +- add: --\*- deprecation node flags ([#1217](https://github.com/mochajs/mocha/issues/1217)) +- add: --watch-extensions argument ([#1247](https://github.com/mochajs/mocha/issues/1247)) +- change: spec reporter is default ([#1228](https://github.com/mochajs/mocha/issues/1228)) +- fix: diff output showing incorrect +/- ([#1182](https://github.com/mochajs/mocha/issues/1182)) +- fix: diffs of circular structures ([#1179](https://github.com/mochajs/mocha/issues/1179)) +- fix: re-render the progress bar when progress has changed only ([#1151](https://github.com/mochajs/mocha/issues/1151)) +- fix support for environments with global and window ([#1159](https://github.com/mochajs/mocha/issues/1159)) +- fix: reverting to previously defined onerror handler ([#1178](https://github.com/mochajs/mocha/issues/1178)) +- fix: stringify non error objects passed to done() ([#1270](https://github.com/mochajs/mocha/issues/1270)) +- fix: using local ui, reporters ([#1267](https://github.com/mochajs/mocha/issues/1267)) +- fix: cleaning es6 arrows ([#1176](https://github.com/mochajs/mocha/issues/1176)) +- fix: don't include attrs in failure tag for xunit ([#1244](https://github.com/mochajs/mocha/issues/1244)) +- fix: fail tests that return a promise if promise is rejected w/o a reason ([#1224](https://github.com/mochajs/mocha/issues/1224)) +- fix: showing failed tests in doc reporter ([#1117](https://github.com/mochajs/mocha/issues/1117)) +- fix: dot reporter dots being off ([#1204](https://github.com/mochajs/mocha/issues/1204)) +- fix: catch empty throws ([#1219](https://github.com/mochajs/mocha/issues/1219)) +- fix: honoring timeout for sync operations ([#1242](https://github.com/mochajs/mocha/issues/1242)) +- update: growl to 1.8.0 + +# 1.20.1 / 2014-06-03 + +- update: should dev dependency to ~4.0.0 ([#1231](https://github.com/mochajs/mocha/issues/1231)) + +# 1.20.0 / 2014-05-28 + +- add: filenames to suite objects ([#1222](https://github.com/mochajs/mocha/issues/1222)) + +# 1.19.0 / 2014-05-17 + +- add: browser script option to package.json +- add: export file in Mocha.Test objects ([#1174](https://github.com/mochajs/mocha/issues/1174)) +- add: add docs for wrapped node flags +- fix: mocha.run() to return error status in browser ([#1216](https://github.com/mochajs/mocha/issues/1216)) +- fix: clean() to show failure details ([#1205](https://github.com/mochajs/mocha/issues/1205)) +- fix: regex that generates html for new keyword ([#1201](https://github.com/mochajs/mocha/issues/1201)) +- fix: sibling suites have inherited but separate contexts ([#1164](https://github.com/mochajs/mocha/issues/1164)) + +# 1.18.2 / 2014-03-18 + +- fix: html runner was prevented from using #mocha as the default root el ([#1162](https://github.com/mochajs/mocha/issues/1162)) + +# 1.18.1 / 2014-03-18 + +- fix: named before/after hooks in bdd, tdd, qunit interfaces ([#1161](https://github.com/mochajs/mocha/issues/1161)) + +# 1.18.0 / 2014-03-13 + +- add: promise support ([#329](https://github.com/mochajs/mocha/issues/329)) +- add: named before/after hooks ([#966](https://github.com/mochajs/mocha/issues/966)) + +# 1.17.1 / 2014-01-22 + +- fix: expected messages in should.js (should.js#168) +- fix: expect errno global in node versions < v0.9.11 ([#1111](https://github.com/mochajs/mocha/issues/1111)) +- fix: unreliable checkGlobals optimization ([#1110](https://github.com/mochajs/mocha/issues/1110)) + +# 1.17.0 / 2014-01-09 + +- add: able to require globals (describe, it, etc.) through mocha ([#1077](https://github.com/mochajs/mocha/issues/1077)) +- fix: abort previous run on --watch change ([#1100](https://github.com/mochajs/mocha/issues/1100)) +- fix: reset context for each --watch triggered run ([#1099](https://github.com/mochajs/mocha/issues/1099)) +- fix: error when cli can't resolve path or pattern ([#799](https://github.com/mochajs/mocha/issues/799)) +- fix: canonicalize objects before stringifying and diffing them ([#1079](https://github.com/mochajs/mocha/issues/1079)) +- fix: make CR call behave like carriage return for non tty ([#1087](https://github.com/mochajs/mocha/issues/1087)) + +# 1.16.2 / 2013-12-23 + +- fix: couple issues with ie 8 ([#1082](https://github.com/mochajs/mocha/issues/1082), [#1081](https://github.com/mochajs/mocha/issues/1081)) +- fix: issue running the xunit reporter in browsers ([#1068](https://github.com/mochajs/mocha/issues/1068)) +- fix: issue with firefox < 3.5 ([#725](https://github.com/mochajs/mocha/issues/725)) + +# 1.16.1 / 2013-12-19 + +- fix: recompiled for missed changes from the last release + +# 1.16.0 / 2013-12-19 + +- add: Runnable.globals(arr) for per test global whitelist ([#1046](https://github.com/mochajs/mocha/issues/1046)) +- add: mocha.throwError(err) for assertion libs to call ([#985](https://github.com/mochajs/mocha/issues/985)) +- remove: --watch's spinner ([#806](https://github.com/mochajs/mocha/issues/806)) +- fix: duplicate test output for multi-line specs in spec reporter ([#1006](https://github.com/mochajs/mocha/issues/1006)) +- fix: gracefully exit on SIGINT ([#1063](https://github.com/mochajs/mocha/issues/1063)) +- fix expose the specified ui only in the browser ([#984](https://github.com/mochajs/mocha/issues/984)) +- fix: ensure process exit code is preserved when using --no-exit ([#1059](https://github.com/mochajs/mocha/issues/1059)) +- fix: return true from window.onerror handler ([#868](https://github.com/mochajs/mocha/issues/868)) +- fix: xunit reporter to use process.stdout.write ([#1068](https://github.com/mochajs/mocha/issues/1068)) +- fix: utils.clean(str) indentation ([#761](https://github.com/mochajs/mocha/issues/761)) +- fix: xunit reporter returning test duration a NaN ([#1039](https://github.com/mochajs/mocha/issues/1039)) + +# 1.15.1 / 2013-12-03 + +- fix: recompiled for missed changes from the last release + +# 1.15.0 / 2013-12-02 + +- add: `--no-exit` to prevent `process.exit()` ([#1018](https://github.com/mochajs/mocha/issues/1018)) +- fix: using inline diffs ([#1044](https://github.com/mochajs/mocha/issues/1044)) +- fix: show pending test details in xunit reporter ([#1051](https://github.com/mochajs/mocha/issues/1051)) +- fix: faster global leak detection ([#1024](https://github.com/mochajs/mocha/issues/1024)) +- fix: yui compression ([#1035](https://github.com/mochajs/mocha/issues/1035)) +- fix: wrapping long lines in test results ([#1030](https://github.com/mochajs/mocha/issues/1030), [#1031](https://github.com/mochajs/mocha/issues/1031)) +- fix: handle errors in hooks ([#1043](https://github.com/mochajs/mocha/issues/1043)) + +# 1.14.0 / 2013-11-02 + +- add: unified diff ([#862](https://github.com/mochajs/mocha/issues/862)) +- add: set MOCHA_COLORS env var to use colors ([#965](https://github.com/mochajs/mocha/issues/965)) +- add: able to override tests links in html reporters ([#776](https://github.com/mochajs/mocha/issues/776)) +- remove: teamcity reporter ([#954](https://github.com/mochajs/mocha/issues/954)) +- update: commander dependency to 2.0.0 ([#1010](https://github.com/mochajs/mocha/issues/1010)) +- fix: mocha --ui will try to require the ui if not built in, as --reporter does ([#1022](https://github.com/mochajs/mocha/issues/1022)) +- fix: send cursor commands only if isatty ([#184](https://github.com/mochajs/mocha/issues/184), [#1003](https://github.com/mochajs/mocha/issues/1003)) +- fix: include assertion message in base reporter ([#993](https://github.com/mochajs/mocha/issues/993), [#991](https://github.com/mochajs/mocha/issues/991)) +- fix: consistent return of it, it.only, and describe, describe.only ([#840](https://github.com/mochajs/mocha/issues/840)) + +# 1.13.0 / 2013-09-15 + +- add: sort test files with --sort ([#813](https://github.com/mochajs/mocha/issues/813)) +- update: diff dependency to 1.0.7 +- update: glob dependency to 3.2.3 ([#927](https://github.com/mochajs/mocha/issues/927)) +- fix: diffs show whitespace differences ([#976](https://github.com/mochajs/mocha/issues/976)) +- fix: improve global leaks ([#783](https://github.com/mochajs/mocha/issues/783)) +- fix: firefox window.getInterface leak +- fix: accessing iframe via window[iframeIndex] leak +- fix: faster global leak checking +- fix: reporter pending css selector ([#970](https://github.com/mochajs/mocha/issues/970)) + +# 1.12.1 / 2013-08-29 + +- remove test.js from .gitignore +- update included version of ms.js + +# 1.12.0 / 2013-07-01 + +- add: prevent diffs for differing types. Closes [#900](https://github.com/mochajs/mocha/issues/900) +- add `Mocha.process` hack for phantomjs +- fix: use compilers with requires +- fix regexps in diffs. Closes [#890](https://github.com/mochajs/mocha/issues/890) +- fix xunit NaN on failure. Closes [#894](https://github.com/mochajs/mocha/issues/894) +- fix: strip tab indentation in `clean` utility method +- fix: textmate bundle installation + +# 1.11.0 / 2013-06-12 + +- add --prof support +- add --harmony support +- add --harmony-generators support +- add "Uncaught " prefix to uncaught exceptions +- add web workers support +- add `suite.skip()` +- change to output # of pending / passing even on failures. Closes [#872](https://github.com/mochajs/mocha/issues/872) +- fix: prevent hooks from being called if we are bailing +- fix `this.timeout(0)` + +# 1.10.0 / 2013-05-21 + +- add add better globbing support for windows via `glob` module +- add support to pass through flags such as --debug-brk=1234. Closes [#852](https://github.com/mochajs/mocha/issues/852) +- add test.only, test.skip to qunit interface +- change to always use word-based diffs for now. Closes [#733](https://github.com/mochajs/mocha/issues/733) +- change `mocha init` tests.html to index.html +- fix `process` global leak in the browser +- fix: use resolve() instead of join() for --require +- fix: filterLeaks() condition to not consider indices in global object as leaks +- fix: restrict mocha.css styling to #mocha id +- fix: save timer references to avoid Sinon interfering in the browser build. + +# 1.9.0 / 2013-04-03 + +- add improved setImmediate implementation +- replace --ignore-leaks with --check-leaks +- change default of ignoreLeaks to true. Closes [#791](https://github.com/mochajs/mocha/issues/791) +- remove scrolling for HTML reporter +- fix retina support +- fix tmbundle, restrict to js scope + +# 1.8.2 / 2013-03-11 + +- add `setImmediate` support for 0.10.x +- fix mocha -w spinner on windows + +# 1.8.1 / 2013-01-09 + +- fix .bail() arity check causing it to default to true + +# 1.8.0 / 2013-01-08 + +- add Mocha() options bail support +- add `Mocha#bail()` method +- add instanceof check back for inheriting from Error +- add component.json +- add diff.js to browser build +- update growl +- fix TAP reporter failures comment :D + +# 1.7.4 / 2012-12-06 + +- add total number of passes and failures to TAP +- remove .bind() calls. re [#680](https://github.com/mochajs/mocha/issues/680) +- fix indexOf. Closes [#680](https://github.com/mochajs/mocha/issues/680) + +# 1.7.3 / 2012-11-30 + +- fix uncaught error support for the browser +- revert uncaught "fix" which breaks node + +# 1.7.2 / 2012-11-28 + +- fix uncaught errors to expose the original error message + +# 1.7.0 / 2012-11-07 + +- add `--async-only` support to prevent false positives for missing `done()` +- add sorting by filename in code coverage +- add HTML 5 doctype to browser template. +- add play button to html reporter to rerun a single test +- add `this.timeout(ms)` as Suite#timeout(ms). Closes [#599](https://github.com/mochajs/mocha/issues/599) +- update growl dependency to 1.6.x +- fix encoding of test-case ?grep. Closes [#637](https://github.com/mochajs/mocha/issues/637) +- fix unicode chars on windows +- fix dom globals in Opera/IE. Closes [#243](https://github.com/mochajs/mocha/issues/243) +- fix markdown reporter a tags +- fix `this.timeout("5s")` support + +# 1.6.0 / 2012-10-02 + +- add object diffs when `err.showDiff` is present +- add hiding of empty suites when pass/failures are toggled +- add faster `.length` checks to `checkGlobals()` before performing the filter + +# 1.5.0 / 2012-09-21 + +- add `ms()` to `.slow()` and `.timeout()` +- add `Mocha#checkLeaks()` to re-enable global leak checks +- add `this.slow()` option [aheckmann] +- add tab, CR, LF to error diffs for now +- add faster `.checkGlobals()` solution [guille] +- remove `fn.call()` from reduce util +- remove `fn.call()` from filter util +- fix forEach. Closes [#582](https://github.com/mochajs/mocha/issues/582) +- fix relaying of signals [TooTallNate] +- fix TAP reporter grep number + +# 1.4.2 / 2012-09-01 + +- add support to multiple `Mocha#globals()` calls, and strings +- add `mocha.reporter()` constructor support [jfirebaugh] +- add `mocha.timeout()` +- move query-string parser to utils.js +- move highlight code to utils.js +- fix third-party reporter support [exogen] +- fix client-side API to match node-side [jfirebaugh] +- fix mocha in iframe [joliss] + +# 1.4.1 / 2012-08-28 + +- add missing `Markdown` export +- fix `Mocha#grep()`, escape regexp strings +- fix reference error when `devicePixelRatio` is not defined. Closes [#549](https://github.com/mochajs/mocha/issues/549) + +# 1.4.0 / 2012-08-22 + +- add mkdir -p to `mocha init`. Closes [#539](https://github.com/mochajs/mocha/issues/539) +- add `.only()`. Closes [#524](https://github.com/mochajs/mocha/issues/524) +- add `.skip()`. Closes [#524](https://github.com/mochajs/mocha/issues/524) +- change str.trim() to use utils.trim(). Closes [#533](https://github.com/mochajs/mocha/issues/533) +- fix HTML progress indicator retina display +- fix url-encoding of click-to-grep HTML functionality + +# 1.3.2 / 2012-08-01 + +- fix exports double-execution regression. Closes [#531](https://github.com/mochajs/mocha/issues/531) + +# 1.3.1 / 2012-08-01 + +- add passes/failures toggling to HTML reporter +- add pending state to `xit()` and `xdescribe()` [Brian Moore] +- add the [**@charset**](https://github.com/charset) "UTF-8"; to fix [#522](https://github.com/mochajs/mocha/issues/522) with FireFox. [Jonathan Creamer] +- add border-bottom to #stats links +- add check for runnable in `Runner#uncaught()`. Closes [#494](https://github.com/mochajs/mocha/issues/494) +- add 0.4 and 0.6 back to travis.yml +- add `-E, --growl-errors` to growl on failures only +- add prefixes to debug() names. Closes [#497](https://github.com/mochajs/mocha/issues/497) +- add `Mocha#invert()` to js api +- change dot reporter to use sexy unicode dots +- fix error when clicking pending test in HTML reporter +- fix `make tm` + +# 1.3.0 / 2012-07-05 + +- add window scrolling to `HTML` reporter +- add v8 `--trace-*` option support +- add support for custom reports via `--reporter MODULE` +- add `--invert` switch to invert `--grep` matches +- fix export of `Nyan` reporter. Closes [#495](https://github.com/mochajs/mocha/issues/495) +- fix escaping of `HTML` suite titles. Closes [#486](https://github.com/mochajs/mocha/issues/486) +- fix `done()` called multiple times with an error test +- change `--grep` - regexp escape the input + +# 1.2.2 / 2012-06-28 + +- Added 0.8.0 support + +# 1.2.1 / 2012-06-25 + +- Added `this.test.error(err)` support to after each hooks. Closes [#287](https://github.com/mochajs/mocha/issues/287) +- Added: export top-level suite on global mocha object (mocha.suite). Closes [#448](https://github.com/mochajs/mocha/issues/448) +- Fixed `js` code block format error in markdown reporter +- Fixed deprecation warning when using `path.existsSync` +- Fixed --globals with wildcard +- Fixed chars in nyan when his head moves back +- Remove `--growl` from test/mocha.opts. Closes [#289](https://github.com/mochajs/mocha/issues/289) + +# 1.2.0 / 2012-06-17 + +- Added `nyan` reporter [Atsuya Takagi] +- Added `mocha init ` to copy client files +- Added "specify" synonym for "it" [domenic] +- Added global leak wildcard support [nathanbowser] +- Fixed runner emitter leak. closes [#432](https://github.com/mochajs/mocha/issues/432) +- Fixed omission of .js extension. Closes [#454](https://github.com/mochajs/mocha/issues/454) + +# 1.1.0 / 2012-05-30 + +- Added: check each `mocha(1)` arg for directories to walk +- Added `--recursive` [tricknotes] +- Added `context` for BDD [hokaccha] +- Added styling for new clickable titles +- Added clickable suite titles to HTML reporter +- Added warning when strings are thrown as errors +- Changed: green arrows again in HTML reporter styling +- Changed ul/li elements instead of divs for better copy-and-pasting [joliss] +- Fixed issue [#325](https://github.com/mochajs/mocha/issues/325) - add better grep support to js api +- Fixed: save timer references to avoid Sinon interfering. + +# 1.0.3 / 2012-04-30 + +- Fixed string diff newlines +- Fixed: removed mocha.css target. Closes [#401](https://github.com/mochajs/mocha/issues/401) + +# 1.0.2 / 2012-04-25 + +- Added HTML reporter duration. Closes [#47](https://github.com/mochajs/mocha/issues/47) +- Fixed: one postMessage event listener [exogen] +- Fixed: allow --globals to be used multiple times. Closes [#100](https://github.com/mochajs/mocha/issues/100) [brendannee] +- Fixed [#158](https://github.com/mochajs/mocha/issues/158): removes jquery include from browser tests +- Fixed grep. Closes [#372](https://github.com/mochajs/mocha/issues/372) [brendannee] +- Fixed [#166](https://github.com/mochajs/mocha/issues/166) - When grepping don't display the empty suites +- Removed test/browser/style.css. Closes [#385](https://github.com/mochajs/mocha/issues/385) + +# 1.0.1 / 2012-04-04 + +- Fixed `.timeout()` in hooks +- Fixed: allow callback for `mocha.run()` in client version +- Fixed browser hook error display. Closes [#361](https://github.com/mochajs/mocha/issues/361) + +# 1.0.0 / 2012-03-24 + +- Added js API. Closes [#265](https://github.com/mochajs/mocha/issues/265) +- Added: initial run of tests with `--watch`. Closes [#345](https://github.com/mochajs/mocha/issues/345) +- Added: mark `location` as a global on the CS. Closes [#311](https://github.com/mochajs/mocha/issues/311) +- Added `markdown` reporter (github flavour) +- Added: scrolling menu to coverage.html. Closes [#335](https://github.com/mochajs/mocha/issues/335) +- Added source line to html report for Safari [Tyson Tate] +- Added "min" reporter, useful for `--watch` [Jakub Nešetřil] +- Added support for arbitrary compilers via . Closes [#338](https://github.com/mochajs/mocha/issues/338) [Ian Young] +- Added Teamcity export to lib/reporters/index [Michael Riley] +- Fixed chopping of first char in error reporting. Closes [#334](https://github.com/mochajs/mocha/issues/334) [reported by topfunky] +- Fixed terrible FF / Opera stack traces + +# 0.14.1 / 2012-03-06 + +- Added lib-cov to _.npmignore_ +- Added reporter to `mocha.run([reporter])` as argument +- Added some margin-top to the HTML reporter +- Removed jQuery dependency +- Fixed `--watch`: purge require cache. Closes [#266](https://github.com/mochajs/mocha/issues/266) + +# 0.14.0 / 2012-03-01 + +- Added string diff support for terminal reporters + +# 0.13.0 / 2012-02-23 + +- Added preliminary test coverage support. Closes [#5](https://github.com/mochajs/mocha/issues/5) +- Added `HTMLCov` reporter +- Added `JSONCov` reporter [kunklejr] +- Added `xdescribe()` and `xit()` to the BDD interface. Closes [#263](https://github.com/mochajs/mocha/issues/263) (docs \* Changed: make json reporter output pretty json +- Fixed node-inspector support, swapped `--debug` for `debug` to match node. Closes [#247](https://github.com/mochajs/mocha/issues/247) + +# 0.12.1 / 2012-02-14 + +- Added `npm docs mocha` support [TooTallNate] +- Added a `Context` object used for hook and test-case this. Closes [#253](https://github.com/mochajs/mocha/issues/253) +- Fixed `Suite#clone()` `.ctx` reference. Closes [#262](https://github.com/mochajs/mocha/issues/262) + +# 0.12.0 / 2012-02-02 + +- Added .coffee `--watch` support. Closes [#242](https://github.com/mochajs/mocha/issues/242) +- Added support to `--require` files relative to the CWD. Closes [#241](https://github.com/mochajs/mocha/issues/241) +- Added quick n dirty syntax highlighting. Closes [#248](https://github.com/mochajs/mocha/issues/248) +- Changed: made HTML progress indicator smaller +- Fixed xunit errors attribute [dhendo] + +# 0.10.2 / 2012-01-21 + +- Fixed suite count in reporter stats. Closes [#222](https://github.com/mochajs/mocha/issues/222) +- Fixed `done()` after timeout error reporting [Phil Sung] +- Changed the 0-based errors to 1 + +# 0.10.1 / 2012-01-17 + +- Added support for node 0.7.x +- Fixed absolute path support. Closes [#215](https://github.com/mochajs/mocha/issues/215) [kompiro] +- Fixed `--no-colors` option [Jussi Virtanen] +- Fixed Arial CSS typo in the correct file + +# 0.10.0 / 2012-01-13 + +- Added `-b, --bail` to exit on first exception [guillermo] +- Added support for `-gc` / `--expose-gc` [TooTallNate] +- Added `qunit`-inspired interface +- Added MIT LICENSE. Closes [#194](https://github.com/mochajs/mocha/issues/194) +- Added: `--watch` all .js in the CWD. Closes [#139](https://github.com/mochajs/mocha/issues/139) +- Fixed `self.test` reference in runner. Closes [#189](https://github.com/mochajs/mocha/issues/189) +- Fixed double reporting of uncaught exceptions after timeout. Closes [#195](https://github.com/mochajs/mocha/issues/195) + +# 0.8.2 / 2012-01-05 + +- Added test-case context support. Closes [#113](https://github.com/mochajs/mocha/issues/113) +- Fixed exit status. Closes [#187](https://github.com/mochajs/mocha/issues/187) +- Update commander. Closes [#190](https://github.com/mochajs/mocha/issues/190) + +# 0.8.1 / 2011-12-30 + +- Fixed reporting of uncaught exceptions. Closes [#183](https://github.com/mochajs/mocha/issues/183) +- Fixed error message defaulting [indutny] +- Changed mocha(1) from bash to node for windows [Nathan Rajlich] + +# 0.8.0 / 2011-12-28 + +- Added `XUnit` reporter [FeeFighters/visionmedia] +- Added `say(1)` notification support [Maciej Małecki] +- Changed: fail when done() is invoked with a non-Error. Closes [#171](https://github.com/mochajs/mocha/issues/171) +- Fixed `err.stack`, defaulting to message. Closes [#180](https://github.com/mochajs/mocha/issues/180) +- Fixed: `make tm` mkdir -p the dest. Closes [#137](https://github.com/mochajs/mocha/issues/137) +- Fixed mocha(1) --help bin name +- Fixed `-d` for `--debug` support - * Fixed reporting of uncaught exceptions. Closes #183 - * Fixed error message defaulting [indutny] - * Changed mocha(1) from bash to node for windows [Nathan Rajlich] - -0.8.0 / 2011-12-28 -================== - - * Added `XUnit` reporter [FeeFighters/visionmedia] - * Added `say(1)` notification support [Maciej Małecki] - * Changed: fail when done() is invoked with a non-Error. Closes #171 - * Fixed `err.stack`, defaulting to message. Closes #180 - * Fixed: `make tm` mkdir -p the dest. Closes #137 - * Fixed mocha(1) --help bin name - * Fixed `-d` for `--debug` support - -0.7.1 / 2011-12-22 -================== +# 0.7.1 / 2011-12-22 - * Removed `mocha-debug(1)`, use `mocha --debug` - * Fixed CWD relative requires - * Fixed growl issue on windows [Raynos] - * Fixed: platform specific line endings [TooTallNate] - * Fixed: escape strings in HTML reporter. Closes #164 +- Removed `mocha-debug(1)`, use `mocha --debug` +- Fixed CWD relative requires +- Fixed growl issue on windows [Raynos] +- Fixed: platform specific line endings [TooTallNate] +- Fixed: escape strings in HTML reporter. Closes [#164](https://github.com/mochajs/mocha/issues/164) -0.7.0 / 2011-12-18 -================== +# 0.7.0 / 2011-12-18 - * Added support for IE{7,8} [guille] - * Changed: better browser nextTick implementation [guille] +- Added support for IE{7,8} [guille] +- Changed: better browser nextTick implementation [guille] -0.6.0 / 2011-12-18 -================== +# 0.6.0 / 2011-12-18 - * Added setZeroTimeout timeout for browser (nicer stack traces). Closes #153 - * Added "view source" on hover for HTML reporter to make it obvious - * Changed: replace custom growl with growl lib - * Fixed duplicate reporting for HTML reporter. Closes #154 - * Fixed silent hook errors in the HTML reporter. Closes #150 +- Added setZeroTimeout timeout for browser (nicer stack traces). Closes [#153](https://github.com/mochajs/mocha/issues/153) +- Added "view source" on hover for HTML reporter to make it obvious +- Changed: replace custom growl with growl lib +- Fixed duplicate reporting for HTML reporter. Closes [#154](https://github.com/mochajs/mocha/issues/154) +- Fixed silent hook errors in the HTML reporter. Closes [#150](https://github.com/mochajs/mocha/issues/150) -0.5.0 / 2011-12-14 -================== +# 0.5.0 / 2011-12-14 - * Added: push node_modules directory onto module.paths for relative require Closes #93 - * Added teamcity reporter [blindsey] - * Fixed: recover from uncaught exceptions for tests. Closes #94 - * Fixed: only emit "test end" for uncaught within test, not hook +- Added: push node_modules directory onto module.paths for relative require Closes [#93](https://github.com/mochajs/mocha/issues/93) +- Added teamcity reporter [blindsey] +- Fixed: recover from uncaught exceptions for tests. Closes [#94](https://github.com/mochajs/mocha/issues/94) +- Fixed: only emit "test end" for uncaught within test, not hook -0.4.0 / 2011-12-14 -================== +# 0.4.0 / 2011-12-14 - * Added support for test-specific timeouts via `this.timeout(0)`. Closes #134 - * Added guillermo's client-side EventEmitter. Closes #132 - * Added progress indicator to the HTML reporter - * Fixed slow browser tests. Closes #135 - * Fixed "suite" color for light terminals - * Fixed `require()` leak spotted by [guillermo] +- Added support for test-specific timeouts via `this.timeout(0)`. Closes [#134](https://github.com/mochajs/mocha/issues/134) +- Added guillermo's client-side EventEmitter. Closes [#132](https://github.com/mochajs/mocha/issues/132) +- Added progress indicator to the HTML reporter +- Fixed slow browser tests. Closes [#135](https://github.com/mochajs/mocha/issues/135) +- Fixed "suite" color for light terminals +- Fixed `require()` leak spotted by [guillermo] -0.3.6 / 2011-12-09 -================== +# 0.3.6 / 2011-12-09 - * Removed suite merging (for now) +- Removed suite merging (for now) -0.3.5 / 2011-12-08 -================== +# 0.3.5 / 2011-12-08 - * Added support for `window.onerror` [guillermo] - * Fixed: clear timeout on uncaught exceptions. Closes #131 [guillermo] - * Added `mocha.css` to PHONY list. - * Added `mocha.js` to PHONY list. +- Added support for `window.onerror` [guillermo] +- Fixed: clear timeout on uncaught exceptions. Closes [#131](https://github.com/mochajs/mocha/issues/131) [guillermo] +- Added `mocha.css` to PHONY list. +- Added `mocha.js` to PHONY list. -0.3.4 / 2011-12-08 -================== +# 0.3.4 / 2011-12-08 - * Added: allow `done()` to be called with non-Error - * Added: return Runner from `mocha.run()`. Closes #126 - * Fixed: run afterEach even on failures. Closes #125 - * Fixed clobbering of current runnable. Closes #121 +- Added: allow `done()` to be called with non-Error +- Added: return Runner from `mocha.run()`. Closes [#126](https://github.com/mochajs/mocha/issues/126) +- Fixed: run afterEach even on failures. Closes [#125](https://github.com/mochajs/mocha/issues/125) +- Fixed clobbering of current runnable. Closes [#121](https://github.com/mochajs/mocha/issues/121) -0.3.3 / 2011-12-08 -================== +# 0.3.3 / 2011-12-08 - * Fixed hook timeouts. Closes #120 - * Fixed uncaught exceptions in hooks +- Fixed hook timeouts. Closes [#120](https://github.com/mochajs/mocha/issues/120) +- Fixed uncaught exceptions in hooks -0.3.2 / 2011-12-05 -================== +# 0.3.2 / 2011-12-05 - * Fixed weird reporting when `err.message` is not present +- Fixed weird reporting when `err.message` is not present -0.3.1 / 2011-12-04 -================== +# 0.3.1 / 2011-12-04 - * Fixed hook event emitter leak. Closes #117 - * Fixed: export `Spec` constructor. Closes #116 +- Fixed hook event emitter leak. Closes [#117](https://github.com/mochajs/mocha/issues/117) +- Fixed: export `Spec` constructor. Closes [#116](https://github.com/mochajs/mocha/issues/116) -0.3.0 / 2011-12-04 -================== +# 0.3.0 / 2011-12-04 - * Added `-w, --watch`. Closes #72 - * Added `--ignore-leaks` to ignore global leak checking - * Added browser `?grep=pattern` support - * Added `--globals ` to specify accepted globals. Closes #99 - * Fixed `mocha-debug(1)` on some systems. Closes #232 - * Fixed growl total, use `runner.total` +- Added `-w, --watch`. Closes [#72](https://github.com/mochajs/mocha/issues/72) +- Added `--ignore-leaks` to ignore global leak checking +- Added browser `?grep=pattern` support +- Added `--globals ` to specify accepted globals. Closes [#99](https://github.com/mochajs/mocha/issues/99) +- Fixed `mocha-debug(1)` on some systems. Closes [#232](https://github.com/mochajs/mocha/issues/232) +- Fixed growl total, use `runner.total` -0.2.0 / 2011-11-30 -================== +# 0.2.0 / 2011-11-30 - * Added `--globals ` to specify accepted globals. Closes #99 - * Fixed funky highlighting of messages. Closes #97 - * Fixed `mocha-debug(1)`. Closes #232 - * Fixed growl total, use runner.total +- Added `--globals ` to specify accepted globals. Closes [#99](https://github.com/mochajs/mocha/issues/99) +- Fixed funky highlighting of messages. Closes [#97](https://github.com/mochajs/mocha/issues/97) +- Fixed `mocha-debug(1)`. Closes [#232](https://github.com/mochajs/mocha/issues/232) +- Fixed growl total, use runner.total -0.1.0 / 2011-11-29 -================== +# 0.1.0 / 2011-11-29 - * Added `suiteSetup` and `suiteTeardown` to TDD interface [David Henderson] - * Added growl icons. Closes #84 - * Fixed coffee-script support +- Added `suiteSetup` and `suiteTeardown` to TDD interface [David Henderson] +- Added growl icons. Closes [#84](https://github.com/mochajs/mocha/issues/84) +- Fixed coffee-script support -0.0.8 / 2011-11-25 -================== +# 0.0.8 / 2011-11-25 - * Fixed: use `Runner#total` for accurate reporting +- Fixed: use `Runner#total` for accurate reporting -0.0.7 / 2011-11-25 -================== +# 0.0.7 / 2011-11-25 - * Added `Hook` - * Added `Runnable` - * Changed: `Test` is `Runnable` - * Fixed global leak reporting in hooks - * Fixed: > 2 calls to done() only report the error once - * Fixed: clear timer on failure. Closes #80 +- Added `Hook` +- Added `Runnable` +- Changed: `Test` is `Runnable` +- Fixed global leak reporting in hooks +- Fixed: > 2 calls to done() only report the error once +- Fixed: clear timer on failure. Closes [#80](https://github.com/mochajs/mocha/issues/80) -0.0.6 / 2011-11-25 -================== +# 0.0.6 / 2011-11-25 - * Fixed return on immediate async error. Closes #80 +- Fixed return on immediate async error. Closes [#80](https://github.com/mochajs/mocha/issues/80) -0.0.5 / 2011-11-24 -================== +# 0.0.5 / 2011-11-24 - * Fixed: make mocha.opts whitespace less picky [kkaefer] +- Fixed: make mocha.opts whitespace less picky [kkaefer] -0.0.4 / 2011-11-24 -================== +# 0.0.4 / 2011-11-24 - * Added `--interfaces` - * Added `--reporters` - * Added `-c, --colors`. Closes #69 - * Fixed hook timeouts +- Added `--interfaces` +- Added `--reporters` +- Added `-c, --colors`. Closes [#69](https://github.com/mochajs/mocha/issues/69) +- Fixed hook timeouts -0.0.3 / 2011-11-23 -================== +# 0.0.3 / 2011-11-23 - * Added `-C, --no-colors` to explicitly disable - * Added coffee-script support +- Added `-C, --no-colors` to explicitly disable +- Added coffee-script support -0.0.2 / 2011-11-22 -================== +# 0.0.2 / 2011-11-22 - * Fixed global leak detection due to Safari bind() change - * Fixed: escape html entities in Doc reporter - * Fixed: escape html entities in HTML reporter - * Fixed pending test support for HTML reporter. Closes #66 +- Fixed global leak detection due to Safari bind() change +- Fixed: escape html entities in Doc reporter +- Fixed: escape html entities in HTML reporter +- Fixed pending test support for HTML reporter. Closes [#66](https://github.com/mochajs/mocha/issues/66) -0.0.1 / 2011-11-22 -================== +# 0.0.1 / 2011-11-22 - * Added `--timeout` second shorthand support, ex `--timeout 3s`. - * Fixed "test end" event for uncaughtExceptions. Closes #61 +- Added `--timeout` second shorthand support, ex `--timeout 3s`. +- Fixed "test end" event for uncaughtExceptions. Closes [#61](https://github.com/mochajs/mocha/issues/61) -0.0.1-alpha6 / 2011-11-19 -================== +# 0.0.1-alpha6 / 2011-11-19 - * Added travis CI support (needs enabling when public) - * Added preliminary browser support - * Added `make mocha.css` target. Closes #45 - * Added stack trace to TAP errors. Closes #52 - * Renamed tearDown to teardown. Closes #49 - * Fixed: cascading hooksc. Closes #30 - * Fixed some colors for non-tty - * Fixed errors thrown in sync test-cases due to nextTick - * Fixed Base.window.width... again give precedence to 0.6.x +- Added travis CI support (needs enabling when public) +- Added preliminary browser support +- Added `make mocha.css` target. Closes [#45](https://github.com/mochajs/mocha/issues/45) +- Added stack trace to TAP errors. Closes [#52](https://github.com/mochajs/mocha/issues/52) +- Renamed tearDown to teardown. Closes [#49](https://github.com/mochajs/mocha/issues/49) +- Fixed: cascading hooksc. Closes [#30](https://github.com/mochajs/mocha/issues/30) +- Fixed some colors for non-tty +- Fixed errors thrown in sync test-cases due to nextTick +- Fixed Base.window.width... again give precedence to 0.6.x -0.0.1-alpha5 / 2011-11-17 -================== +# 0.0.1-alpha5 / 2011-11-17 - * Added `doc` reporter. Closes #33 - * Added suite merging. Closes #28 - * Added TextMate bundle and `make tm`. Closes #20 +- Added `doc` reporter. Closes [#33](https://github.com/mochajs/mocha/issues/33) +- Added suite merging. Closes [#28](https://github.com/mochajs/mocha/issues/28) +- Added TextMate bundle and `make tm`. Closes [#20](https://github.com/mochajs/mocha/issues/20) -0.0.1-alpha4 / 2011-11-15 -================== +# 0.0.1-alpha4 / 2011-11-15 - * Fixed getWindowSize() for 0.4.x +- Fixed getWindowSize() for 0.4.x -0.0.1-alpha3 / 2011-11-15 -================== +# 0.0.1-alpha3 / 2011-11-15 - * Added `-s, --slow ` to specify "slow" test threshold - * Added `mocha-debug(1)` - * Added `mocha.opts` support. Closes #31 - * Added: default [files] to _test/*.js_ - * Added protection against multiple calls to `done()`. Closes #35 - * Changed: bright yellow for slow Dot reporter tests +- Added `-s, --slow ` to specify "slow" test threshold +- Added `mocha-debug(1)` +- Added `mocha.opts` support. Closes [#31](https://github.com/mochajs/mocha/issues/31) +- Added: default [files] to _test/\*.js_ +- Added protection against multiple calls to `done()`. Closes [#35](https://github.com/mochajs/mocha/issues/35) +- Changed: bright yellow for slow Dot reporter tests -0.0.1-alpha1 / 2011-11-08 -================== +# 0.0.1-alpha2 / 2011-11-08 - * Missed this one :) +- Missed this one :) -0.0.1-alpha1 / 2011-11-08 -================== +# 0.0.1-alpha1 / 2011-11-08 - * Initial release +- Initial release diff --git a/LICENSE b/LICENSE index 287db88993..9ab23f6873 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2011-2017 JS Foundation and contributors, https://js.foundation +Copyright (c) 2011-2018 JS Foundation and contributors, https://js.foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..31d5e40ce9 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,376 @@ +# Mocha Maintainer's Handbook + + + +- [Introduction](#introduction) +- [Terminology](#terminology) + - [User](#user) + - [Contributor](#contributor) + - [A Note About Donations](#a-note-about-donations) + - [Maintainer](#maintainer) + - [The Responsibilities of a Maintainer](#the-responsibilities-of-a-maintainer) + - [The Rights of a Maintainer](#the-rights-of-a-maintainer) + - [About "Owners"](#about-owners) +- [Mocha's Decision-Making Process](#mochas-decision-making-process) +- [Communication](#communication) +- [Working with Issues & Pull Requests](#working-with-issues--pull-requests) + - [Semantic Versioning](#semantic-versioning) + - [Questions](#questions) + - [Bugs](#bugs) + - [Features](#features) + - [Subsystems, Environments, Etc.](#subsystems-environments-etc) + - [Feedback & Follow-ups](#feedback--follow-ups) + - [Meta](#meta) + - [Closing Issues](#closing-issues) +- [Commenting on Issues and Reviewing Pull Requests](#commenting-on-issues-and-reviewing-pull-requests) + - [Reviewing Code](#reviewing-code) + - [The Part About Jerks](#the-part-about-jerks) + - [Rude or Entitled People](#rude-or-entitled-people) + - [Code of Conduct Violations](#code-of-conduct-violations) +- [Branches](#branches) +- [Merging PRs](#merging-prs) + - [Using Milestones](#using-milestones) +- [Mocha's Release Process](#mochas-release-process) +- [Projects](#projects) +- [About The JS Foundation](#about-the-js-foundation) +- [About OpenCollective](#about-opencollective) + + + +## Introduction + +Hi stranger! We've written this document for: + +1. Active maintainers of Mocha +1. Prospective maintainers of Mocha +1. Anyone curious about how Mocha's maintainers maintain Mocha + +The purpose of this document is to *describe our processes*. We want to avoid conflicts and confusion around "unwritten rules". In our opinion, the most straightforward way to address this is to *write them down*. This *also* happens to be the most straightforward way to change them! + +To assist in eliminating ambiguity, we will define some terms. + +## Terminology + +Anyone involved with Mocha will fall into one of these buckets: **user**, **contributor**, and **maintainer**. + +### User + +A "user" for the purpose of this document is any *individual developer* who consumes Mocha to write and/or execute tests. A user interacts with contributors. A user interacts with the software, web site, documentation, etc., which these contributors provide. + +As a user, you're expected to follow the [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) when interacting in Mocha's "official" social spaces. This includes: + +- Any chatroom under the `mochajs` organization on Gitter +- Any project under the `mochajs` organization on GitHub +- The MochaJS Google Group +- Any future social, in-person or online events which Mocha might organize + +### Contributor + +This is the most important thing: + +**You don't have to write code to be a contributor!** + +A "contributor" is any individual who has *given back* in some way to the project and its community. Contributions include (but are not limited to): + +1. Reporting bugs which follow the reporting guidelines +1. Suggesting and debating enhancements that have wide applicability +1. Helping others with Mocha-related questions on [Gitter](https://gitter.im/mochajs/mocha), [StackOverflow](https://stackoverflow.com), Google groups, or other sites +1. Sending pull requests which fix bugs, improve documentation, improve developer experience, improve code quality, and/or implement requested enhancements +1. Reviewing code on pull requests +1. Providing design assets +1. Posting a tutorial on a personal blog or blogging site +1. Suggesting usages for project funds +1. Organizing a "Mocha-branded" event or workshop +1. Recruiting more contributors! Don't spam. +1. Researching the user base, getting feedback, etc. Don't spam. + +A contributor is *usually* a user as well, but this isn't a hard-and-fast rule. A contributor is also expected to adhere to the [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) as a user would. + +As you can see, it's wide open! Think of it another way: if you are *adding value to Mocha*, then you are a contributor. + +> Due to the nature of GitHub, it's a challenge to recognize those who've made contributions *elsewhere* on the web, or even contributions of the "non-code" variety. If you know of any great contributions which have gone unnoticed, please bring them to the maintainers' attention! + +#### A Note About Donations + +A [donation](https://opencollective.com/mochajs) is also a great way to help Mocha if you want to help sustain OSS, but can't find time to contribute in other ways, or just want to say "thanks!" + +We love our backers and sponsors! 💕 + +### Maintainer + +A maintainer has certain "rights" (or "permissions") to the Mocha project and other projects under the `mochajs` organization. There's no way to dance around this: with these rights come increased responsibilities. + +However, **there is no expectation of a standard of technical ability** to be a maintainer of Mocha. This doesn't imply a lack of technical oversight--every pull request will eventually be reviewed. + +**If you think you aren't experienced enough to maintain a project like Mocha, you are incorrect.** The only requirements are the above responsibilities and a desire to help the project. It bears repeating: + +**You don't have to write code to be a maintainer!** + +> Maintainer is synonymous with "Collaborator" and/or "Owner" in GitHub parlance. + +#### The Responsibilities of a Maintainer + +As a maintainer, you are expected to *not just* "follow" the code of conduct, but embody its values. Your public behavior, whether in the physical or virtual world, reflects upon the project and other maintainers. + +> If you don't understand the code of conduct, or why it exists, it is *your responsibility* to educate yourself. +> This does not imply the CoC is immutable. + +Furthermore, a maintainer is a contributor who **contributes regularly**, or expresses a *desire to do so.* That could be every day--but it might be once a week, or even once a month. Your boss doesn't work here; contribute as often as you wish. We are all people with Real Lives, and for many of us, contributing to OSS is just a hobby! + +Finally, a maintainer must help define what makes Mocha "Mocha". At minimum, a maintainer must *understand* the current definition (if a maintainer is not interested in decision-making). Some of these questions include: + +- What's the scope of Mocha? +- Where should we focus efforts? +- What's urgent, what can wait? +- What can we break? What's off-limits? +- What user feedback is valuable? What isn't? + +As maintainers, *we work together* to learn about the nature of these questions. If we try hard enough, we even come to some answers! + +A maintainer *must* also have 2FA enabled on their GitHub account. + +> If you think that you aren't familiar with mocha's internals enough to contribute, please watch [This walkthrough video!](https://youtu.be/zLayCLcIno0) + +#### The Rights of a Maintainer + +You may choose to do zero or more of these *at their discretion*: + +- Merge pull requests +- Modify issues (closing, adding labels, assigning them other maintainers, etc.) +- Modify GitHub [Projects](https://github.com/mochajs/mocha/projects) +- Cancel builds, restart jobs, or otherwise interact with our CI server(s) +- CRUD operations on GitHub integrations +- Participate in the decision-making process +- Add new maintainers to the team +- Tag releases and publish Mocha to npm + +> While maintainers have the ability to commit directly to the `master` branch, *this is to be avoided* if any other maintainer could reasonably take issue with the change, or the change affects Mocha's API or output. For example, a spelling correction in `CHANGELOG.md` may not require a pull request. A change to a reporter's output most certainly would! Maintainers are trusted to use their best judgement; if unsure, err on the side of caution. + +#### About "Owners" + +Some maintainers will have full admin rights to the [mochajs org](https://github.com/mochajs) and/or will have access to publish to npm. + +- Those with publish access are expected to use npm's 2FA. +- This level of access will be granted by the current owners to those maintainers who have earned the project's trust. + +## Mocha's Decision-Making Process + +Mocha follows a [consensus-seeking decision-making](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) process. In other words, all maintainers attempt to come to agreement. If that fails, we decide by a simple vote. + +Active maintainers will make an effort to solicit feedback from others before making important or potentially controversial decisions. Given the varying geographical distribution and availability of the maintenance team, we resolve to do the best we can to solicit feedback. + +In other words, to have your opinion heard, participate regularly. The rest of the team won't wait on feedback that isn't necessarily forthcoming! + +## Communication + +Maintainers will mainly gather in [the mochajs/contributors channel](https://gitter.im/mochajs/contributors). This is a *public* channel, and *anyone* can join. +Videoconference (or audio) calls may happen on a regular or irregular basis, as schedules allow. This is mainly because we have Real Lives and time zones suck. + +## Working with Issues & Pull Requests + +All new issues will need to be triaged, and pull requests must be examined. Maintainers must understand [Semantic Versioning](http://semver.org) ("SemVer"), as Mocha follows it strictly. + +> If you see an issue or PR that could use some labels, please add them! + +### Semantic Versioning + +The TL;DR of Semantic Versioning is: + +- MAJOR version when you make incompatible API changes, +- MINOR version when you add functionality in a backwards-compatible manner, and +- PATCH version when you make backwards-compatible bug fixes. + +Pull requests *must* have one of these three (3) labels: + +- `semver-patch` for backwards-compatible bug fixes, documentation, or anything which does not affect a "production" (`npm install mocha`) installation of Mocha +- `semver-minor` for backwards-compatible new features or usability/interface enhancements +- `semver-major` for backwards-incompatible ("breaking") changes to the API + +A PR which introduces a breaking change is considered to be `semver-major`, *regardless* of whether it's a bug fix, feature, or whatever. + +For the purposes of the above definitions, Mocha has some unique considerations, and includes the following in its definition of "API": + +1. Mocha's *documented*, programmatic interface which *is not explicitly tagged with `@private`* +1. Mocha's machine-readable reporter output +1. Mocha's default settings +1. Mocha's command-line options +1. The environments which Mocha supports; this includes: + 1. Browser versions + 1. Node.js versions + 1. Compatibility with popular module loaders (e.g., AMD) + +**Err on the side of the user; breaking changes to private APIs will be `semver-major`, if and only if they are known to be consumed by actively developed project(s).** + +Examples of a breaking changes might be: + +- Throwing an `Error` where one wasn't thrown before +- Removing a command-line option or alias +- Removing an environment from the CI configuration +- Changing the default reporter! +- Changing defaults in a way which would cause tests which were previously successful to start failing, or a failing test to start passing + - The exception is fixing likely false-positives + - A good example would be changing the default `timeout` value + +### Questions + +Support questions should be answered if possible, but the user should be directed to the chat room, StackOverflow, or Google Groups for further help, *if* it is indeed a Mocha-related issue. + +If it's *not* a Mocha problem (people tend not to believe this), you may want to show a counter-example. It's often helpful to direct the issue author to the responsible project, if you can determine what that is. + +- `faq`: Issues which are *repeatedly* asked support questions or misunderstandings. This may also apply to questions which receive a lot of 👍's +- `question`: Add this label if it's just a support question + +### Bugs + +- `confirmed-bug`: A confirmed bug +- `unconfirmed-bug`: A maintainer has not yet or cannot reproduce; typically `needs-feedback` follows (see "Feedback & Follow-ups" below) +- `invalid`: Not a bug. Close the issue. +- `wontfix`: A bug, but for Reasons, it won't get fixed. + +### Features + +- `feature`: Any feature/enhancement that's up for discussion or has been agreed upon. +- `wontfix`: A half-baked feature or one which is unsuitable or out-of-scope for Mocha. + +### Subsystems, Environments, Etc. + +- `reporter`: Usually concerning Mocha's output +- `browser`: Issues unique to a browser environment +- `documentation`: Issues around incorrect or missing docs +- `qa`: Issues around Mocha's own test suite +- `chore`: Refactors, CI tweaks, dependencies, etc. +- `developer-experience`: Issues which will make it easier to contribute and maintain Mocha + +### Feedback & Follow-ups + +Issues or PRs which require action or feedback from a *specific* maintainer, should have that item *assigned* to them. + +- `needs-feedback`: Issues which *need feedback from the original author*. Will automatically become `stale` (see "Meta" section below) +- `needs-review`: For *pull requests only*; PRs which need a maintainer to inspect and/or merge them + +### Meta + +- `stale`: The "stalebot" marks things as stale and will close issues if they need feedback but haven't received any. Comment on an issue to prevent this from happening. +- `help wanted`: If it's an issue that is not a high priority for the maintenance team, use this label to solicit contributions. Note lack of `-` in this label's name. +- `good-first-issue`: Typically combined with `help wanted`; an issue that new contributors to Mocha may find straightforward. + +### Closing Issues + +Write "closes #" or "resolves #" in a commit or PR to have the original issue closed automatically once the PR is merged. + +For any issue which is a duplicate, write "duplicate of #" in a new comment, and close the issue. [Read more about marking issues as duplicates](https://help.github.com/articles/about-duplicate-issues-and-pull-requests/). + +If the issue is a support question, and you believe it has been answered, close the issue. + +If the issue is not Mocha-related, and/or a bug cannot be confirmed, label it `invalid` and close. + +## Commenting on Issues and Reviewing Pull Requests + +**All maintainers should be courteous and kind.** Thank the external contributor for the pull request, even if it is not merged. If the pull request has been opened (and subsequently closed) without discussion in a corresponding issue, let them know that by creating an issue first, they could have saved wasted effort. *Clearly and objectively* explain the reasoning for rejecting any PR. + +If you need more information in an issue, nicely ask the user to provide it. Remind them to use the issue/PR templates if they have not. If the user never gets around to it, the "stalebot" will close it eventually anyhow. + +### Reviewing Code + +Use GitHub's code review features. Requesting a review from another maintainer *may or may not* actually result in a review; don't wait on it. If the PR cannot move forward without input from a certain maintainer, *assign them to the PR*. + +### The Part About Jerks + +There will be jerks. + +#### Rude or Entitled People + +These are users who feel the Mocha project and its maintainers *owe them* time or support. This is incorrect. + +However, this behavior is often indicative of someone who is "new" to open source. Many just don't know better. It is not your *responsibility* to educate them (again, you owe them nothing). + +Here are some suggestions: + +1. If u mad, wait 20 minutes before writing a comment. +1. "Kill them with kindness". Explain how they are presenting themselves; maybe link to a good article or two about it. +1. Don't make it about "users vs. maintainers". Treat them like a potential future maintainer. +1. Avoid adding to the drama. You could try to reach out privately; email may be in their GitHub profile. You will likely never hear from that individual again (problem solved) +1. If an issue is getting out of control, lock it. +1. If someone is *repeatedly* rude and does not correct their mistakes, you may ban them from participating in the `mochajs` org. If you do not have permission to do so, contact one which does (an "owner"). + +#### Code of Conduct Violations + +**This section is theoretical, as it's yet to happen**. + +1. Inform the individual of the violation; link to the CoC +1. Follow up with JS Foundation for further guidance +1. Repeated violators will be banned inasmuch as that is technically possible +1. No maintainer nor contributor is exempt from the CoC + +## Branches + +`master` is the only maintained branch in `mochajs/mocha` or any of the other repos. **`master` is the only branch to which force-pushing is disallowed.** + +Maintainers may push new branches to a repo, as long as they remove them when finished (merging a PR will prompt to do so). + +Please *please* ***please*** delete old or unused branches. + +## Merging PRs + +GitHub has several options for how to merge a PR. Here's what we do: + +1. *If a PR has multiple commits*, "Squash". +1. *If a PR has a single commit*, "Rebase". +1. Don't "Merge". + +**Upon acceptance of a PR, you must assign it a milestone.** + +### Using Milestones + +If you know that the PR is breaking, assign it to a new or existing milestone correlating with the next major release. For example, if Mocha's current version is v6.5.2, then this milestone would be named `v7.0.0`. + +Likewise, if the PR is `semver-minor`, create or use a new milestone correlating to the next *minor* release, e.g., `v6.6.0`. + +If it's unclear what the next milestone will be, use or create a milestone named `next`. This milestone will be renamed to the new version at release time. + +By using milestones, we can cherry-pick non-breaking changes into minor or patch releases, and keep `master` as the latest version. + +**This is subject to change, hopefully.** + +## Mocha's Release Process + +*It's easier to release often.* + +1. Decide whether this is a `patch`, `minor`, or `major` release. +1. Checkout `master` in your working copy & pull. +1. Modify `CHANGELOG.md`; follow the existing conventions in that file. Use the "pull request" number, unless there isn't one. *You do not need to add Markdown links; this is done automatically.* + 1. You can omit stuff from `CHANGELOG.md` that was done by a maintainer, but would have no interest to consumers of Mocha. + 1. If the changes aren't of interest to consumers but *were not* made by a maintainer, reference them anyway. It's cool to give attribution! +1. Use `npm version` (use `npm@6+`) to bump the version; see `npm version --help` for more info. (Hint--use `-m`: e.g., `npm version patch -m 'Release v%s'`) + 1. This command will update the list of contributors (from the Git history) in `package.json`, and add GitHub links to `CHANGELOG.md`. + 1. These changes are then added to the Git "stage" and will be added to the commit. +1. Push `master` to `origin` with your new tag; e.g. `git push origin master --tags` +1. Copy & paste the `CHANGELOG.md` lines to a new GitHub "release". Save release as draft. +1. Meanwhile, you can check [the build](https://travis-ci.org/mochajs/mocha) on Travis-CI and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha). +1. Once the build is green, and you're satisfied with the release notes, open your draft release on GitHub, then click "publish." +1. Back in your working copy, run `npm publish`. *If you're doing a prerelease, ensure that you use `--tag=next`.* +1. Announce the update on Twitter or just tell your dog or something. New releases will be automatically tweeted by [@b0neskull](https://twitter.com/b0neskull) via a feed subscription to Mocha's "releases" page on GitHub. + +In addition to above, you'll need to ensure the docs at [https://mochajs.org](https://mochajs.org) are updated: + +1. *If you're doing a prerelease*, fast-forward the `next` branch to `master`, and push it. This updates [https://next.mochajs.org](https://next.mochajs.org). That's all. +1. *If this is NOT a prerelease*, fast-forward the `mochajs.org` branch to `master` and push it. This updates [https://mochajs.org](https://mochajs.org). +1. *If this is a "final" release* (the first release of a major *after* one or more prereleases) then remove the `next` tag from npm via `npm dist-tag rm next`. + +*Note: there are too many steps above.* + +## About The JS Foundation + +The [JS Foundation](https://js.foundation) retains copyright of all projects underneath the [mochajs org](https://github.com/mochajs). The Foundation does not influence technical decisions nor the project roadmap. It is, however, charged with ensuring the continued vitality and sustainability of projects under its banner. + +As a maintainer, you have access to the resources the JS Foundation provides. + +## About OpenCollective + +Mocha collects donations [via OpenCollective](https://opencollective.com/mochajs). As a maintainer, you may help decide how the funds are used. These decisions are made via a consensus-seeking process, much like any other decision. + +Expense transparency is built in to OpenCollective. + +* * * + +Questions? Ask in the [contributors' chat room](https://gitter.im/mochajs/contributors)! diff --git a/Makefile b/Makefile deleted file mode 100644 index b29655f2e1..0000000000 --- a/Makefile +++ /dev/null @@ -1,170 +0,0 @@ -BROWSERIFY := "node_modules/.bin/browserify" -KARMA := "node_modules/.bin/karma" -MOCHA := "bin/mocha" -NYC := "node_modules/.bin/nyc" - -ifdef COVERAGE -define test_node - $(NYC) --report-dir coverage/reports/$(1) $(MOCHA) -endef -else - test_node := $(MOCHA) -endif - -TM_BUNDLE = JavaScript\ mocha.tmbundle -SRC = $(shell find lib -name "*.js" -type f | LC_ALL=C sort) -TESTS = $(shell find test -name "*.js" -type f | sort) - -all: mocha.js - -mocha.js BUILDTMP/mocha.js: $(SRC) browser-entry.js - @printf "==> [Browser :: build]\n" - mkdir -p ${@D} - $(BROWSERIFY) ./browser-entry \ - --plugin ./scripts/dedefine \ - --ignore 'fs' \ - --ignore 'glob' \ - --ignore 'path' \ - --ignore 'supports-color' > $@ - -clean: - @printf "==> [Clean]\n" - rm -rf BUILDTMP - -lint: - @printf "==> [Test :: Lint]\n" - npm run lint - -test-node: test-bdd test-tdd test-qunit test-exports test-unit test-integration test-jsapi test-compilers test-requires test-reporters test-only test-global-only - -test-browser: clean BUILDTMP/mocha.js test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports - -test: lint test-node test-browser - -test-browser-unit: - @printf "==> [Test :: Browser]\n" - NODE_PATH=BUILDTMP $(KARMA) start --single-run - -test-browser-bdd: - @printf "==> [Test :: Browser :: BDD]\n" - MOCHA_UI=bdd $(MAKE) test-browser-unit - -test-browser-qunit: - @printf "==> [Test :: Browser :: QUnit]\n" - MOCHA_UI=qunit $(MAKE) test-browser-unit - -test-browser-tdd: - @printf "==> [Test :: Browser :: TDD]\n" - MOCHA_UI=tdd $(MAKE) test-browser-unit - -test-jsapi: - @printf "==> [Test :: JS API]\n" - node test/jsapi - -test-unit: - @printf "==> [Test :: Unit]\n" - $(call test_node,unit) test/unit/*.spec.js \ - test/node-unit/*.spec.js \ - --growl - -test-integration: - @printf "==> [Test :: Integrations]\n" - $(call test_node,integration) --timeout 5000 \ - test/integration/*.spec.js - -test-compilers: - @printf "==> [Test :: Compilers]\n" - $(call test_node,compilers-coffee) --compilers coffee:coffee-script/register \ - test/compiler - - $(call test_node,compilers-custom) --compilers foo:./test/compiler-fixtures/foo \ - test/compiler - - $(call test_node,compilers-multiple) \ - --compilers coffee:coffee-script/register,foo:./test/compiler-fixtures/foo \ - test/compiler - -test-requires: - @printf "==> [Test :: Requires]\n" - $(call test_node,requires) --compilers coffee:coffee-script/register \ - --require test/require/a.js \ - --require test/require/b.coffee \ - --require test/require/c.js \ - --require test/require/d.coffee \ - test/require/require.spec.js - -test-bdd: - @printf "==> [Test :: BDD]\n" - $(call test_node,bdd) --ui bdd \ - test/interfaces/bdd.spec - -test-tdd: - @printf "==> [Test :: TDD]\n" - $(call test_node,tdd) --ui tdd \ - test/interfaces/tdd.spec - -test-qunit: - @printf "==> [Test :: QUnit]\n" - $(call test_node,qunit) --ui qunit \ - test/interfaces/qunit.spec - -test-exports: - @printf "==> [Test :: Exports]\n" - $(call test_node,exports) --ui exports \ - test/interfaces/exports.spec - -test-reporters: - @printf "==> [Test :: Reporters]\n" - $(call test_node,reporters) test/reporters/*.spec.js - -test-only: - @printf "==> [Test :: Only]\n" - $(call test_node,only-tdd) --ui tdd \ - test/misc/only/tdd.spec - - $(call test_node,only-bdd) --ui bdd \ - test/misc/only/bdd.spec - - $(call test_node,only-bdd-require) --ui qunit \ - test/misc/only/bdd-require.spec - -test-global-only: - @printf "==> [Test :: Global Only]\n" - $(call test_node,global-only-tdd) --ui tdd \ - test/misc/only/global/tdd.spec - - $(call test_node,global-only-bdd) --ui bdd \ - test/misc/only/global/bdd.spec - - $(call test_node,global-only-qunit) --ui qunit \ - test/misc/only/global/qunit.spec - -test-mocha: - @printf "==> [Test :: Mocha]\n" - $(call test_node,mocha) test/mocha - -non-tty: - @printf "==> [Test :: Non-TTY]\n" - $(call test_node,non-tty-dot) --reporter dot \ - test/interfaces/bdd.spec 2>&1 > /tmp/dot.out - - @echo dot: - @cat /tmp/dot.out - - $(call test_node,non-tty-list) --reporter list \ - test/interfaces/bdd.spec 2>&1 > /tmp/list.out - - @echo list: - @cat /tmp/list.out - - $(call test_node,non-tty-spec) --reporter spec \ - test/interfaces/bdd.spec 2>&1 > /tmp/spec.out - - @echo spec: - @cat /tmp/spec.out - -tm: - @printf "==> [TM]\n" - open editors/$(TM_BUNDLE) - -.PHONY: test-jsapi test-compilers watch test test-node test-bdd test-tdd test-qunit test-exports test-unit test-integration non-tty tm clean test-browser test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports lint test-only test-global-only diff --git a/README.md b/README.md index 9e4d4dcbea..8128519691 100644 --- a/README.md +++ b/README.md @@ -1,121 +1,102 @@ -# Mocha needs YOU! - -*Did you know* Mocha [is a dependency of over 100,000 projects](https://libraries.io/npm/mocha) published to npm alone? - -**Despite this, we're currently unable to merge most pull requests due to lack of maintenance resources.** - -**Are you interested in triaging issues or reviewing open PRs? Have some time to hack on its codebase?** If you would like to help maintain Mocha, please contact `@boneskull` on [Gitter](https://gitter.im/mochajs/mocha). - -*Thank you* :kissing_heart: to all of you interested in helping. These are Mocha's immediate needs: - -1. Increase test coverage on Node.js and browser - - Increase integration coverage for all reporters - - `html` reporter must be tested in browser - - ~~Basic console reporters (*not* `nyan`, `landing`, etc.) must be tested in **both** browser and Node.js contexts; PhantomJS can consume all console reporters~~ - - ~~Filesystem-based reporters must be tested in Node.js context~~ - - **UPDATE - May 24 2017**: Thanks to [community contributions](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#mag-coverage), the coverage on most reporters has increased dramatically! The `html` reporter is still in [dire need of coverage](https://coveralls.io/builds/11674428/source?filename=lib%2Freporters%2Fhtml.js). - - Increase coverage against all interfaces (`exports` in particular). Ideally this becomes a "matrix" where we repeat sets of integration tests across all interfaces. - - Refactor non-Node.js-specific tests to allow them to run in a browser context. Node.js-specific tests include those which *require* the CLI or filesystem. Most everything else is fair game. -2. Review current open pull requests - - We need individuals familiar with Mocha's codebase. Got questions? Ask them in [our chat room](https://gitter.im/mochajs/mocha). - - Pull requests **must** have supporting tests. The only exceptions are pure cosmetic or non-functional changes. - - Pull request contributors must sign the CLA. -3. Close old, inactive issues and pull requests - - ~~A bot should do this. We need a bot. Got a bot?~~ We now use GitHub's own [probot-stale](https://www.npmjs.com/package/probot-stale). -4. Triage issues - - If we run into "critical" bugs, they need fixing. - - "Critical" means Mocha is broken w/o workarounds for a *large percentage* of users - - Otherwise: respond to issues, close new dupe issues, confirm bugs, ask for more info, etc. - -Once we gain ground on the above items, we can work together formalize our contribution guidelines and governance. For further info & ideas, please see our [projects](https://github.com/mochajs/mocha/projects/). - -*You needn't be a maintainer to submit a pull request for test coverage!* - --- @boneskull, *Jan 17 2016* - -

Mocha test framework

-[![Build Status](https://api.travis-ci.org/mochajs/mocha.svg?branch=master)](http://travis-ci.org/mochajs/mocha) -[![Coverage Status](https://coveralls.io/repos/github/mochajs/mocha/badge.svg)](https://coveralls.io/github/mochajs/mocha) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield) -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![OpenCollective](https://opencollective.com/mochajs/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/mochajs/sponsors/badge.svg)](#sponsors) -
Mocha Browser Support h/t SauceLabs +

:coffee: Simple, flexible, fun JavaScript test framework for Node.js & The Browser :coffee:

+ +

Build Status Coverage Status FOSSA Status Gitter OpenCollective OpenCollective +

- Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org). +


Mocha Browser Support h/t SauceLabs

## Links - - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - - [Google Group](http://groups.google.com/group/mochajs) - - [Wiki](https://github.com/mochajs/mocha/wiki) - - Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki) - +- **[Documentation](https://mochajs.org/)** +- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)** +- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) +- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) +- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!) +- [Google Group](https://groups.google.com/group/mochajs) +- [Issue Tracker](https://github.com/mochajs/mocha/issues) ## Backers -[Become a backer]((https://opencollective.com/mochajs#backer)) and show your support to our open source project. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +[Become a backer](https://opencollective.com/mochajs#backer) and show your support to our open source project. + +[![MochaJS Backer](https://opencollective.com/mochajs/backer/0/avatar)](https://opencollective.com/mochajs/backer/0/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/1/avatar)](https://opencollective.com/mochajs/backer/1/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/2/avatar)](https://opencollective.com/mochajs/backer/2/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/3/avatar)](https://opencollective.com/mochajs/backer/3/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/4/avatar)](https://opencollective.com/mochajs/backer/4/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/5/avatar)](https://opencollective.com/mochajs/backer/5/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/6/avatar)](https://opencollective.com/mochajs/backer/6/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/7/avatar)](https://opencollective.com/mochajs/backer/7/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/8/avatar)](https://opencollective.com/mochajs/backer/8/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/9/avatar)](https://opencollective.com/mochajs/backer/9/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/10/avatar)](https://opencollective.com/mochajs/backer/10/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/11/avatar)](https://opencollective.com/mochajs/backer/11/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/12/avatar)](https://opencollective.com/mochajs/backer/12/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/13/avatar)](https://opencollective.com/mochajs/backer/13/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/14/avatar)](https://opencollective.com/mochajs/backer/14/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/15/avatar)](https://opencollective.com/mochajs/backer/15/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/16/avatar)](https://opencollective.com/mochajs/backer/16/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/17/avatar)](https://opencollective.com/mochajs/backer/17/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/18/avatar)](https://opencollective.com/mochajs/backer/18/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/19/avatar)](https://opencollective.com/mochajs/backer/19/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/20/avatar)](https://opencollective.com/mochajs/backer/20/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/21/avatar)](https://opencollective.com/mochajs/backer/21/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/22/avatar)](https://opencollective.com/mochajs/backer/22/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/23/avatar)](https://opencollective.com/mochajs/backer/23/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/24/avatar)](https://opencollective.com/mochajs/backer/24/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/25/avatar)](https://opencollective.com/mochajs/backer/25/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/26/avatar)](https://opencollective.com/mochajs/backer/26/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/27/avatar)](https://opencollective.com/mochajs/backer/27/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/28/avatar)](https://opencollective.com/mochajs/backer/28/website) +[![MochaJS Backer](https://opencollective.com/mochajs/backer/29/avatar)](https://opencollective.com/mochajs/backer/29/website) ## Sponsors -Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org)--who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor). - - - - - - - - - - - - - - - - - - - - - +Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor). + +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/0/avatar)](https://opencollective.com/mochajs/sponsor/0/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/1/avatar)](https://opencollective.com/mochajs/sponsor/1/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/2/avatar)](https://opencollective.com/mochajs/sponsor/2/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/3/avatar)](https://opencollective.com/mochajs/sponsor/3/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/4/avatar)](https://opencollective.com/mochajs/sponsor/4/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/5/avatar)](https://opencollective.com/mochajs/sponsor/5/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/6/avatar)](https://opencollective.com/mochajs/sponsor/6/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/7/avatar)](https://opencollective.com/mochajs/sponsor/7/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/8/avatar)](https://opencollective.com/mochajs/sponsor/8/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/9/avatar)](https://opencollective.com/mochajs/sponsor/9/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/10/avatar)](https://opencollective.com/mochajs/sponsor/10/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/11/avatar)](https://opencollective.com/mochajs/sponsor/11/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/12/avatar)](https://opencollective.com/mochajs/sponsor/12/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/13/avatar)](https://opencollective.com/mochajs/sponsor/13/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/14/avatar)](https://opencollective.com/mochajs/sponsor/14/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/15/avatar)](https://opencollective.com/mochajs/sponsor/15/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/16/avatar)](https://opencollective.com/mochajs/sponsor/16/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/17/avatar)](https://opencollective.com/mochajs/sponsor/17/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/18/avatar)](https://opencollective.com/mochajs/sponsor/18/website) +[![MochaJS Backer](https://opencollective.com/mochajs/sponsor/19/avatar)](https://opencollective.com/mochajs/sponsor/19/website) + +## Development + +You might want to know that: + +- Mocha is the *most-depended-upon* module on npm (source: [libraries.io](https://libraries.io/search?order=desc&platforms=NPM&sort=dependents_count)), and +- Mocha is an *independent* open-source project, maintained exclusively by volunteers. + +You might want to help: + +- New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue) +- Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) +- The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done + +Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors) on Gitter if you want to help with: + +- Triaging issues, answering questions +- Review, merging, and closing pull requests +- Other project-maintenance-y things ## License diff --git a/appveyor.yml b/appveyor.yml index ff832db835..4feecb1635 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,28 +1,76 @@ +### +### appveyor.yml +### + +## General configuration +version: '{build}' +skip_commits: + message: /\[ci\s+skip\]/ + +## Environment configuration +shallow_clone: true +clone_depth: 1 environment: matrix: + - nodejs_version: '12' + - nodejs_version: '10' - nodejs_version: '8' - - nodejs_version: '7' - - nodejs_version: '6' - - nodejs_version: '4' - - nodejs_version: '0.12' - - nodejs_version: '0.10' -install: - - ps: Install-Product node $env:nodejs_version - - set CI=true - - set PATH=%APPDATA%\npm;c:\MinGW\bin;%PATH% - - set PHANTOMJS_CDNURL=https://cnpmjs.org/downloads - - npm install - - copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe matrix: fast_finish: true -build: off -version: '{build}' -shallow_clone: true -clone_depth: 1 +install: + ## Manual Growl install + - ps: Add-AppveyorMessage "Installing Growl..." + - ps: $seaURL = "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe" + - ps: $seaPath = "$($env:USERPROFILE)\GrowlInstaller.exe" + - ps: $webclient = New-Object Net.WebClient + - ps: $webclient.DownloadFile($seaURL, $seaPath) + - ps: mkdir C:\GrowlInstaller | out-null + - ps: 7z x $seaPath -oC:\GrowlInstaller | out-null + - ps: cmd /c start /wait msiexec /i C:\GrowlInstaller\Growl_v2.0.msi /quiet + - ps: $env:path = "C:\Program Files (x86)\Growl for Windows;$env:path" + ## Growl requires some time before it's ready to handle notifications + - ps: Add-AppveyorMessage "Starting Growl service..." + - ps: Start-Process -NoNewWindow Growl + ## Node-related installs + - ps: Add-AppveyorMessage "Installing Node..." + - set PATH=%APPDATA%\npm;C:\MinGW\bin;%PATH% + ## Prefer pre-installed Node versions, with fallback to manual update + - ps: | + try { + Install-Product node $env:nodejs_version $env:platform + } catch { + Add-AppveyorMessage " install failed - attempting manual update..." + Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform + } + - ps: Add-AppveyorMessage "Installing npm..." + - npm install -g npm + ## Mocha-related package installs + - ps: Add-AppveyorMessage "Installing Mocha dependencies..." + - npm ci --ignore-scripts + +## Build configuration +platform: + - x64 +build: script +build_script: + - ps: Add-AppveyorMessage "Verify Growl responding..." + - ps: growlnotify test + +## Test configuration +before_test: + - set CI=true test_script: + - ps: Add-AppveyorMessage "Displaying version information" + - ps: (Get-ComputerInfo -Property OsName,OsVersion,OsArchitecture | Format-Table -HideTableHeaders -AutoSize | Out-String).Trim() - node --version - npm --version - - make test-node -skip_commits: - message: /\[ci\s+skip\]/ + - ps: Add-AppveyorMessage "Running tests..." + - npm start test.node + - ps: Add-AppveyorMessage "Done" +## Notifications +notifications: + - provider: Email + on_build_success: false + on_build_failure: false + on_build_status_changed: false diff --git a/images/error.png b/assets/growl/error.png similarity index 100% rename from images/error.png rename to assets/growl/error.png diff --git a/images/ok.png b/assets/growl/ok.png similarity index 100% rename from images/ok.png rename to assets/growl/ok.png diff --git a/assets/mocha-logo-96.png b/assets/mocha-logo-96.png new file mode 100644 index 0000000000..dba31bc955 Binary files /dev/null and b/assets/mocha-logo-96.png differ diff --git a/assets/opencollective-header.png b/assets/opencollective-header.png new file mode 100644 index 0000000000..fbb1dab2b5 Binary files /dev/null and b/assets/opencollective-header.png differ diff --git a/bin/_mocha b/bin/_mocha index c37d49fef5..2ea8317467 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -1,572 +1,10 @@ #!/usr/bin/env node 'use strict'; -/* eslint no-unused-vars: off */ - -/** - * Module dependencies. - */ - -var program = require('commander'); -var path = require('path'); -var fs = require('fs'); -var resolve = path.resolve; -var exists = fs.existsSync || path.existsSync; -var Mocha = require('../'); -var utils = Mocha.utils; -var interfaceNames = Object.keys(Mocha.interfaces); -var join = path.join; -var cwd = process.cwd(); -var getOptions = require('./options'); -var mocha = new Mocha(); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; - -/** - * Files. - */ - -var files = []; - -/** - * Globals. - */ - -var globals = []; - -/** - * Requires. - */ - -var requires = []; - -/** - * Images. - */ - -var images = { - fail: path.join(__dirname, '..', 'images', 'error.png'), - pass: path.join(__dirname, '..', 'images', 'ok.png') -}; - -// options - -program - .version(JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version) - .usage('[debug] [options] [files]') - .option('-A, --async-only', 'force all tests to take a callback (async) or return a promise') - .option('-c, --colors', 'force enabling of colors') - .option('-C, --no-colors', 'force disabling of colors') - .option('-G, --growl', 'enable growl notification support') - .option('-O, --reporter-options ', 'reporter-specific options') - .option('-R, --reporter ', 'specify the reporter to use', 'spec') - .option('-S, --sort', 'sort test files') - .option('-b, --bail', 'bail after first test failure') - .option('-d, --debug', "enable node's debugger, synonym for node --debug") - .option('-g, --grep ', 'only run tests matching ') - .option('-f, --fgrep ', 'only run tests containing ') - .option('-gc, --expose-gc', 'expose gc extension') - .option('-i, --invert', 'inverts --grep and --fgrep matches') - .option('-r, --require ', 'require the given module') - .option('-s, --slow ', '"slow" test threshold in milliseconds [75]') - .option('-t, --timeout ', 'set test-case timeout in milliseconds [2000]') - .option('-u, --ui ', 'specify user-interface (' + interfaceNames.join('|') + ')', 'bdd') - .option('-w, --watch', 'watch files for changes') - .option('--check-leaks', 'check for global variable leaks') - .option('--full-trace', 'display the full stack trace') - .option('--compilers :,...', 'use the given module(s) to compile files', list, []) - .option('--debug-brk', "enable node's debugger breaking on the first line") - .option('--globals ', 'allow the given comma-delimited global [names]', list, []) - .option('--es_staging', 'enable all staged features') - .option('--harmony<_classes,_generators,...>', 'all node --harmony* flags are available') - .option('--preserve-symlinks', 'Instructs the module loader to preserve symbolic links when resolving and caching modules') - .option('--icu-data-dir', 'include ICU data') - .option('--inline-diffs', 'display actual/expected differences inline within each string') - .option('--inspect', 'activate devtools in chrome') - .option('--inspect-brk', 'activate devtools in chrome and break on the first line') - .option('--interfaces', 'display available interfaces') - .option('--no-deprecation', 'silence deprecation warnings') - .option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit') - .option('--no-timeouts', 'disables timeouts, given implicitly with --debug') - .option('--no-warnings', 'silence all node process warnings') - .option('--opts ', 'specify opts path', 'test/mocha.opts') - .option('--perf-basic-prof', 'enable perf linux profiler (basic support)') - .option('--napi-modules', 'enable experimental NAPI modules') - .option('--prof', 'log statistical profiling information') - .option('--log-timer-events', 'Time events including external callbacks') - .option('--recursive', 'include sub directories') - .option('--reporters', 'display available reporters') - .option('--retries ', 'set numbers of time to retry a failed test case') - .option('--throw-deprecation', 'throw an exception anytime a deprecated function is used') - .option('--trace', 'trace function calls') - .option('--trace-deprecation', 'show stack traces on deprecations') - .option('--trace-warnings', 'show stack traces on node process warnings') - .option('--use_strict', 'enforce strict mode') - .option('--watch-extensions ,...', 'additional extensions to monitor with --watch', list, []) - .option('--delay', 'wait for async suite definition') - .option('--allow-uncaught', 'enable uncaught errors to propagate') - .option('--forbid-only', 'causes test marked with only to fail the suite') - .option('--forbid-pending', 'causes pending tests and test marked with skip to fail the suite'); - -program._name = 'mocha'; - -// init command - -program - .command('init ') - .description('initialize a client-side mocha setup at ') - .action(function (path) { - var mkdir = require('mkdirp'); - mkdir.sync(path); - var css = fs.readFileSync(join(__dirname, '..', 'mocha.css')); - var js = fs.readFileSync(join(__dirname, '..', 'mocha.js')); - var tmpl = fs.readFileSync(join(__dirname, '..', 'lib/template.html')); - fs.writeFileSync(join(path, 'mocha.css'), css); - fs.writeFileSync(join(path, 'mocha.js'), js); - fs.writeFileSync(join(path, 'tests.js'), ''); - fs.writeFileSync(join(path, 'index.html'), tmpl); - process.exit(0); - }); - -// --globals - -program.on('globals', function (val) { - globals = globals.concat(list(val)); -}); - -// --reporters - -program.on('reporters', function () { - console.log(); - console.log(' dot - dot matrix'); - console.log(' doc - html documentation'); - console.log(' spec - hierarchical spec list'); - console.log(' json - single json object'); - console.log(' progress - progress bar'); - console.log(' list - spec-style listing'); - console.log(' tap - test-anything-protocol'); - console.log(' landing - unicode landing strip'); - console.log(' xunit - xunit reporter'); - console.log(' min - minimal reporter (great with --watch)'); - console.log(' json-stream - newline delimited json events'); - console.log(' markdown - markdown documentation (github flavour)'); - console.log(' nyan - nyan cat!'); - console.log(); - process.exit(); -}); - -// --interfaces - -program.on('interfaces', function () { - console.log(''); - interfaceNames.forEach(function (interfaceName) { - console.log(' ' + interfaceName); - }); - console.log(''); - process.exit(); -}); - -// -r, --require - -module.paths.push(cwd, join(cwd, 'node_modules')); - -program.on('require', function (mod) { - var abs = exists(mod) || exists(mod + '.js'); - if (abs) { - mod = resolve(mod); - } - requires.push(mod); -}); - -// If not already done, load mocha.opts -if (!process.env.LOADED_MOCHA_OPTS) { - getOptions(); -} - -// parse args - -program.parse(process.argv); - -// infinite stack traces - -Error.stackTraceLimit = Infinity; // TODO: config - -// reporter options - -var reporterOptions = {}; -if (program.reporterOptions !== undefined) { - program.reporterOptions.split(',').forEach(function (opt) { - var L = opt.split('='); - if (L.length > 2 || L.length === 0) { - throw new Error("invalid reporter option '" + opt + "'"); - } else if (L.length === 2) { - reporterOptions[L[0]] = L[1]; - } else { - reporterOptions[L[0]] = true; - } - }); -} - -// reporter - -mocha.reporter(program.reporter, reporterOptions); - -// load reporter - -var Reporter = null; -try { - Reporter = require('../lib/reporters/' + program.reporter); -} catch (err) { - try { - Reporter = require(program.reporter); - } catch (err2) { - throw new Error('reporter "' + program.reporter + '" does not exist'); - } -} - -// --no-colors - -if (!program.colors) { - mocha.useColors(false); -} - -// --colors - -if (~process.argv.indexOf('--colors') || ~process.argv.indexOf('-c')) { - mocha.useColors(true); -} - -// --inline-diffs - -if (program.inlineDiffs) { - mocha.useInlineDiffs(true); -} - -// --slow - -if (program.slow) { - mocha.suite.slow(program.slow); -} - -// --no-timeouts - -if (!program.timeouts) { - mocha.enableTimeouts(false); -} - -// --timeout - -if (program.timeout) { - mocha.suite.timeout(program.timeout); -} - -// --bail - -mocha.suite.bail(program.bail); - -// --grep - -if (program.grep) { - mocha.grep(program.grep); -} - -// --fgrep - -if (program.fgrep) { - mocha.fgrep(program.fgrep); -} - -// --invert - -if (program.invert) { - mocha.invert(); -} - -// --check-leaks - -if (program.checkLeaks) { - mocha.checkLeaks(); -} - -// --stack-trace - -if (program.fullTrace) { - mocha.fullTrace(); -} - -// --growl - -if (program.growl) { - mocha.growl(); -} - -// --async-only - -if (program.asyncOnly) { - mocha.asyncOnly(); -} - -// --delay - -if (program.delay) { - mocha.delay(); -} - -// --allow-uncaught - -if (program.allowUncaught) { - mocha.allowUncaught(); -} - -// --globals - -mocha.globals(globals); - -// --retries - -if (program.retries) { - mocha.suite.retries(program.retries); -} - -// --forbid-only - -if (program.forbidOnly) mocha.forbidOnly(); - -// --forbid-pending - -if (program.forbidPending) mocha.forbidPending(); - -// custom compiler support - -var extensions = ['js']; -program.compilers.forEach(function (c) { - var idx = c.indexOf(':'); - var ext = c.slice(0, idx); - var mod = c.slice(idx + 1); - - if (mod[0] === '.') { - mod = join(process.cwd(), mod); - } - require(mod); - extensions.push(ext); - program.watchExtensions.push(ext); -}); - -// requires - -requires.forEach(function (mod) { - require(mod); -}); - -// interface - -mocha.ui(program.ui); - -// args - -var args = program.args; - -// default files to test/*.{js,coffee} - -if (!args.length) { - args.push('test'); -} - -args.forEach(function (arg) { - var newFiles; - try { - newFiles = utils.lookupFiles(arg, extensions, program.recursive); - } catch (err) { - if (err.message.indexOf('cannot resolve path') === 0) { - console.error('Warning: Could not find any test files matching pattern: ' + arg); - return; - } - - throw err; - } - - files = files.concat(newFiles); -}); - -if (!files.length) { - console.error('No test files found'); - process.exit(1); -} - -// resolve - -files = files.map(function (path) { - return resolve(path); -}); - -if (program.sort) { - files.sort(); -} - -// --watch - -var runner; -var loadAndRun; -var purge; -var rerun; - -if (program.watch) { - console.log(); - hideCursor(); - process.on('SIGINT', function () { - showCursor(); - console.log('\n'); - process.exit(130); - }); - - var watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions)); - var runAgain = false; - - loadAndRun = function loadAndRun () { - try { - mocha.files = files; - runAgain = false; - runner = mocha.run(function () { - runner = null; - if (runAgain) { - rerun(); - } - }); - } catch (e) { - console.log(e.stack); - } - }; - - purge = function purge () { - watchFiles.forEach(function (file) { - delete require.cache[file]; - }); - }; - - loadAndRun(); - - rerun = function rerun () { - purge(); - stop(); - if (!program.grep) { - mocha.grep(null); - } - mocha.suite = mocha.suite.clone(); - mocha.suite.ctx = new Mocha.Context(); - mocha.ui(program.ui); - loadAndRun(); - }; - - utils.watch(watchFiles, function () { - runAgain = true; - if (runner) { - runner.abort(); - } else { - rerun(); - } - }); -} else { -// load - - mocha.files = files; - runner = mocha.run(program.exit ? exit : exitLater); -} - -function exitLater (code) { - process.on('exit', function () { - process.exit(Math.min(code, 255)); - }); -} - -function exit (code) { - var clampedCode = Math.min(code, 255); - - // Eagerly set the process's exit code in case stream.write doesn't - // execute its callback before the process terminates. - process.exitCode = clampedCode; - - // flush output for Node.js Windows pipe bug - // https://github.com/joyent/node/issues/6247 is just one bug example - // https://github.com/visionmedia/mocha/issues/333 has a good discussion - function done () { - if (!(draining--)) { - process.exit(clampedCode); - } - } - - var draining = 0; - var streams = [process.stdout, process.stderr]; - - streams.forEach(function (stream) { - // submit empty write request and wait for completion - draining += 1; - stream.write('', done); - }); - - done(); -} - -process.on('SIGINT', function () { - runner.abort(); - - // This is a hack: - // Instead of `process.exit(130)`, set runner.failures to 130 (exit code for SIGINT) - // The amount of failures will be emitted as error code later - runner.failures = 130; -}); - -/** - * Parse list. - */ - -function list (str) { - return str.split(/ *, */); -} - -/** - * Hide the cursor. - */ - -function hideCursor () { - process.stdout.write('\u001b[?25l'); -} - /** - * Show the cursor. + * This file remains for backwards compatibility only. + * Don't put stuff in this file. + * @see module:lib/cli */ -function showCursor () { - process.stdout.write('\u001b[?25h'); -} - -/** - * Stop play()ing. - */ - -function stop () { - process.stdout.write('\u001b[2K'); - clearInterval(play.timer); -} - -/** - * Play the given array of strings. - */ - -function play (arr, interval) { - var len = arr.length; - interval = interval || 100; - var i = 0; - - play.timer = setInterval(function () { - var str = arr[i++ % len]; - process.stdout.write('\u001b[0G' + str); - }, interval); -} +require('../lib/cli').main(); diff --git a/bin/mocha b/bin/mocha index d632fbc394..4b0ab8ff86 100755 --- a/bin/mocha +++ b/bin/mocha @@ -3,85 +3,130 @@ 'use strict'; /** - * This tiny wrapper file checks for known node flags and appends them - * when found, before invoking the "real" _mocha(1) executable. + * This wrapper executable checks for known node flags and appends them when found, + * before invoking the "real" executable (`lib/cli/cli.js`) + * + * @module bin/mocha + * @private */ -var spawn = require('child_process').spawn; -var path = require('path'); -var getOptions = require('./options'); -var args = [path.join(__dirname, '_mocha')]; - -// Load mocha.opts into process.argv -// Must be loaded here to handle node-specific options -getOptions(); - -process.argv.slice(2).forEach(function (arg) { - var flag = arg.split('=')[0]; - - switch (flag) { - case '-d': - args.unshift('--debug'); - args.push('--no-timeouts'); - break; - case 'debug': - case '--debug': - case '--debug-brk': - case '--inspect': - case '--inspect-brk': - args.unshift(arg); - args.push('--no-timeouts'); - break; - case '-gc': - case '--expose-gc': - args.unshift('--expose-gc'); - break; - case '--gc-global': - case '--es_staging': - case '--no-deprecation': - case '--no-warnings': - case '--prof': - case '--log-timer-events': - case '--throw-deprecation': - case '--trace-deprecation': - case '--trace-warnings': - case '--use_strict': - case '--allow-natives-syntax': - case '--perf-basic-prof': - case '--napi-modules': - args.unshift(arg); - break; - default: - if (arg.indexOf('--harmony') === 0) { - args.unshift(arg); - } else if (arg.indexOf('--trace') === 0) { - args.unshift(arg); - } else if (arg.indexOf('--icu-data-dir') === 0) { - args.unshift(arg); - } else if (arg.indexOf('--max-old-space-size') === 0) { - args.unshift(arg); - } else if (arg.indexOf('--preserve-symlinks') === 0) { - args.unshift(arg); - } else { - args.push(arg); - } - break; +const {deprecate} = require('../lib/utils'); +const {loadOptions} = require('../lib/cli/options'); +const { + unparseNodeFlags, + isNodeFlag, + impliesNoTimeouts +} = require('../lib/cli/node-flags'); +const unparse = require('yargs-unparser'); +const debug = require('debug')('mocha:cli:mocha'); +const {aliases} = require('../lib/cli/run-option-metadata'); + +const mochaArgs = {}; +const nodeArgs = {}; + +const opts = loadOptions(process.argv.slice(2)); +debug('loaded opts', opts); + +/** + * Given option/command `value`, disable timeouts if applicable + * @param {string} [value] - Value to check + * @ignore + */ +const disableTimeouts = value => { + if (impliesNoTimeouts(value)) { + debug(`option "${value}" disabled timeouts`); + mochaArgs.timeout = 0; + delete mochaArgs.timeouts; + delete mochaArgs.t; + } +}; + +/** + * If `value` begins with `v8-` and is not explicitly `v8-options`, remove prefix + * @param {string} [value] - Value to check + * @returns {string} `value` with prefix (maybe) removed + * @ignore + */ +const trimV8Option = value => + value !== 'v8-options' && /^v8-/.test(value) ? value.slice(3) : value; + +// sort options into "node" and "mocha" buckets +Object.keys(opts).forEach(opt => { + if (isNodeFlag(opt)) { + nodeArgs[trimV8Option(opt)] = opts[opt]; + disableTimeouts(opt); + } else { + mochaArgs[opt] = opts[opt]; } }); -var proc = spawn(process.execPath, args, { stdio: 'inherit' }); -proc.on('exit', function (code, signal) { - process.on('exit', function () { - if (signal) { - process.kill(process.pid, signal); - } else { - process.exit(code); - } +// Native debugger handling +// see https://nodejs.org/api/debugger.html#debugger_debugger +// look for 'inspect' or 'debug' that would launch this debugger, +// remove it from Mocha's opts and prepend it to Node's opts. +// A deprecation warning will be printed by node, if applicable. +// (mochaArgs._ are "positional" arguments, not prefixed with - or --) +if (mochaArgs._) { + const i = mochaArgs._.findIndex(val => val === 'inspect' || val === 'debug'); + if (i > -1) { + const [command] = mochaArgs._.splice(i, 1); + disableTimeouts('inspect'); + nodeArgs._ = [command]; + } +} + +// historical +if (nodeArgs.gc) { + deprecate( + '"-gc" is deprecated and will be removed from a future version of Mocha. Use "--gc-global" instead.' + ); + nodeArgs['gc-global'] = nodeArgs.gc; + delete nodeArgs.gc; +} + +// --require/-r is treated as Mocha flag except when 'esm' is preloaded +if (mochaArgs.require && mochaArgs.require.includes('esm')) { + nodeArgs.require = ['esm']; + mochaArgs.require = mochaArgs.require.filter(mod => mod !== 'esm'); + if (!mochaArgs.require.length) { + delete mochaArgs.require; + } + delete mochaArgs.r; +} + +if (Object.keys(nodeArgs).length) { + const {spawn} = require('child_process'); + const mochaPath = require.resolve('../lib/cli/cli.js'); + + debug('final node args', nodeArgs); + + const args = [].concat( + unparseNodeFlags(nodeArgs), + mochaPath, + unparse(mochaArgs, {alias: aliases}) + ); + + debug(`exec ${process.execPath} w/ args:`, args); + + const proc = spawn(process.execPath, args, { + stdio: 'inherit' }); -}); -// terminate children. -process.on('SIGINT', function () { - proc.kill('SIGINT'); // calls runner.abort() - proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die. -}); + proc.on('exit', (code, signal) => { + process.on('exit', () => { + if (signal) { + process.kill(process.pid, signal); + } else { + process.exit(code); + } + }); + }); + + // terminate children. + process.on('SIGINT', () => { + proc.kill('SIGINT'); // calls runner.abort() + proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die. + }); +} else { + require('../lib/cli/cli').main(unparse(mochaArgs, {alias: aliases})); +} diff --git a/bin/options.js b/bin/options.js deleted file mode 100644 index be5a60c9c3..0000000000 --- a/bin/options.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -/** - * Dependencies. - */ - -var fs = require('fs'); - -/** - * Export `getOptions`. - */ - -module.exports = getOptions; - -/** - * Get options. - */ - -function getOptions () { - var optsPath = process.argv.indexOf('--opts') === -1 - ? 'test/mocha.opts' - : process.argv[process.argv.indexOf('--opts') + 1]; - - try { - var opts = fs.readFileSync(optsPath, 'utf8') - .replace(/\\\s/g, '%20') - .split(/\s/) - .filter(Boolean) - .map(function (value) { - return value.replace(/%20/g, ' '); - }); - - process.argv = process.argv - .slice(0, 2) - .concat(opts.concat(process.argv.slice(2))); - } catch (err) { - // ignore - } - - process.env.LOADED_MOCHA_OPTS = true; -} diff --git a/bower.json b/bower.json deleted file mode 100644 index e96cc9526d..0000000000 --- a/bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "mocha", - "homepage": "https://mochajs.org", - "description": "simple, flexible, fun test framework", - "repository": { - "type": "git", - "url": "git://github.com/mochajs/mocha.git" - }, - "main": [ - "mocha.js", - "mocha.css" - ], - "ignore": [ - "bin", - "editors", - "images", - "lib", - "scripts", - "test", - "assets", - "media", - ".*", - "index.js", - "karma.conf.js", - "browser-entry.js", - "Makefile", - "package.json", - "appveyor.yml" - ], - "keywords": [ - "mocha", - "test", - "bdd", - "tdd", - "tap" - ], - "license": "MIT" -} diff --git a/browser-entry.js b/browser-entry.js index 1d5ef5a1c4..fd89117755 100644 --- a/browser-entry.js +++ b/browser-entry.js @@ -7,7 +7,7 @@ * Shim process.stdout. */ -process.stdout = require('browser-stdout')(); +process.stdout = require('browser-stdout')({label: false}); var Mocha = require('./lib/mocha'); @@ -17,7 +17,7 @@ var Mocha = require('./lib/mocha'); * @return {undefined} */ -var mocha = new Mocha({ reporter: 'html' }); +var mocha = new Mocha({reporter: 'html'}); /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -38,14 +38,14 @@ var originalOnerrorHandler = global.onerror; * Revert to original onerror handler if previously defined. */ -process.removeListener = function (e, fn) { +process.removeListener = function(e, fn) { if (e === 'uncaughtException') { if (originalOnerrorHandler) { global.onerror = originalOnerrorHandler; } else { - global.onerror = function () {}; + global.onerror = function() {}; } - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); + var i = uncaughtExceptionHandlers.indexOf(fn); if (i !== -1) { uncaughtExceptionHandlers.splice(i, 1); } @@ -56,9 +56,9 @@ process.removeListener = function (e, fn) { * Implements uncaughtException listener. */ -process.on = function (e, fn) { +process.on = function(e, fn) { if (e === 'uncaughtException') { - global.onerror = function (err, url, line) { + global.onerror = function(err, url, line) { fn(new Error(err + ' (' + url + ':' + line + ')')); return !mocha.allowUncaught; }; @@ -74,9 +74,9 @@ mocha.suite.removeAllListeners('pre-require'); var immediateQueue = []; var immediateTimeout; -function timeslice () { +function timeslice() { var immediateStart = new Date().getTime(); - while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { + while (immediateQueue.length && new Date().getTime() - immediateStart < 100) { immediateQueue.shift()(); } if (immediateQueue.length) { @@ -90,7 +90,7 @@ function timeslice () { * High-performance override of Runner.immediately. */ -Mocha.Runner.immediately = function (callback) { +Mocha.Runner.immediately = function(callback) { immediateQueue.push(callback); if (!immediateTimeout) { immediateTimeout = setTimeout(timeslice, 0); @@ -102,8 +102,8 @@ Mocha.Runner.immediately = function (callback) { * This is useful when running tests in a browser because window.onerror will * only receive the 'message' attribute of the Error. */ -mocha.throwError = function (err) { - Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { +mocha.throwError = function(err) { + uncaughtExceptionHandlers.forEach(function(fn) { fn(err); }); throw err; @@ -114,7 +114,7 @@ mocha.throwError = function (err) { * Normally this would happen in Mocha.prototype.loadFiles. */ -mocha.ui = function (ui) { +mocha.ui = function(ui) { Mocha.prototype.ui.call(this, ui); this.suite.emit('pre-require', global, null, this); return this; @@ -124,9 +124,9 @@ mocha.ui = function (ui) { * Setup mocha with the given setting options. */ -mocha.setup = function (opts) { +mocha.setup = function(opts) { if (typeof opts === 'string') { - opts = { ui: opts }; + opts = {ui: opts}; } for (var opt in opts) { if (opts.hasOwnProperty(opt)) { @@ -140,7 +140,7 @@ mocha.setup = function (opts) { * Run mocha, returning the Runner. */ -mocha.run = function (fn) { +mocha.run = function(fn) { var options = mocha.options; mocha.globals('location'); @@ -155,10 +155,14 @@ mocha.run = function (fn) { mocha.invert(); } - return Mocha.prototype.run.call(mocha, function (err) { + return Mocha.prototype.run.call(mocha, function(err) { // The DOM Document is not available in Web Workers. var document = global.document; - if (document && document.getElementById('mocha') && options.noHighlighting !== true) { + if ( + document && + document.getElementById('mocha') && + options.noHighlighting !== true + ) { Mocha.utils.highlightTags('code'); } if (fn) { diff --git a/docs/.browserslistrc b/docs/.browserslistrc new file mode 100644 index 0000000000..5be642c293 --- /dev/null +++ b/docs/.browserslistrc @@ -0,0 +1,4 @@ +## Browsers support for autoprefixing CSS for the website +last 2 major versions +not dead +Firefox ESR diff --git a/docs/.eleventyignore b/docs/.eleventyignore new file mode 100644 index 0000000000..c81ddf9d39 --- /dev/null +++ b/docs/.eleventyignore @@ -0,0 +1,6 @@ +README.md +API.md +LICENSE* +.* +_dist/ +example/ diff --git a/docs/API.md b/docs/API.md new file mode 100644 index 0000000000..d92d3e689c --- /dev/null +++ b/docs/API.md @@ -0,0 +1,20 @@ +# Mocha's API Documentation + +* * * + +Congratulations! You've found Mocha's API documentation. These docs are for developers who wish to: + +- Create an extension for Mocha, or +- Develop Mocha itself, or +- Do something else fancy with Mocha + +Otherwise, **you probably want the [main documentation](https://mochajs.org)**. + +## Other Links + +- **[Main Documentation](https://mochajs.org)** +- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)** +- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) +- [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!) +- [Google Group](https://groups.google.com/group/mochajs) +- [Issue Tracker](https://github.com/mochajs/mocha/issues) diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000000..f596d46df1 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +mochajs.org diff --git a/docs/LICENSE-CC-BY-4.0 b/docs/LICENSE-CC-BY-4.0 new file mode 100644 index 0000000000..2f244ac814 --- /dev/null +++ b/docs/LICENSE-CC-BY-4.0 @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..203fa2e091 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,30 @@ +# mochajs.org + +_So you wanna build the site?_ + +[mochajs.org](https://mochajs.org) is built using [Eleventy](https://www.11ty.io/), a simple static site generator. + +## Prerequisites + +- Node.js v8.x or greater + +## Development + +1. Run `npm install` from working copy root to get Node.js deps. +1. To serve the site and rebuild as changes are made, execute `npm start docs.watch`. +1. To rebuild the site _once_, execute `npm start docs`. + +### Notes + +- The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc. +- This file (`docs/README.md`) should _not_ be included in the build. +- `docs/_dist` is where the deployed site lives. `docs/_site` is essentially a build step. These directories are _not_ under version control. +- See `package-scripts.js` for details on what the builds are actually doing; especially see [markdown-magic](https://npm.im/markdown-magic) for how we're dynamically inserting information into `docs/index.md`. + +## License + +:copyright: 2016-2018 [JS Foundation](https://js.foundation) and contributors. + +Content licensed [CC-BY-4.0](https://raw.githubusercontent.com/mochajs/mocha/master/docs/LICENSE-CC-BY-4.0). + +Code licensed [MIT](https://raw.githubusercontent.com/mochajs/mocha/master/LICENSE-MIT). diff --git a/docs/_headers b/docs/_headers new file mode 100644 index 0000000000..b70411ff02 --- /dev/null +++ b/docs/_headers @@ -0,0 +1,10 @@ +/* + X-Frame-Options: DENY + X-XSS-Protection: 1; mode=block + X-Content-Type-Options: nosniff + Strict-Transport-Security: max-age=31536000; includeSubDomains + Referrer-Policy: strict-origin-when-cross-origin + +## Far future expires for hashed file names +/static/* + Cache-Control: max-age=31536000 diff --git a/docs/_includes/backers.md b/docs/_includes/backers.md new file mode 100644 index 0000000000..4481202591 --- /dev/null +++ b/docs/_includes/backers.md @@ -0,0 +1,7 @@ +## Backers + +Find Mocha helpful? Become a [backer](https://opencollective.com/mochajs#support) and support Mocha with a monthly donation. + + +{% for i in (0..29) %}[![](https://opencollective.com/mochajs/backer/{{ i }}/avatar.jpg)](https://opencollective.com/mochajs/backer/{{ i }}/website){: target="_blank" rel="noopener"}{% endfor %} +{: .image-list id="_backers" } diff --git a/docs/_includes/default.html b/docs/_includes/default.html new file mode 100644 index 0000000000..baf940c829 --- /dev/null +++ b/docs/_includes/default.html @@ -0,0 +1,80 @@ + + + + + + {{ title }} + + + + + + + + + + +
+

+ + + +

+

simple, flexible, fun

+
+ +
{{ content }}
+ + + + + + diff --git a/docs/_includes/sponsors.md b/docs/_includes/sponsors.md new file mode 100644 index 0000000000..86c24b88f1 --- /dev/null +++ b/docs/_includes/sponsors.md @@ -0,0 +1,9 @@ +## Sponsors + +Use Mocha at Work? Ask your manager or marketing team if they'd help [support](https://opencollective.com/mochajs#support) our project. Your company's logo will also be displayed on [npmjs.com](http://npmjs.com/package/mocha) and our [GitHub repository](https://github.com/mochajs/mocha#sponsors). + + +{% for i in (0..15) %}[![](https://opencollective.com/mochajs/sponsor/{{ i }}/avatar.jpg)](https://opencollective.com/mochajs/sponsor/{{ i }}/website){: target="_blank"} {% endfor %} +{: .image-list .faded-images} + + diff --git a/docs/api-tutorials/custom-reporter.md b/docs/api-tutorials/custom-reporter.md new file mode 100644 index 0000000000..a0cfe48d66 --- /dev/null +++ b/docs/api-tutorials/custom-reporter.md @@ -0,0 +1,113 @@ +Mocha allows you to define and use custom reporters install via `npm`. + +For example, if `mocha-foo-reporter` was published to the npm registry, you could install it via `npm install mocha-foo-reporter --save-dev`, then use it via `mocha --reporter mocha-foo-reporter`. + +## Example Custom Reporter + +If you're looking to get started quickly, here's an example of a custom reporter: + + + +```js +// my-reporter.js +'use strict'; + +const Mocha = require('mocha'); +const { + EVENT_RUN_BEGIN, + EVENT_RUN_END, + EVENT_TEST_FAIL, + EVENT_TEST_PASS, + EVENT_SUITE_BEGIN, + EVENT_SUITE_END +} = Mocha.Runner.constants; + +// this reporter outputs test results, indenting two spaces per suite +class MyReporter { + constructor(runner) { + this._indents = 0; + const stats = runner.stats; + + runner + .once(EVENT_RUN_BEGIN, () => { + console.log('start'); + }) + .on(EVENT_SUITE_BEGIN, () => { + this.increaseIndent(); + }) + .on(EVENT_SUITE_END, () => { + this.decreaseIndent(); + }) + .on(EVENT_TEST_PASS, test => { + // Test#fullTitle() returns the suite name(s) + // prepended to the test title + console.log(`${this.indent()}pass: ${test.fullTitle()}`); + }) + .on(EVENT_TEST_FAIL, (test, err) => { + console.log( + `${this.indent()}fail: ${test.fullTitle()} - error: ${err.message}` + ); + }) + .once(EVENT_RUN_END, () => { + console.log(`end: ${stats.passes}/${stats.passes + stats.failures} ok`); + }); + } + + indent() { + return Array(this._indents).join(' '); + } + + increaseIndent() { + this._indents++; + } + + decreaseIndent() { + this._indents--; + } +} + +module.exports = MyReporter; +``` + + + +To use this reporter, execute `mocha --reporter /path/to/my-reporter.js`. + +For further examples, the built-in reporter implementations are the [best place to look](https://github.com/mochajs/mocha/tree/master/lib/reporters). The [integration tests](https://github.com/mochajs/mocha/tree/master/test/reporters) may also be helpful. + +## The `Base` Reporter Class + +[Base]{@link Mocha.reporters.Base} is an "abstract" class. It contains console-specific settings and utilities, commonly used by built-in reporters. Browsing the built-in reporter implementations, you may often see static properties of [Base]{@link Mocha.reporters.Base} referenced. + +It's often useful--but not necessary--for a custom reporter to extend [Base]{@link Mocha.reporters.Base}. + +## Statistics + +Mocha adds a `stats` property of type {@link StatsCollector} to the reporter's `Runner` instance (passed as first argument to constructor). + +## Events + +A reporter should listen for events emitted from the `runner` (a singleton instance of {@link Runner}). + +The event names are exported from the `constants` property of `Mocha.Runner`: + +| Constant | Event Name | Event Arguments | Description | +| -------------------- | ----------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| `EVENT_RUN_BEGIN` | `start` | _(n/a)_ | Execution will begin. | +| `EVENT_RUN_END` | `end` | _(n/a)_ | All [Suites]{@link Suite}, [Tests]{@link Test} and [Hooks]{@link Hook} have completed execution. | +| `EVENT_DELAY_BEGIN` | `waiting` | _(n/a)_ | Waiting for `global.run()` to be called; only emitted when [delay](/#delayed-root-suite) option is `true`. | +| `EVENT_DELAY_END` | `ready` | _(n/a)_ | User called `global.run()` and the root suite is ready to execute. | +| `EVENT_SUITE_BEGIN` | `suite` | `Suite` | The [Hooks]{@link Hook} and [Tests]{@link Test} within a {@link Suite} will be executed, including any nested [Suites]{@link Suite}. | +| `EVENT_SUITE_END` | `suite end` | `Suite` | The [Hooks]{@link Hook}, [Tests]{@link Test}, and nested [Suites]{@link Suite} within a {@link Suite} have completed execution. | +| `EVENT_HOOK_BEGIN` | `hook` | `Hook` | A {@link Hook} will be executed. | +| `EVENT_HOOK_END` | `hook end` | `Hook` | A {@link Hook} has completed execution. | +| `EVENT_TEST_BEGIN` | `test` | `Test` | A {@link Test} will be executed. | +| `EVENT_TEST_END` | `test end` | `Test` | A {@link Test} has completed execution. | +| `EVENT_TEST_FAIL` | `fail` | `Test`, `Error` | A {@link Test} has failed or thrown an exception. | +| `EVENT_TEST_PASS` | `pass` | `Test` | A {@link Test} has passed. | +| `EVENT_TEST_PENDING` | `pending` | `Test` | A {@link Test} was skipped. | +| `EVENT_TEST_RETRY` | `retry` | `Test`, `Error` | A {@link Test} failed, but is about to be retried; only emitted if the `retry` option is nonzero. | + +**Please use these constants** instead of the event names in your own reporter! This will ensure compatibility with future versions of Mocha. + +> It's important to understand that all `Suite` callbacks will be run _before_ the {@link Runner} emits `EVENT_RUN_BEGIN`. Hooks and tests, however, won't run until _after_ the {@link Runner} emits `EVENT_RUN_BEGIN`. diff --git a/docs/api-tutorials/jsdoc.tutorials.json b/docs/api-tutorials/jsdoc.tutorials.json new file mode 100644 index 0000000000..4880bf552f --- /dev/null +++ b/docs/api-tutorials/jsdoc.tutorials.json @@ -0,0 +1,5 @@ +{ + "custom-reporter": { + "title": "Create a Custom Reporter" + } +} diff --git a/docs/css/normalize.css b/docs/css/normalize.css new file mode 100644 index 0000000000..8710595d3e --- /dev/null +++ b/docs/css/normalize.css @@ -0,0 +1,422 @@ +/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */ + +/** + * 1. Change the default font family in all browsers (opinionated). + * 2. Correct the line height in all browsers. + * 3. Prevent adjustments of font size after orientation changes in IE and iOS. + */ + +html { + font-family: sans-serif; /* 1 */ + line-height: 1.15; /* 2 */ + -ms-text-size-adjust: 100%; /* 3 */ + -webkit-text-size-adjust: 100%; /* 3 */ +} + +/** + * Remove the margin in all browsers (opinionated). + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + * 1. Add the correct display in Edge, IE, and Firefox. + * 2. Add the correct display in IE. + */ + +article, +aside, +details, /* 1 */ +figcaption, +figure, +footer, +header, +main, /* 2 */ +menu, +nav, +section, +summary { /* 1 */ + display: block; +} + +/** + * Add the correct display in IE 9-. + */ + +audio, +canvas, +progress, +video { + display: inline-block; +} + +/** + * Add the correct display in iOS 4-7. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Add the correct display in IE 10-. + * 1. Add the correct display in IE. + */ + +template, /* 1 */ +[hidden] { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ + +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ +} + +/** + * Remove the outline on focused links when they are also active or hovered + * in all browsers (opinionated). + */ + +a:active, +a:hover { + outline-width: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * 1. Remove the bottom border in Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ + +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * Add the correct font style in Android 4.3-. + */ + +dfn { + font-style: italic; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Add the correct background and color in IE 9-. + */ + +mark { + background-color: #ff0; + color: #000; +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10-. + */ + +img { + border-style: none; +} + +/** + * Hide the overflow in IE. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct margin in IE 8. + */ + +figure { + margin: 1em 40px; +} + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change font properties to `inherit` in all browsers (opinionated). + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font: inherit; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Restore the font weight unset by the previous rule. + */ + +optgroup { + font-weight: bold; +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` + * controls in Android 4. + * 2. Correct the inability to style clickable types in iOS and Safari. + */ + +button, +html [type="button"], /* 1 */ +[type="reset"], +[type="submit"] { + -webkit-appearance: button; /* 2 */ +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Change the border, margin, and padding in all browsers (opinionated). + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Remove the default vertical scrollbar in IE. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10-. + * 2. Remove the padding in IE 10-. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding and cancel buttons in Chrome and Safari on OS X. + */ + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Correct the text style of placeholders in Chrome, Edge, and Safari. + */ + +::-webkit-input-placeholder { + color: inherit; + opacity: 0.54; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} diff --git a/docs/css/prism.css b/docs/css/prism.css new file mode 100644 index 0000000000..793fd5df2b --- /dev/null +++ b/docs/css/prism.css @@ -0,0 +1,148 @@ +/* PrismJS 1.15.0 +https://prismjs.com/download.html#themes=prism&languages=clike+javascript+bash+json */ + + +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + /* background: none; */ + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, +pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, +code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, +pre[class*="language-"] ::selection, +code[class*="language-"]::selection, +code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + + +/* Code blocks */ + +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre)>code[class*="language-"], +pre[class*="language-"] { + /* background: #f5f2f0; */ +} + + +/* Inline code */ + +:not(pre)>code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} diff --git a/docs/css/style.css b/docs/css/style.css new file mode 100644 index 0000000000..d59160b852 --- /dev/null +++ b/docs/css/style.css @@ -0,0 +1,270 @@ +html { + font: 16px/1.6 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +body { + border-top: 2px solid #ddd; + color: #2c2c2c; +} + +@keyframes fadein { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes slideright { + from { + transform: translateX(-45px); + } + + to { + transform: translateX(0); + } +} + +header, +#content { + margin: 0 auto; + max-width: 920px; + padding-left: 30px; + padding-right: 30px; +} + +header { + padding-top: 20px; +} + +#mocha-logo { + height: 192px; + width: 192px; +} + +#content { + padding-bottom: 60px; +} + +#_header h1 { + animation: fadein 1s forwards; + margin-top: 0; + margin-left: -19px; + opacity: 0; +} + +#tag { + animation: fadein 1s forwards, slideright 1s forwards; + color: #c29d7f; + font-size: 30px; + font-weight: 100; + letter-spacing: 2px; + margin-top: -158px; + margin-left: 185px; + margin-bottom: 125px; +} + +#tag em { + font-style: normal; +} + +nav.badges a + a { + margin-left: 3px; +} + +.image-list { + overflow: hidden; +} + +.image-list a { + float: left; + margin: 6px; +} + +.image-list a img { + display: block; + height: 64px; +} + +.faded-images img { + opacity: 0; + transition: opacity 0.3s; +} + +.faded-images.is-loaded img { + opacity: 1; +} + +#_backers a img { + background: url(/images/backer-background.svg?inline) center center no-repeat; + width: 64px; +} + +h2 { + border-bottom: 1px solid #ddd; + font-weight: 400; + letter-spacing: 1px; + margin-top: 80px; + text-transform: uppercase; +} + +h3 { + border-bottom: 1px solid #eee; + font-weight: 200; + letter-spacing: 1px; + margin-top: 40px; + text-transform: uppercase; +} + +h3 > code { + font-size: 14px; + text-transform: none; +} + +#content > p:first-child { + font-size: 20px; + font-weight: 200; + letter-spacing: 1px; +} + +a { + color: #8d6748; +} + +a:hover { + color: #717171; +} + +a.direct-link { + background: url(../images/link-icon.svg) center center no-repeat; + background-size: auto 60%; + opacity: 0; + overflow: hidden; + position: absolute; + text-decoration: none; + text-indent: -60px; + transform: translateX(-100%); + width: 30px; +} + +:hover > a.direct-link { + opacity: 1; +} + +ul { + box-sizing: content-box; + column-count: 2; + column-gap: 30px; + margin-top: 20px; + padding: 0 15px; +} + +ul li { + border-bottom: 1px solid #eee; + break-inside: avoid; + list-style: none; + margin-top: 5px; + padding: 5px 0; +} + +code { + font: 14px monaco, monospace; + line-height: 1.8; +} + +:not(pre) > code { + background-color: #f5f2f0; + border-radius: 3px; + padding: 0.2em 0.4em; +} + +pre { + background-color: #f3f3f3; + border: 1px solid #ddd; + border-bottom-color: #ccc; + border-radius: 3px; + box-shadow: inset 0 0 10px #ddd; + margin: 20px 0; + overflow-x: auto; + padding: 20px; +} + +img.screenshot { + border-radius: 3px; + box-shadow: 0 3px 10px #dedede, 0 1px 5px #888; + display: block; + margin: 30px auto; + max-width: 100%; +} + +#matomoLogo { + display: block; + height: 176px; +} + +.sponsorship { + display: flex; + justify-content: center; + margin-bottom: 60px; + align-items: center; +} + +.sponsorship a { + padding: 0 40px; +} + +footer { + background-color: #eee; + border-top: 1px solid #ddd; + padding: 50px 0; + text-align: right; +} + +footer div { + color: #888; + font-size: 0.8em; + margin-right: 30px; +} + +.last-modified { + font-style: italic; +} + +.dl-inline dt, +.dl-inline dd { + display: inline; + margin: 0; +} + +.dl-inline dt:after { + content: ': '; +} + +.dl-inline dd + dt:before { + content: ''; + display: block; +} + +@media all and (max-width: 600px) { + #tag { + margin-top: 0; + margin-left: 0; + margin-bottom: 0; + } + + ul { + column-count: 1; + } + + pre { + margin: 20px -11px; + padding: 10px; + } +} + +blockquote { + border-left: 1px solid #eee; + padding: 10px; +} diff --git a/docs/example/Array.js b/docs/example/Array.js new file mode 100644 index 0000000000..9be8287b65 --- /dev/null +++ b/docs/example/Array.js @@ -0,0 +1,74 @@ + +describe('Array', function(){ + describe('.push()', function(){ + it('should append a value', function(){ + var arr = []; + arr.push('foo'); + arr.push('bar'); + expect(arr[0]).to.equal('foo'); + expect(arr[1]).to.equal('bar'); + }) + + it('should return the length', function(){ + var arr = []; + var n = arr.push('foo'); + expect(n).to.equal(1); + n = arr.push('bar'); + expect(n).to.equal(2); + }) + + describe('with many arguments', function(){ + it('should add the values', function(){ + var arr = []; + arr.push('foo', 'bar'); + expect(arr[0]).to.equal('foo'); + expect(arr[1]).to.equal('bar'); + }) + }) + }) + + describe('.unshift()', function(){ + it('should prepend a value', function(){ + var arr = [1,2,3]; + arr.unshift('foo'); + expect(arr[0]).to.equal('foo'); + expect(arr[1]).to.equal(1); + }) + + it('should return the length', function(){ + var arr = []; + var n = arr.unshift('foo'); + expect(n).to.equal(1); + n = arr.unshift('bar'); + expect(n).to.equal(2); + }) + + describe('with many arguments', function(){ + it('should add the values', function(){ + var arr = []; + arr.unshift('foo', 'bar'); + expect(arr[0]).to.equal('foo'); + expect(arr[1]).to.equal('bar'); + }) + }) + }) + + describe('.pop()', function(){ + it('should remove and return the last value', function(){ + var arr = [1,2,3]; + expect(arr.pop()).to.equal(3); + expect(arr.pop()).to.equal(2); + expect(arr).to.have.length(1); + }) + }) + + describe('.shift()', function(){ + it('should remove and return the first value', function(){ + var arr = [1,2,3]; + expect(arr.shift()).to.equal(1); + expect(arr.shift()).to.equal(2); + expect(arr).to.have.length(1); + }) + }) +}) + diff --git a/docs/example/async-dump.js b/docs/example/async-dump.js new file mode 100644 index 0000000000..c1c15058bc --- /dev/null +++ b/docs/example/async-dump.js @@ -0,0 +1,33 @@ +'use strict'; + +const {createHook} = require('async_hooks'); +const {stackTraceFilter} = require('mocha/lib/utils'); +const allResources = new Map(); +const resourceActivity = new Set(); + +const filterStack = stackTraceFilter(); + +const hook = createHook({ + init(asyncId, type, triggerAsyncId) { + allResources.set(asyncId, {type, triggerAsyncId, stack: (new Error()).stack}); + }, + before(asyncId) { + resourceActivity.add(asyncId); + }, + after(asyncId) { + resourceActivity.delete(asyncId); + }, + destroy(asyncId) { + allResources.delete(asyncId); + } +}).enable(); + +global.asyncDump = module.exports = () => { + hook.disable(); + console.error('STUFF STILL IN THE EVENT LOOP:') + allResources.forEach(value=> { + console.error(`Type: ${value.type}`); + console.error(filterStack(value.stack)); + console.error('\n'); + }); +}; diff --git a/docs/example/debug-hanging-mocha.js b/docs/example/debug-hanging-mocha.js new file mode 100644 index 0000000000..fb36dc83c4 --- /dev/null +++ b/docs/example/debug-hanging-mocha.js @@ -0,0 +1,22 @@ +'use strict'; + +const net = require('net'); +const assert = require('assert'); + +describe('how to debug Mocha when it hangs', function () { + before(function (done) { + const server = net.createServer(); + server.listen(10101, done); + }); + + after(function () { + global.asyncDump(); + }); + + it('should complete, but Mocha should not exit', function(done) { + const sock = net.createConnection(10101, () => { + assert.deepEqual(sock.address().family, 'IPv4'); + done(); + }); + }); +}); \ No newline at end of file diff --git a/docs/example/tests.html b/docs/example/tests.html new file mode 100644 index 0000000000..77e99ddf2a --- /dev/null +++ b/docs/example/tests.html @@ -0,0 +1,20 @@ + + + + + Mocha + + + + +
+ + + + + + + + diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000000..8c773fc0e1 Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/images/backer-background.svg b/docs/images/backer-background.svg new file mode 100644 index 0000000000..29bd61663b --- /dev/null +++ b/docs/images/backer-background.svg @@ -0,0 +1,12 @@ + + + + + diff --git a/docs/images/emacs.png b/docs/images/emacs.png new file mode 100644 index 0000000000..ec3be76abe Binary files /dev/null and b/docs/images/emacs.png differ diff --git a/docs/images/jetbrains-plugin.png b/docs/images/jetbrains-plugin.png new file mode 100644 index 0000000000..f3423031ec Binary files /dev/null and b/docs/images/jetbrains-plugin.png differ diff --git a/docs/images/join-chat.svg b/docs/images/join-chat.svg new file mode 100644 index 0000000000..0edf5f3b1e --- /dev/null +++ b/docs/images/join-chat.svg @@ -0,0 +1 @@ +gittergitterjoin chatjoin chat \ No newline at end of file diff --git a/docs/images/link-icon.svg b/docs/images/link-icon.svg new file mode 100644 index 0000000000..dec74e6481 --- /dev/null +++ b/docs/images/link-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/docs/images/matomo-logo.png b/docs/images/matomo-logo.png new file mode 100644 index 0000000000..18b2d9e1c3 Binary files /dev/null and b/docs/images/matomo-logo.png differ diff --git a/docs/images/mocha-logo.svg b/docs/images/mocha-logo.svg new file mode 100644 index 0000000000..115b9bd6c2 --- /dev/null +++ b/docs/images/mocha-logo.svg @@ -0,0 +1,125 @@ + + + +Mocha Logoimage/svg+xmlMocha Logo08-21-2015Dick DeLeon <ddeleon@decipherinc.com>CC BY-SA 4.0mochamochajsChristopher Hiller <boneskull@boneskull.com> diff --git a/docs/images/mocha_side_bar.png b/docs/images/mocha_side_bar.png new file mode 100644 index 0000000000..56e39fe4d3 Binary files /dev/null and b/docs/images/mocha_side_bar.png differ diff --git a/docs/images/openjsf-logo.svg b/docs/images/openjsf-logo.svg new file mode 100644 index 0000000000..df9ab1f3b8 --- /dev/null +++ b/docs/images/openjsf-logo.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/reporter-doc.png b/docs/images/reporter-doc.png new file mode 100644 index 0000000000..c0b227f22b Binary files /dev/null and b/docs/images/reporter-doc.png differ diff --git a/docs/images/reporter-dot.png b/docs/images/reporter-dot.png new file mode 100644 index 0000000000..5477cb63f4 Binary files /dev/null and b/docs/images/reporter-dot.png differ diff --git a/docs/images/reporter-html.png b/docs/images/reporter-html.png new file mode 100644 index 0000000000..997d252b6c Binary files /dev/null and b/docs/images/reporter-html.png differ diff --git a/docs/images/reporter-json-stream.png b/docs/images/reporter-json-stream.png new file mode 100644 index 0000000000..19d5724709 Binary files /dev/null and b/docs/images/reporter-json-stream.png differ diff --git a/docs/images/reporter-json.png b/docs/images/reporter-json.png new file mode 100644 index 0000000000..249f49a566 Binary files /dev/null and b/docs/images/reporter-json.png differ diff --git a/docs/images/reporter-landing-fail.png b/docs/images/reporter-landing-fail.png new file mode 100644 index 0000000000..a90562c25e Binary files /dev/null and b/docs/images/reporter-landing-fail.png differ diff --git a/docs/images/reporter-landing.png b/docs/images/reporter-landing.png new file mode 100644 index 0000000000..fc9d443ad3 Binary files /dev/null and b/docs/images/reporter-landing.png differ diff --git a/docs/images/reporter-list.png b/docs/images/reporter-list.png new file mode 100644 index 0000000000..c7a68f1208 Binary files /dev/null and b/docs/images/reporter-list.png differ diff --git a/docs/images/reporter-min.png b/docs/images/reporter-min.png new file mode 100644 index 0000000000..55c45d6ffe Binary files /dev/null and b/docs/images/reporter-min.png differ diff --git a/docs/images/reporter-nyan.png b/docs/images/reporter-nyan.png new file mode 100644 index 0000000000..b21e0a4f43 Binary files /dev/null and b/docs/images/reporter-nyan.png differ diff --git a/docs/images/reporter-progress.png b/docs/images/reporter-progress.png new file mode 100644 index 0000000000..79237b388c Binary files /dev/null and b/docs/images/reporter-progress.png differ diff --git a/docs/images/reporter-spec-duration.png b/docs/images/reporter-spec-duration.png new file mode 100644 index 0000000000..d48e750e3e Binary files /dev/null and b/docs/images/reporter-spec-duration.png differ diff --git a/docs/images/reporter-spec-fail.png b/docs/images/reporter-spec-fail.png new file mode 100644 index 0000000000..e4910a7029 Binary files /dev/null and b/docs/images/reporter-spec-fail.png differ diff --git a/docs/images/reporter-spec.png b/docs/images/reporter-spec.png new file mode 100644 index 0000000000..2fd39d76eb Binary files /dev/null and b/docs/images/reporter-spec.png differ diff --git a/docs/images/reporter-string-diffs.png b/docs/images/reporter-string-diffs.png new file mode 100644 index 0000000000..f761c215b5 Binary files /dev/null and b/docs/images/reporter-string-diffs.png differ diff --git a/docs/images/reporter-tap.png b/docs/images/reporter-tap.png new file mode 100644 index 0000000000..054a6ef7cb Binary files /dev/null and b/docs/images/reporter-tap.png differ diff --git a/docs/images/test-duration-range.png b/docs/images/test-duration-range.png new file mode 100644 index 0000000000..26dcfc0460 Binary files /dev/null and b/docs/images/test-duration-range.png differ diff --git a/docs/images/wallaby.png b/docs/images/wallaby.png new file mode 100644 index 0000000000..ac68bac80e Binary files /dev/null and b/docs/images/wallaby.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000000..98c665b4f7 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,1939 @@ +--- +layout: default +title: 'Mocha - the fun, simple, flexible JavaScript test framework' +description: 'Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.' +--- + +Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in the browser, making asynchronous testing _simple_ and _fun_. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. Hosted on [GitHub][github-mocha]. + + + +{% include backers.md %} +{% include sponsors.md %} + +## Features + +- [browser support](#running-mocha-in-the-browser) +- [simple async support, including promises](#asynchronous-code) +- [test coverage reporting](#wallabyjs) +- [string diff support](#diffs) +- [javascript API for running tests](#more-information) +- proper exit status for CI support etc +- [auto-detects and disables coloring for non-ttys](#reporters) +- [maps uncaught exceptions to the correct test case](#browser-specific-methods) +- [async test timeout support](#delayed-root-suite) +- [test retry support](#retry-tests) +- [test-specific timeouts](#test-level) +- [Growl support](#desktop-notification-support) +- [reports test durations](#test-duration) +- [highlights slow tests](#dot-matrix) +- [file watcher support](#min) +- [global variable leak detection](#-check-leaks) +- [optionally run tests that match a regexp](#-grep-regexp-g-regexp) +- [auto-exit to prevent "hanging" with an active loop](#-exit) +- [easily meta-generate suites](#markdown) & [test-cases](#list) +- [config file support](#-config-path) +- [mocha.opts file support](#-opts-path) +- clickable suite titles to filter test execution +- [node debugger support](#-inspect-inspect-brk-inspect) +- [detects multiple calls to `done()`](#detects-multiple-calls-to-done) +- [use any assertion library you want](#assertions) +- [extensible reporting, bundled with 9+ reporters](#reporters) +- [extensible test DSLs or "interfaces"](#interfaces) +- [before, after, before each, after each hooks](#hooks) +- [arbitrary transpiler support (coffee-script etc)](#-compilers) +- [TextMate bundle](#textmate) + +## Table of Contents + + + +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Run Cycle Overview](#run-cycle-overview) +- [Detects Multiple Calls to `done()`](#detects-multiple-calls-to-done) +- [Assertions](#assertions) +- [Asynchronous Code](#asynchronous-code) +- [Synchronous Code](#synchronous-code) +- [Arrow Functions](#arrow-functions) +- [Hooks](#hooks) +- [Pending Tests](#pending-tests) +- [Exclusive Tests](#exclusive-tests) +- [Inclusive Tests](#inclusive-tests) +- [Retry Tests](#retry-tests) +- [Dynamically Generating Tests](#dynamically-generating-tests) +- [Timeouts](#timeouts) +- [Diffs](#diffs) +- [Command-Line Usage](#command-line-usage) +- [Interfaces](#interfaces) +- [Reporters](#reporters) +- [Running Mocha in the Browser](#running-mocha-in-the-browser) +- [Desktop Notification Support](#desktop-notification-support) +- [Configuring Mocha (Node.js)](#configuring-mocha-nodejs) +- [`mocha.opts`](#mochaopts) +- [The `test/` Directory](#the-test-directory) +- [Error Codes](#error-codes) +- [Editor Plugins](#editor-plugins) +- [Examples](#examples) +- [Testing Mocha](#testing-mocha) +- [More Information](#more-information) + + + +## Installation + +Install with [npm][] globally: + +```sh +$ npm install --global mocha +``` + +or as a development dependency for your project: + +```sh +$ npm install --save-dev mocha +``` + +> As of v7.0.0, Mocha requires Node.js v8.0.0 or newer. + +## Getting Started + +```sh +$ npm install mocha +$ mkdir test +$ $EDITOR test/test.js # or open with your favorite editor +``` + +In your editor: + +```js +var assert = require('assert'); +describe('Array', function() { + describe('#indexOf()', function() { + it('should return -1 when the value is not present', function() { + assert.equal([1, 2, 3].indexOf(4), -1); + }); + }); +}); +``` + +Back in the terminal: + +```sh +$ ./node_modules/mocha/bin/mocha + + Array + #indexOf() + ✓ should return -1 when the value is not present + + + 1 passing (9ms) +``` + +Set up a test script in package.json: + +```json +"scripts": { + "test": "mocha" +} +``` + +Then run tests with: + +```sh +$ npm test +``` + +## Run Cycle Overview + +A brief outline on the order Mocha's components are executed. +Worth noting that all hooks, `describe` and `it` callbacks are run in the order they are defined (i.e. found in the file). + +```js +run 'mocha spec.js' +| +spawn child process +| +|--------------> inside child process + process and apply options + | + run spec file/s + | + |--------------> per spec file + suite callbacks (e.g., 'describe') + | + 'before' root-level pre-hook + | + 'before' pre-hook + | + |--------------> per test + 'beforeEach' root-level pre-hook + | + 'beforeEach' pre-hook + | + test callbacks (e.g., 'it') + | + 'afterEach' post-hook + | + 'afterEach' root-level post-hook + |<-------------- per test end + | + 'after' post-hook + | + 'after' root-level post-hooks + |<-------------- per spec file end +|<-------------- inside child process end +``` + +## Detects Multiple Calls to `done()` + +If you use callback-based async tests, Mocha will throw an error if `done()` is called multiple times. This is handy for catching accidental double callbacks. + +```javascript +it('double done', function(done) { + // Calling `done()` twice is an error + setImmediate(done); + setImmediate(done); +}); +``` + +Running the above test will give you the below error message: + +```sh +$ ./node_modules/.bin/mocha mocha.test.js + + + ✓ double done + 1) double done + + 1 passing (6ms) + 1 failing + + 1) double done: + Error: done() called multiple times + at Object. (mocha.test.js:1:63) + at require (internal/module.js:11:18) + at Array.forEach () + at startup (bootstrap_node.js:187:16) + at bootstrap_node.js:608:3 +``` + +## Assertions + +Mocha allows you to use any assertion library you wish. In the above example, we're using Node.js' built-in [assert][node-assert] module — but generally, if it throws an `Error`, it will work! This means you can use libraries such as: + +- [should.js][] - BDD style shown throughout these docs +- [expect.js][] - `expect()` style assertions +- [chai][] - `expect()`, `assert()` and `should`-style assertions +- [better-assert][] - C-style self-documenting `assert()` +- [unexpected][] - "the extensible BDD assertion toolkit" + +## Asynchronous Code + +Testing asynchronous code with Mocha could not be simpler! Simply invoke the callback when your test is complete. By adding a callback (usually named `done`) to `it()`, Mocha will know that it should wait for this function to be called to complete the test. This callback accepts both an `Error` instance (or subclass thereof) _or_ a falsy value; anything else will cause a failed test. + +```js +describe('User', function() { + describe('#save()', function() { + it('should save without error', function(done) { + var user = new User('Luna'); + user.save(function(err) { + if (err) done(err); + else done(); + }); + }); + }); +}); +``` + +Alternatively, just use the `done()` callback directly (which will handle an error argument, if it exists): + +```js +describe('User', function() { + describe('#save()', function() { + it('should save without error', function(done) { + var user = new User('Luna'); + user.save(done); + }); + }); +}); +``` + +### Working with Promises + +Alternately, instead of using the `done()` callback, you may return a [Promise][mdn-promise]. This is useful if the APIs you are testing return promises instead of taking callbacks: + +```js +beforeEach(function() { + return db.clear().then(function() { + return db.save([tobi, loki, jane]); + }); +}); + +describe('#find()', function() { + it('respond with matching records', function() { + return db.find({type: 'User'}).should.eventually.have.length(3); + }); +}); +``` + +> The latter example uses [Chai as Promised][npm-chai-as-promised] for fluent promise assertions. + +In Mocha v3.0.0 and newer, returning a `Promise` _and_ calling `done()` will result in an exception, as this is generally a mistake: + +```js +const assert = require('assert'); + +// antipattern +it('should complete this test', function(done) { + return new Promise(function(resolve) { + assert.ok(true); + resolve(); + }).then(done); +}); +``` + +The above test will fail with `Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both.`. In versions older than v3.0.0, the call to `done()` is effectively ignored. + +### Using async / await + +If your JS environment supports [async / await][mdn-async], you can also write asynchronous tests like this: + +```js +beforeEach(async function() { + await db.clear(); + await db.save([tobi, loki, jane]); +}); + +describe('#find()', function() { + it('responds with matching records', async function() { + const users = await db.find({type: 'User'}); + users.should.have.length(3); + }); +}); +``` + +## Synchronous Code + +When testing synchronous code, omit the callback and Mocha will automatically continue on to the next test. + +```js +describe('Array', function() { + describe('#indexOf()', function() { + it('should return -1 when the value is not present', function() { + [1, 2, 3].indexOf(5).should.equal(-1); + [1, 2, 3].indexOf(0).should.equal(-1); + }); + }); +}); +``` + +## Arrow Functions + +Passing [arrow functions][mdn-arrow] (aka "lambdas") to Mocha is discouraged. Lambdas lexically bind `this` and cannot access the Mocha context. For example, the following code will fail: + +```js +describe('my suite', () => { + it('my test', () => { + // should set the timeout of this test to 1000 ms; instead will fail + this.timeout(1000); + assert.ok(true); + }); +}); +``` + +_If you do not need to use_ Mocha's context, lambdas should work. However, the result will be more difficult to refactor if the need eventually arises. + +## Hooks + +With its default "BDD"-style interface, Mocha provides the hooks `before()`, `after()`, `beforeEach()`, and `afterEach()`. These should be used to set up preconditions and clean up after your tests. + +```js +describe('hooks', function() { + before(function() { + // runs before all tests in this block + }); + + after(function() { + // runs after all tests in this block + }); + + beforeEach(function() { + // runs before each test in this block + }); + + afterEach(function() { + // runs after each test in this block + }); + + // test cases +}); +``` + +> Tests can appear before, after, or interspersed with your hooks. Hooks will run in the order they are defined, as appropriate; all `before()` hooks run (once), then any `beforeEach()` hooks, tests, any `afterEach()` hooks, and finally `after()` hooks (once). + +### Describing Hooks + +Any hook can be invoked with an optional description, making it easier to pinpoint errors in your tests. If a hook is given a named function, that name will be used if no description is supplied. + +```js +beforeEach(function() { + // beforeEach hook +}); + +beforeEach(function namedFun() { + // beforeEach:namedFun +}); + +beforeEach('some description', function() { + // beforeEach:some description +}); +``` + +### Asynchronous Hooks + +All hooks (`before()`, `after()`, `beforeEach()`, `afterEach()`) may be sync or async as well, behaving much like a regular test-case. For example, you may wish to populate database with dummy content before each test: + +```js +describe('Connection', function() { + var db = new Connection(), + tobi = new User('tobi'), + loki = new User('loki'), + jane = new User('jane'); + + beforeEach(function(done) { + db.clear(function(err) { + if (err) return done(err); + db.save([tobi, loki, jane], done); + }); + }); + + describe('#find()', function() { + it('respond with matching records', function(done) { + db.find({type: 'User'}, function(err, res) { + if (err) return done(err); + res.should.have.length(3); + done(); + }); + }); + }); +}); +``` + +### Root-Level Hooks + +You may also pick any file and add "root"-level hooks. For example, add `beforeEach()` outside of all `describe()` blocks. This will cause the callback to `beforeEach()` to run before any test case, regardless of the file it lives in (this is because Mocha has an _implied_ `describe()` block, called the "root suite"). + +```js +beforeEach(function() { + console.log('before every test in every file'); +}); +``` + +### Delayed Root Suite + +If you need to perform asynchronous operations before any of your suites are run, you may delay the root suite. Run `mocha` with the `--delay` flag. This will attach a special callback function, `run()`, to the global context: + +```js +setTimeout(function() { + // do some setup + + describe('my suite', function() { + // ... + }); + + run(); +}, 5000); +``` + +## Pending Tests + +"Pending"--as in "someone should write these test cases eventually"--test-cases are simply those _without_ a callback: + +```js +describe('Array', function() { + describe('#indexOf()', function() { + // pending test below + it('should return -1 when the value is not present'); + }); +}); +``` + +Pending tests will be included in the test results, and marked as pending. A pending test is not considered a failed test. + +## Exclusive Tests + +The exclusivity feature allows you to run _only_ the specified suite or test-case +by appending `.only()` to the function. Here's an example of executing only a particular suite: + +```js +describe('Array', function() { + describe.only('#indexOf()', function() { + // ... + }); +}); +``` + +_Note_: All nested suites will still be executed. + +Here's an example of executing an individual test case: + +```js +describe('Array', function() { + describe('#indexOf()', function() { + it.only('should return -1 unless present', function() { + // ... + }); + + it('should return the index when present', function() { + // ... + }); + }); +}); +``` + +Previous to v3.0.0, `.only()` used string matching to decide which tests to execute; this is no longer the case. In v3.0.0 or newer, `.only()` can be used multiple times to define a subset of tests to run: + +```js +describe('Array', function() { + describe('#indexOf()', function() { + it.only('should return -1 unless present', function() { + // this test will be run + }); + + it.only('should return the index when present', function() { + // this test will also be run + }); + + it('should return -1 if called with a non-Array context', function() { + // this test will not be run + }); + }); +}); +``` + +You may also choose multiple suites: + +```js +describe('Array', function() { + describe.only('#indexOf()', function() { + it('should return -1 unless present', function() { + // this test will be run + }); + + it('should return the index when present', function() { + // this test will also be run + }); + }); + + describe.only('#concat()', function() { + it('should return a new Array', function() { + // this test will also be run + }); + }); + + describe('#slice()', function() { + it('should return a new Array', function() { + // this test will not be run + }); + }); +}); +``` + +But _tests will have precedence_: + +```js +describe('Array', function() { + describe.only('#indexOf()', function() { + it.only('should return -1 unless present', function() { + // this test will be run + }); + + it('should return the index when present', function() { + // this test will not be run + }); + }); +}); +``` + +_Note_: Hooks, if present, will still be executed. + +> Be mindful not to commit usages of `.only()` to version control, unless you really mean it! To do so one can run mocha with the option `--forbid-only` in the continuous integration test command (or in a git precommit hook). + +## Inclusive Tests + +This feature is the inverse of `.only()`. By appending `.skip()`, you may tell Mocha to simply ignore test case(s). Anything skipped will be marked as [pending](#pending-tests), and reported as such. Here's an example of skipping an individual test: + +```js +describe('Array', function() { + describe('#indexOf()', function() { + it.skip('should return -1 unless present', function() { + // this test will not be run + }); + + it('should return the index when present', function() { + // this test will be run + }); + }); +}); +``` + +You can also put `.skip()` on an entire suite. This is equivalent to appending `.skip()` onto all tests in the suite. Hooks in the suite are also skipped. + +```js +describe('Array', function() { + describe.skip('#indexOf()', function() { + it('should return -1 unless present', function() { + // this test will not be run + }); + }); +}); +``` + +_Note_: Code in skipped suites, that is placed outside of hooks or tests is still executed, as mocha will still invoke the suite function to build up the suite structure for visualization. + +> _Best practice_: Use `.skip()` instead of commenting tests out. + +You may also skip _at runtime_ using `this.skip()`. If a test needs an environment or configuration which cannot be detected beforehand, a runtime skip is appropriate. For example: + +```js +it('should only test in the correct environment', function() { + if (/* check test environment */) { + // make assertions + } else { + this.skip(); + } +}); +``` + +The above test will be reported as [pending](#pending-tests). It's also important to note that calling `this.skip()` will effectively _abort_ the test. + +> _Best practice_: To avoid confusion, do not execute further instructions in a test or hook after calling `this.skip()`. + +Contrast the above test with the following code: + +```js +it('should only test in the correct environment', function() { + if (/* check test environment */) { + // make assertions + } else { + // do nothing + } +}); +``` + +Because this test _does nothing_, it will be reported as _passing_. + +> _Best practice_: Don't do nothing! A test should make an assertion or use `this.skip()`. + +To skip _multiple_ tests in this manner, use `this.skip()` in a "before all" hook: + +```js +before(function() { + if (/* check test environment */) { + // setup code + } else { + this.skip(); + } +}); +``` + +This will skip all `it`, `beforeEach/afterEach`, and `describe` blocks within the suite. `before/after` hooks are skipped unless they are defined at the same level as the hook containing `this.skip()`. + +```js +describe('outer', function() { + before(function() { + this.skip(); + }); + + after(function() { + // will be executed + }); + + describe('inner', function() { + before(function() { + // will be skipped + }); + + after(function() { + // will be skipped + }); + }); +}); +``` + +Skipping a test within an "after all" hook is deprecated and will throw an exception in a future version of Mocha. Use a return statement or other means to abort hook execution. + +> Before Mocha v3.0.0, `this.skip()` was not supported in asynchronous tests and hooks. + +## Retry Tests + +You can choose to retry failed tests up to a certain number of times. This feature is designed to handle end-to-end tests (functional tests/Selenium...) where resources cannot be easily mocked/stubbed. **It's not recommended to use this feature for unit tests**. + +This feature does re-run `beforeEach/afterEach` hooks but not `before/after` hooks. + +**NOTE**: Example below was written using Selenium webdriver (which [overwrites global Mocha hooks][selenium-webdriver-testing] for `Promise` chain). + +```js +describe('retries', function() { + // Retry all tests in this suite up to 4 times + this.retries(4); + + beforeEach(function() { + browser.get('http://www.yahoo.com'); + }); + + it('should succeed on the 3rd try', function() { + // Specify this test to only retry up to 2 times + this.retries(2); + expect($('.foo').isDisplayed()).to.eventually.be.true; + }); +}); +``` + +## Dynamically Generating Tests + +Given Mocha's use of `Function.prototype.call` and function expressions to define suites and test cases, it's straightforward to generate your tests dynamically. No special syntax is required — plain ol' JavaScript can be used to achieve functionality similar to "parameterized" tests, which you may have seen in other frameworks. + +Take the following example: + +```js +var assert = require('chai').assert; + +function add() { + return Array.prototype.slice.call(arguments).reduce(function(prev, curr) { + return prev + curr; + }, 0); +} + +describe('add()', function() { + var tests = [ + {args: [1, 2], expected: 3}, + {args: [1, 2, 3], expected: 6}, + {args: [1, 2, 3, 4], expected: 10} + ]; + + tests.forEach(function(test) { + it('correctly adds ' + test.args.length + ' args', function() { + var res = add.apply(null, test.args); + assert.equal(res, test.expected); + }); + }); +}); +``` + +The above code will produce a suite with three specs: + +```sh +$ mocha + + add() + ✓ correctly adds 2 args + ✓ correctly adds 3 args + ✓ correctly adds 4 args +``` + +

Test duration

+ +Many reporters will display test duration and flag tests that are slow (default: 75ms), as shown here with the "spec" reporter: + +![test duration](images/reporter-spec-duration.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"} + +There are three levels of test duration (depicted in the following image): + +1. FAST: Tests that run within half of the "slow" threshold will show the duration in green (if at all). +2. NORMAL: Tests that run exceeding half of the threshold (but still within it) will show the duration in yellow. +3. SLOW: Tests that run exceeding the threshold will show the duration in red. + +![test duration range](images/test-duration-range.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"} + +To tweak what's considered "slow", you can use the `slow()` method: + +```js +describe('something slow', function() { + this.slow(300000); // five minutes + + it('should take long enough for me to go make a sandwich', function() { + // ... + }); +}); +``` + +## Timeouts + +### Suite-level + +Suite-level timeouts may be applied to entire test "suites", or disabled via `this.timeout(0)`. This will be inherited by all nested suites and test-cases that do not override the value. + +```js +describe('a suite of tests', function() { + this.timeout(500); + + it('should take less than 500ms', function(done) { + setTimeout(done, 300); + }); + + it('should take less than 500ms as well', function(done) { + setTimeout(done, 250); + }); +}); +``` + +### Test-level + +Test-specific timeouts may also be applied, or the use of `this.timeout(0)` to disable timeouts all together: + +```js +it('should take less than 500ms', function(done) { + this.timeout(500); + setTimeout(done, 300); +}); +``` + +### Hook-level + +Hook-level timeouts may also be applied: + +```js +describe('a suite of tests', function() { + beforeEach(function(done) { + this.timeout(3000); // A very long environment setup. + setTimeout(done, 2500); + }); +}); +``` + +Again, use `this.timeout(0)` to disable the timeout for a hook. + +> In v3.0.0 or newer, a parameter passed to `this.timeout()` greater than the [maximum delay value][mdn-settimeout-maxdelay] will cause the timeout to be disabled. + +## Diffs + +Mocha supports the `err.expected` and `err.actual` properties of any thrown `AssertionError`s from an assertion library. Mocha will attempt to display the difference between what was expected, and what the assertion actually saw. Here's an example of a "string" diff: + +![string diffs](images/reporter-string-diffs.png?withoutEnlargement&resize=920,9999){:class="screenshot" lazyload="on"} + +## Command-Line Usage + + + +```text + +mocha [spec..] + +Run tests with Mocha + +Commands + mocha inspect [spec..] Run tests with Mocha [default] + mocha init create a client-side Mocha setup at + +Rules & Behavior + --allow-uncaught Allow uncaught errors to propagate [boolean] + --async-only, -A Require all tests to use a callback (async) or + return a Promise [boolean] + --bail, -b Abort ("bail") after first test failure [boolean] + --check-leaks Check for global variable leaks [boolean] + --delay Delay initial execution of root suite [boolean] + --exit Force Mocha to quit after tests complete [boolean] + --forbid-only Fail if exclusive test(s) encountered [boolean] + --forbid-pending Fail if pending test(s) encountered [boolean] + --global, --globals List of allowed global variables [array] + --retries Retry failed tests this many times [number] + --slow, -s Specify "slow" test threshold (in milliseconds) + [string] [default: 75] + --timeout, -t, --timeouts Specify test timeout threshold (in milliseconds) + [string] [default: 2000] + --ui, -u Specify user interface [string] [default: "bdd"] + +Reporting & Output + --color, -c, --colors Force-enable color output [boolean] + --diff Show diff on failure + [boolean] [default: true] + --full-trace Display full stack traces [boolean] + --growl, -G Enable Growl notifications [boolean] + --inline-diffs Display actual/expected differences + inline within each string [boolean] + --reporter, -R Specify reporter to use + [string] [default: "spec"] + --reporter-option, --reporter-options, Reporter-specific options + -O () [array] + +Configuration + --config Path to config file [string] [default: (nearest rc file)] + --opts Path to `mocha.opts` (DEPRECATED) + [string] [default: "./test/mocha.opts"] + --package Path to package.json for config [string] + +File Handling + --extension, --watch-extensions File extension(s) to load and/or watch + [array] [default: js] + --file Specify file(s) to be loaded prior to root + suite execution [array] [default: (none)] + --ignore, --exclude Ignore file(s) or glob pattern(s) + [array] [default: (none)] + --recursive Look for tests in subdirectories [boolean] + --require, -r Require module [array] [default: (none)] + --sort, -S Sort test files [boolean] + --watch, -w Watch files in the current working directory + for changes [boolean] + +Test Filters + --fgrep, -f Only run tests containing this string [string] + --grep, -g Only run tests matching this string or regexp [string] + --invert, -i Inverts --grep and --fgrep matches [boolean] + +Positional Arguments + spec One or more files, directories, or globs to test + [array] [default: ["test"]] + +Other Options + --help, -h Show usage information & exit [boolean] + --version, -V Show version number & exit [boolean] + --list-interfaces List built-in user interfaces & exit [boolean] + --list-reporters List built-in reporters & exit [boolean] + +Mocha Resources + Chat: https://gitter.im/mochajs/mocha + GitHub: https://github.com/mochajs/mocha.git + Docs: https://mochajs.org/ + +``` + + + +### `--allow-uncaught` + +By default, Mocha will attempt to trap uncaught exceptions thrown from running tests and report these as test failures. Use `--allow-uncaught` to disable this behavior and allow uncaught exceptions to propagate. Will typically cause the process to crash. + +This flag is useful when debugging particularly difficult-to-track exceptions. + +### `--async-only, -A` + +Enforce a rule that tests must be written in "async" style, meaning each test provides a `done` callback or returns a `Promise`. Non-compliant tests will be marked as failures. + +### `--bail, -b` + +Causes Mocha to stop running tests after the first test failure it encounters. Corresponding "after each" and "after all" hooks are executed for potential cleanup. + +`--bail` does _not_ imply `--exit`. + +### `--check-leaks` + +Use this option to have Mocha check for global variables that are leaked while running tests. Specify globals that are acceptable via the `--global` option (for example: `--check-leaks --global jQuery --global MyLib`). + +### `--compilers` + +> _`--compilers` was removed in v6.0.0. See [further explanation and workarounds][mocha-wiki-compilers]._ + +### `--exit` + +> _Updated in v4.0.0._ + +TL;DR: If your tests hang after an upgrade to Mocha v4.0.0 or newer, use `--exit` for a quick (though not necessarily recommended) fix. + +_Prior to_ version v4.0.0, _by default_, Mocha would force its own process to exit once it was finished executing all tests. This behavior enables a set of potential problems; it's indicative of tests (or fixtures, harnesses, code under test, etc.) which don't clean up after themselves properly. Ultimately, "dirty" tests can (but not always) lead to _false positive_ or _false negative_ results. + +"Hanging" most often manifests itself if a server is still listening on a port, or a socket is still open, etc. It can also be something like a runaway `setInterval()`, or even an errant `Promise` that never fulfilled. + +The _default behavior_ in v4.0.0 (and newer) is `--no-exit`, where previously it was `--exit`. + +**The easiest way to "fix" the issue is to simply pass `--exit` to the Mocha process.** It _can_ be time-consuming to debug — because it's not always obvious where the problem is — but it _is_ recommended to do so. + +To ensure your tests aren't leaving messes around, here are some ideas to get started: + +- See the [Node.js guide to debugging][node-inspector] +- Use the new [`async_hooks`][node-async-hooks] API ([example][gist-async-hooks]) +- Try something like [wtfnode][npm-wtfnode] +- Use [`.only`](#exclusive-tests) until you find the test that causes Mocha to hang + +### `--forbid-only` + +Enforce a rule that tests may not be exclusive (use of e.g., `describe.only()` or `it.only()` is disallowed). + +`--forbid-only` causes Mocha to fail when an exclusive ("only'd") test or suite is encountered, and it will abort further test execution. + +### `--forbid-pending` + +Enforce a rule that tests may not be skipped (use of e.g., `describe.skip()`, `it.skip()`, or `this.skip()` anywhere is disallowed). + +`--forbid-pending` causes Mocha to fail when a skipped ("pending") test or suite is encountered, and it will abort further test execution. + +### `--global ` + +> _Updated in v6.0.0; the option is `--global` and `--globals` is now an alias._ + +Define a global variable name. For example, suppose your app deliberately exposes a global named `app` and `YUI`, you may want to add `--global app --global YUI`. + +`--global` accepts wildcards. You could do `--global '*bar'` and it would match `foobar`, `barbar`, etc. You can also simply pass in `'*'` to ignore all globals. + +`--global` can accept a comma-delimited list; `--global app,YUI` is equivalent to `--global app --global YUI`. + +By using this option in conjunction with `--check-leaks`, you can specify a whitelist of known global variables that you _expect_ to leak into global scope. + +### `--retries ` + +Retries failed tests `n` times. + +Mocha does not retry test failures by default. + +### `--slow , -s ` + +Specify the "slow" test threshold in milliseconds. Mocha uses this to highlight test cases that are taking too long. "Slow" tests are not considered failures. + +Note: A test that executes for _half_ of the "slow" time will be highlighted _in yellow_ with the default `spec` reporter; a test that executes for entire "slow" time will be highlighted _in red_. + +### `--timeout , -t ` + +> _Update in v6.0.0: `--no-timeout` is implied when invoking Mocha using inspect flags. It is equivalent to `--timeout 0`. `--timeout 99999999` is no longer needed._ + +Specifies the test case timeout, defaulting to two (2) seconds (2000 milliseconds). Tests taking longer than this amount of time will be marked as failed. + +To override you may pass the timeout in milliseconds, or a value with the `s` suffix, e.g., `--timeout 2s` and `--timeout 2000` are equivalent. + +To disable timeouts, use `--no-timeout`. + +Note: synchronous (blocking) tests are also bound by the timeout, but they will not complete until the code stops blocking. Infinite loops will still be infinite loops! + +### `--ui , -u ` + +The `--ui` option lets you specify the interface to use, defaulting to `bdd`. + +### `--color, -c, --colors` + +> _Updated in v6.0.0. `--colors` is now an alias for `--color`._ + +"Force" color output to be enabled, or alternatively force it to be disabled via `--no-color`. By default, Mocha uses the [supports-color][npm-supports-color] module to decide. + +In some cases, color output will be explicitly suppressed by certain reporters outputting in a machine-readable format. + +### `--diff` + +When possible, show the difference between expected and actual values when an assertion failure is encountered. + +This flag is unusual in that it **defaults to `true`**; use `--no-diff` to suppress Mocha's own diff output. + +Some assertion libraries will supply their own diffs, in which case Mocha's will not be used, regardless of the default value. + +Mocha's own diff output does not conform to any known standards, and is designed to be human-readable. + +### `--full-trace` + +Enable "full" stack traces. By default, Mocha attempts to distill stack traces into less noisy (though still useful) output. + +This flag is helpful when debugging a suspected issue within Mocha or Node.js itself. + +### `--growl, -G` + +Enable [Growl][] (or OS-level notifications where available). + +Requires extra software to be installed; see the [growl module's docs][npm-growl] for more information. + +### `--inline-diffs` + +Enable "inline" diffs, an alternative output for diffing strings. + +Useful when working with large strings. + +Does nothing if an assertion library supplies its own diff output. + +### `--reporter , -R ` + +Specify the reporter that will be used, defaulting to `spec`. + +Allows use of third-party reporters. For example, [mocha-lcov-reporter][npm-mocha-lcov-reporter] may be used with `--reporter mocha-lcov-reporter` after it has been installed. + +### `--reporter-option