Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mochajs/mocha
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5064c282d13259925af05845026686bbe435d763
Choose a base ref
...
head repository: mochajs/mocha
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cc51b8fb42c4919e1304724bdb1a90699d17cf85
Choose a head ref
Loading
Showing with 45,254 additions and 22,863 deletions.
  1. +1 −1 .browserslistrc
  2. +1 −1 .eleventy.js
  3. +2 −0 .eslintignore
  4. +5 −2 .eslintrc.yml
  5. +2 −2 .github/CONTRIBUTING.md
  6. +20 −0 .github/workflows/delete-runs.yml
  7. +14 −10 .github/workflows/mocha.yml
  8. +2 −1 .github/workflows/stale.yml
  9. +1 −0 .gitignore
  10. +9 −0 AUTHORS
  11. +155 −41 CHANGELOG.md
  12. +1 −1 LICENSE
  13. +1 −1 MAINTAINERS.md
  14. +1 −1 README.md
  15. +18 −27 bin/mocha
  16. +27 −20 browser-entry.js
  17. +12 −8 docs/_data/supporters.js
  18. +10 −0 docs/css/style.css
  19. +1 −0 docs/css/supporters.css
  20. +80 −44 docs/index.md
  21. +9 −6 example/config/.mocharc.js
  22. +8 −6 example/config/.mocharc.yml
  23. +12 −0 karma.conf.js
  24. +328 −0 karma_no-ie11.conf.js
  25. +5 −5 lib/browser/growl.js
  26. +1 −1 lib/browser/parse-query.js
  27. +6 −6 lib/browser/progress.js
  28. +3 −2 lib/cli/cli.js
  29. +1 −1 lib/cli/config.js
  30. +2 −8 lib/cli/lookup-files.js
  31. +2 −5 lib/cli/node-flags.js
  32. +1 −2 lib/cli/one-and-dones.js
  33. +7 −7 lib/cli/run-helpers.js
  34. +4 −0 lib/cli/run-option-metadata.js
  35. +13 −1 lib/cli/run.js
  36. +3 −6 lib/cli/watch-run.js
  37. +5 −5 lib/context.js
  38. +3 −3 lib/errors.js
  39. +0 −58 lib/esm-utils.js
  40. +9 −3 lib/hook.js
  41. +23 −20 lib/interfaces/bdd.js
  42. +7 −7 lib/interfaces/common.js
  43. +1 −1 lib/interfaces/exports.js
  44. +7 −7 lib/interfaces/qunit.js
  45. +9 −9 lib/interfaces/tdd.js
  46. +97 −81 lib/mocha.js
  47. +17 −1 lib/nodejs/buffered-worker-pool.js
  48. +124 −0 lib/nodejs/esm-utils.js
  49. +32 −34 lib/reporters/base.js
  50. +4 −4 lib/reporters/doc.js
  51. +5 −5 lib/reporters/dot.js
  52. +12 −12 lib/reporters/html.js
  53. +4 −4 lib/reporters/json-stream.js
  54. +35 −10 lib/reporters/json.js
  55. +5 −5 lib/reporters/landing.js
  56. +5 −5 lib/reporters/list.js
  57. +5 −5 lib/reporters/markdown.js
  58. +1 −1 lib/reporters/min.js
  59. +16 −16 lib/reporters/nyan.js
  60. +3 −3 lib/reporters/progress.js
  61. +6 −6 lib/reporters/spec.js
  62. +17 −17 lib/reporters/tap.js
  63. +9 −9 lib/reporters/xunit.js
  64. +21 −21 lib/runnable.js
  65. +63 −61 lib/runner.js
  66. +7 −7 lib/stats-collector.js
  67. +46 −75 lib/suite.js
  68. +5 −5 lib/test.js
  69. +19 −114 lib/utils.js
  70. +2 −2 netlify.toml
  71. +40,029 −18,544 package-lock.json
  72. +5 −4 package-scripts.js
  73. +59 −59 package.json
  74. +3 −1 rollup.config.js
  75. +46 −0 rollup_no-ie11.config.js
  76. +1 −1 scripts/karma-rollup-plugin.js
  77. +0 −25 scripts/linkify-changelog.js
  78. +23 −0 scripts/linkify-changelog.mjs
  79. +5 −5 scripts/netlify-headers.js
  80. +2 −4 scripts/update-authors.js
  81. +1 −1 test/assertions.js
  82. +2 −2 test/browser-specific/esm.spec.mjs
  83. +1 −0 test/browser-specific/fixtures/webpack/webpack.config.js
  84. +1 −1 test/browser-specific/requirejs-setup.js
  85. +3 −3 test/integration/color.spec.js
  86. +3 −3 test/integration/compiler-globbing.spec.js
  87. +31 −9 test/integration/config.spec.js
  88. +3 −3 test/integration/deprecate.spec.js
  89. +10 −13 test/integration/diffs.spec.js
  90. +16 −15 test/integration/duplicate-arguments.spec.js
  91. +57 −20 test/integration/esm.spec.js
  92. +41 −39 test/integration/events.spec.js
  93. +64 −68 test/integration/file-utils.spec.js
  94. +11 −0 test/integration/fixtures/config/mocharcWithThrowError.js
  95. +1 −0 test/integration/fixtures/esm/dir-cjs-require/index.js
  96. +18 −0 test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs
  97. +1 −0 ...ation/fixtures/esm/loader-with-module-not-found/test-that-imports-non-existing-module.fixture.mjs
  98. +2 −0 ...ration/fixtures/esm/loader-with-module-not-found/test-that-imports-non-existing-module.fixture.ts
  99. +4 −0 test/integration/fixtures/esm/test-that-uses-dir-cjs-require.fixture.js/index.js
  100. +3 −0 test/integration/fixtures/esm/type-module/package.json
  101. +6 −0 test/integration/fixtures/esm/type-module/test-that-imports-non-existing-module.fixture.js
  102. +1 −1 test/integration/fixtures/exit.fixture.js
  103. +35 −0 test/integration/fixtures/options/dry-run/dry-run.fixture.js
  104. +7 −0 test/integration/fixtures/parallel/testworkerid1.mjs
  105. +7 −0 test/integration/fixtures/parallel/testworkerid2.mjs
  106. +9 −0 test/integration/fixtures/parallel/testworkerid3.mjs
  107. +28 −28 test/integration/glob.spec.js
  108. +11 −7 test/integration/helpers.js
  109. +37 −37 test/integration/hook-err.spec.js
  110. +8 −8 test/integration/hooks.spec.js
  111. +10 −10 test/integration/init.spec.js
  112. +4 −4 test/integration/invalid-arguments.spec.js
  113. +42 −36 test/integration/multiple-done.spec.js
  114. +11 −11 test/integration/multiple-runs.spec.js
  115. +7 −7 test/integration/no-diff.spec.js
  116. +23 −22 test/integration/only.spec.js
  117. +5 −5 test/integration/options/allowUncaught.spec.js
  118. +6 −6 test/integration/options/asyncOnly.spec.js
  119. +16 −16 test/integration/options/bail.spec.js
  120. +3 −3 test/integration/options/compilers.spec.js
  121. +8 −8 test/integration/options/delay.spec.js
  122. +30 −0 test/integration/options/dryRun.spec.js
  123. +9 −9 test/integration/options/exit.spec.js
  124. +5 −5 test/integration/options/extension.spec.js
  125. +22 −0 test/integration/options/failZero.spec.js
  126. +7 −7 test/integration/options/file.spec.js
  127. +20 −20 test/integration/options/forbidOnly.spec.js
  128. +11 −11 test/integration/options/forbidPending.spec.js
  129. +25 −21 test/integration/options/grep.spec.js
  130. +8 −8 test/integration/options/ignore.spec.js
  131. +4 −4 test/integration/options/invert.spec.js
  132. +5 −5 test/integration/options/jobs.spec.js
  133. +6 −6 test/integration/options/listInterfaces.spec.js
  134. +6 −6 test/integration/options/listReporters.spec.js
  135. +19 −3 test/integration/options/node-flags.spec.js
  136. +3 −3 test/integration/options/opts.spec.js
  137. +62 −74 test/integration/options/parallel.spec.js
  138. +8 −8 test/integration/options/reporter-option.spec.js
  139. +3 −3 test/integration/options/retries.spec.js
  140. +4 −4 test/integration/options/sort.spec.js
  141. +59 −40 test/integration/options/timeout.spec.js
  142. +15 −14 test/integration/options/ui.spec.js
  143. +25 −25 test/integration/options/watch.spec.js
  144. +21 −16 test/integration/parallel.spec.js
  145. +74 −72 test/integration/pending.spec.js
  146. +29 −29 test/integration/plugins/global-fixtures.spec.js
  147. +33 −52 test/integration/plugins/root-hooks.spec.js
  148. +15 −15 test/integration/regression.spec.js
  149. +43 −49 test/integration/reporters.spec.js
  150. +15 −15 test/integration/retries.spec.js
  151. +24 −20 test/integration/suite.spec.js
  152. +5 −5 test/integration/timeout.spec.js
  153. +24 −24 test/integration/uncaught.spec.js
  154. +26 −24 test/interfaces/bdd.spec.js
  155. +6 −6 test/interfaces/exports.spec.js
  156. +3 −3 test/interfaces/qunit.spec.js
  157. +9 −9 test/interfaces/tdd.spec.js
  158. +1 −1 test/jsapi/index.js
  159. +35 −35 test/node-unit/buffered-worker-pool.spec.js
  160. +28 −28 test/node-unit/cli/config.spec.js
  161. +23 −29 test/node-unit/cli/node-flags.spec.js
  162. +70 −70 test/node-unit/cli/options.spec.js
  163. +39 −32 test/node-unit/cli/run-helpers.spec.js
  164. +5 −5 test/node-unit/cli/run.spec.js
  165. +66 −66 test/node-unit/mocha.spec.js
  166. +53 −53 test/node-unit/parallel-buffered-runner.spec.js
  167. +17 −17 test/node-unit/reporters/parallel-buffered.spec.js
  168. +90 −90 test/node-unit/serializer.spec.js
  169. +15 −15 test/node-unit/stack-trace-filter.spec.js
  170. +11 −11 test/node-unit/utils.spec.js
  171. +35 −35 test/node-unit/worker.spec.js
  172. +4 −4 test/only/bdd-require.spec.js
  173. +3 −3 test/only/global/bdd.spec.js
  174. +3 −3 test/only/global/qunit.spec.js
  175. +3 −3 test/only/global/tdd.spec.js
  176. +75 −45 test/reporters/base.spec.js
  177. +22 −22 test/reporters/doc.spec.js
  178. +35 −35 test/reporters/dot.spec.js
  179. +14 −14 test/reporters/helpers.js
  180. +28 −30 test/reporters/json-stream.spec.js
  181. +190 −101 test/reporters/json.spec.js
  182. +14 −14 test/reporters/landing.spec.js
  183. +22 −22 test/reporters/list.spec.js
  184. +12 −12 test/reporters/markdown.spec.js
  185. +7 −7 test/reporters/min.spec.js
  186. +67 −67 test/reporters/nyan.spec.js
  187. +13 −13 test/reporters/progress.spec.js
  188. +18 −18 test/reporters/spec.spec.js
  189. +63 −63 test/reporters/tap.spec.js
  190. +71 −71 test/reporters/xunit.spec.js
  191. +2 −2 test/require/require.spec.js
  192. +2 −2 test/smoke/smoke.spec.js
  193. +25 −25 test/unit/context.spec.js
  194. +10 −10 test/unit/duration.spec.js
  195. +32 −32 test/unit/errors.spec.js
  196. +8 −8 test/unit/globals.spec.js
  197. +13 −13 test/unit/grep.spec.js
  198. +15 −15 test/unit/hook-async.spec.js
  199. +11 −11 test/unit/hook-sync-nested.spec.js
  200. +10 −10 test/unit/hook-sync.spec.js
  201. +3 −3 test/unit/hook-timeout.spec.js
  202. +10 −10 test/unit/hook.spec.js
  203. +298 −281 test/unit/mocha.spec.js
  204. +2 −2 test/unit/overspecified-async.spec.js
  205. +3 −3 test/unit/parse-query.spec.js
  206. +104 −106 test/unit/plugin-loader.spec.js
  207. +4 −5 test/unit/required-tokens.spec.js
  208. +3 −3 test/unit/root.spec.js
  209. +186 −186 test/unit/runnable.spec.js
  210. +214 −212 test/unit/runner.spec.js
  211. +147 −157 test/unit/suite.spec.js
  212. +29 −29 test/unit/test.spec.js
  213. +39 −37 test/unit/throw.spec.js
  214. +19 −19 test/unit/timeout.spec.js
  215. +108 −172 test/unit/utils.spec.js
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node >= 10
node >= 12
last 2 Chrome versions
last 2 Edge versions
last 2 Firefox versions
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(eleventyConfig) {
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(
require('@11ty/eleventy-plugin-inclusive-language'),
{
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
coverage/
mocha.js
mocha.js.map
mocha-es2018.js
*.fixture.js
docs/_site
docs/api
7 changes: 5 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ parserOptions:
jsx: false
sourceType: script
rules:
no-var: 0
strict:
- error
- safe
@@ -35,13 +36,15 @@ overrides:
env:
browser: false
- files:
- esm-utils.js
- lib/nodejs/esm-utils.js
- rollup.config.js
- rollup_no-ie11.config.js
- scripts/pick-from-package-json.js
parserOptions:
ecmaVersion: 2018
sourceType: module
parser: babel-eslint
requireConfigFile: false # for @babel/eslint-parser
parser: '@babel/eslint-parser'
env:
browser: false
- files:
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [

> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start <command>` (powered by [nps](https://npm.im/nps)).
1. [Install Node.js 10.12.0 or newer](https://nodejs.org/en/download/).
1. [Install Node.js 14 LTS or newer with npm@7+](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.
@@ -58,7 +58,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [
- 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 [GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Windows+CI%22)). The first step to ensuring these checks pass is to test on your own machine.
- Ultimately, your pull request will be built on our continuous integration servers ([GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Tests%22)). 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`).
20 changes: 20 additions & 0 deletions .github/workflows/delete-runs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Delete workflow runs
on:
workflow_dispatch:
inputs:
days:
description: 'Number of days'
required: true
default: 180

jobs:
del_runs:
runs-on: ubuntu-latest
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: 10
24 changes: 14 additions & 10 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Tests
'on':
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
types:
- opened
@@ -25,10 +29,10 @@ jobs:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
- 16
- 17
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
@@ -44,15 +48,15 @@ jobs:
steps:
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
key: "ubuntu-latest-node-v14-${{ hashFiles('**/package-lock.json') }}"
key: "ubuntu-latest-node-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-v14-
ubuntu-latest-node-v16-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: 'Check lint'
@@ -70,13 +74,13 @@ jobs:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
- 16
- 17
include:
- os: ubuntu-latest
node: 14
node: 16
env:
COVERAGE: 1
steps:
@@ -179,17 +183,17 @@ jobs:
steps:
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v14-
ubuntu-latest-node-full-v16-
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
3 changes: 2 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
- uses: actions/stale@v4
with:
days-before-stale: 120
days-before-close: 14
@@ -22,3 +22,4 @@ jobs:
Thanks for contributing to Mocha!
exempt-issue-labels: browser,chore,confirmed-bug,developer-experience,documentation,faq,feature,future,good-first-issue,help wanted,nice-to-have,qa,reporter,unconfirmed-bug,usability
exempt-pr-labels: browser,chore,confirmed-bug,developer-experience,documentation,faq,feature,future,needs-review,nice-to-have,qa,reporter,semver-major,semver-minor,semver-patch,usability
operations-per-run: 200
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ docs/images/supporters
docs/api
mocha.js
mocha.js.map
mocha-es2018.js
.karma/
!lib/mocha.js

9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -522,5 +522,14 @@ Maxwell Gerber <mgerber@berkeley.edu>
Sebastian Noack <sebastian.noack@gmail.com>
Christian Bromann <github@christian-bromann.com>
Alexander Fenster <github@fenster.name>
MoonSupport <jiwon3346@naver.com>
Dayzen <syeuty@naver.com>
Alexander Fenster <fenster@google.com>
kirill-golovan <57108967+kirill-golovan@users.noreply.github.com>
Michal Dorner <dorner.michal@gmail.com>
Curtis Man <curtism@microsoft.com>
华 <1395348685z@gmail.com>
Andrei Rusu <beatfactor@users.noreply.github.com>
Quentin Barbe <forty@everteam.org>

# Generated by scripts/update-authors.js
Loading