Repository: mochajs/mocha Branch: main Commit: bb66555ea7e9 Files: 611 Total size: 1.6 MB Directory structure: gitextract_zvdgtjox/ ├── .browserslistrc ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── DEVELOPMENT.md │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── 01-bug.yml │ │ ├── 02-documentation.yml │ │ ├── 03-feature-request.yml │ │ ├── 04-performance.yml │ │ ├── 05-repository-tooling.yml │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── dependabot.yml │ ├── release-please/ │ │ ├── config.json │ │ └── manifest.json │ └── workflows/ │ ├── mocha.yml │ ├── nightly-site-deploy.yml │ ├── npm-script.yml │ ├── octoguide.yml │ └── release-please.yml ├── .gitignore ├── .knip.jsonc ├── .lintstagedrc.json ├── .mailmap ├── .mocharc.yml ├── .npmrc ├── .nycrc ├── .prettierignore ├── .wallaby.js ├── AUTHORS ├── CHANGELOG.md ├── FUNDING.md ├── LICENSE ├── MAINTAINERS.md ├── PROJECT_CHARTER.md ├── README.md ├── SECURITY.md ├── bin/ │ ├── _mocha │ └── mocha.js ├── browser-entry.js ├── docs/ │ ├── .gitignore │ ├── .knip.jsonc │ ├── .prettierrc.json │ ├── README.md │ ├── _data/ │ │ ├── blocklist.json │ │ └── supporters.cjs │ ├── _redirects │ ├── astro.config.ts │ ├── netlify.toml │ ├── package.json │ ├── public/ │ │ └── example/ │ │ ├── Array.js │ │ └── tests.html │ ├── src/ │ │ ├── components/ │ │ │ ├── Badges.astro │ │ │ ├── ClientRedirects.astro │ │ │ ├── FixtureWizard.astro │ │ │ ├── Footer.astro │ │ │ ├── Head.astro │ │ │ ├── HomepagePageTitle.astro │ │ │ ├── PageTitle.astro │ │ │ └── Supporters.astro │ │ ├── content/ │ │ │ ├── config.ts │ │ │ ├── data/ │ │ │ │ └── sponsors.json │ │ │ └── docs/ │ │ │ ├── declaring/ │ │ │ │ ├── dynamic-tests.mdx │ │ │ │ ├── exclusive-tests.mdx │ │ │ │ ├── inclusive-tests.mdx │ │ │ │ ├── pending-tests.mdx │ │ │ │ └── retrying-tests.mdx │ │ │ ├── explainers/ │ │ │ │ ├── compilers-deprecation.mdx │ │ │ │ ├── count-assertions.mdx │ │ │ │ ├── detecting-multiple-calls-to-done.mdx │ │ │ │ ├── environment-variables.mdx │ │ │ │ ├── find-global-leaks.mdx │ │ │ │ ├── global-variables.mdx │ │ │ │ ├── nodejs-native-esm-support.mdx │ │ │ │ ├── programmatic-usage.mdx │ │ │ │ ├── related-tools.mdx │ │ │ │ ├── run-cycle-overview.mdx │ │ │ │ ├── security-vulnerability-reports.mdx │ │ │ │ ├── shared-behaviours.mdx │ │ │ │ ├── spies.mdx │ │ │ │ ├── stub-stdout.mdx │ │ │ │ ├── tagging.mdx │ │ │ │ ├── test-duration.mdx │ │ │ │ ├── test-fixture-decision-tree.mdx │ │ │ │ ├── third-party-reporters.mdx │ │ │ │ └── third-party-uis.mdx │ │ │ ├── features/ │ │ │ │ ├── arrow-functions.mdx │ │ │ │ ├── assertions.mdx │ │ │ │ ├── asynchronous-code.mdx │ │ │ │ ├── diffs.mdx │ │ │ │ ├── error-codes.mdx │ │ │ │ ├── global-fixtures.mdx │ │ │ │ ├── hooks.mdx │ │ │ │ ├── parallel-mode.mdx │ │ │ │ ├── root-hook-plugins.mdx │ │ │ │ └── timeouts.mdx │ │ │ ├── getting-started.mdx │ │ │ ├── index.mdx │ │ │ ├── interfaces/ │ │ │ │ ├── about.mdx │ │ │ │ ├── bdd.mdx │ │ │ │ ├── exports.mdx │ │ │ │ ├── qunit.mdx │ │ │ │ ├── require.mdx │ │ │ │ ├── tdd.mdx │ │ │ │ └── third-party.mdx │ │ │ ├── reporters/ │ │ │ │ ├── about.mdx │ │ │ │ ├── doc.mdx │ │ │ │ ├── dot.mdx │ │ │ │ ├── html.mdx │ │ │ │ ├── json-stream.mdx │ │ │ │ ├── json.mdx │ │ │ │ ├── landing.mdx │ │ │ │ ├── list.mdx │ │ │ │ ├── markdown.mdx │ │ │ │ ├── min.mdx │ │ │ │ ├── nyan.mdx │ │ │ │ ├── progress.mdx │ │ │ │ ├── spec.mdx │ │ │ │ ├── tap.mdx │ │ │ │ ├── third-party.mdx │ │ │ │ └── xunit.mdx │ │ │ └── running/ │ │ │ ├── browsers.mdx │ │ │ ├── cli.mdx │ │ │ ├── configuring.mdx │ │ │ ├── editor-plugins.mdx │ │ │ └── test-globs.mdx │ │ ├── env.d.ts │ │ └── style/ │ │ └── custom.css │ └── tsconfig.json ├── eslint.config.js ├── example/ │ └── config/ │ ├── .mocharc.js │ ├── .mocharc.json │ ├── .mocharc.jsonc │ ├── .mocharc.yml │ └── README.md ├── index.js ├── karma.conf.js ├── lib/ │ ├── browser/ │ │ ├── highlight-tags.js │ │ ├── parse-query.js │ │ └── template.html │ ├── cli/ │ │ ├── cli.js │ │ ├── collect-files.js │ │ ├── commands.js │ │ ├── config.js │ │ ├── index.js │ │ ├── init.js │ │ ├── lookup-files.js │ │ ├── node-flags.js │ │ ├── one-and-dones.js │ │ ├── options.js │ │ ├── run-helpers.js │ │ ├── run-option-metadata.js │ │ ├── run.js │ │ └── watch-run.js │ ├── context.js │ ├── error-constants.js │ ├── errors.js │ ├── hook.js │ ├── interfaces/ │ │ ├── bdd.js │ │ ├── common.js │ │ ├── exports.js │ │ ├── index.js │ │ ├── qunit.js │ │ └── tdd.js │ ├── mocha.js │ ├── mocharc.json │ ├── nodejs/ │ │ ├── buffered-worker-pool.js │ │ ├── esm-utils.js │ │ ├── file-unloader.js │ │ ├── parallel-buffered-runner.js │ │ ├── reporters/ │ │ │ └── parallel-buffered.js │ │ ├── serializer.js │ │ └── worker.js │ ├── pending.js │ ├── plugin-loader.js │ ├── reporters/ │ │ ├── base.js │ │ ├── doc.js │ │ ├── dot.js │ │ ├── html.js │ │ ├── index.js │ │ ├── json-stream.js │ │ ├── json.js │ │ ├── landing.js │ │ ├── list.js │ │ ├── markdown.js │ │ ├── min.js │ │ ├── nyan.js │ │ ├── progress.js │ │ ├── spec.js │ │ ├── tap.js │ │ └── xunit.js │ ├── runnable.js │ ├── runner.js │ ├── stats-collector.js │ ├── suite.js │ ├── test.js │ ├── types.d.ts │ └── utils.js ├── mocha.css ├── mocha.mjs ├── netlify.toml ├── package.json ├── renovate.json ├── rollup.config.mjs ├── scripts/ │ ├── karma-rollup-plugin.js │ ├── linkify-changelog.mjs │ ├── pick-from-package-json.mjs │ └── update-authors.js ├── test/ │ ├── README.md │ ├── assertions.js │ ├── browser-specific/ │ │ ├── esm.spec.mjs │ │ ├── fixtures/ │ │ │ ├── esm.fixture.mjs │ │ │ └── webpack/ │ │ │ ├── webpack.config.js │ │ │ └── webpack.fixture.mjs │ │ └── setup.js │ ├── compiler/ │ │ ├── test.coffee │ │ └── test.foo │ ├── compiler-cjs/ │ │ ├── test.js │ │ ├── test.js.compiled │ │ ├── test.ts │ │ └── test.ts.compiled │ ├── compiler-esm/ │ │ ├── package.json │ │ ├── test-tla.js │ │ ├── test-tla.js.compiled │ │ ├── test-tla.mjs │ │ ├── test-tla.mjs.compiled │ │ ├── test-tla.ts │ │ ├── test-tla.ts.compiled │ │ ├── test.js │ │ ├── test.js.compiled │ │ ├── test.mjs │ │ ├── test.mjs.compiled │ │ ├── test.ts │ │ └── test.ts.compiled │ ├── compiler-fixtures/ │ │ ├── esm-loader.fixture.mjs │ │ ├── esm-only-loader/ │ │ │ ├── README.md │ │ │ ├── esm-loader.fixture.mjs │ │ │ ├── esm.fixture.js │ │ │ └── package.json │ │ ├── esm.fixture.js │ │ ├── foo.fixture.js │ │ ├── js.fixture.js │ │ └── ts.fixture.js │ ├── integration/ │ │ ├── README.md │ │ ├── color.spec.js │ │ ├── common-js-require.spec.js │ │ ├── compiler-cjs.spec.js │ │ ├── compiler-esm-only-loader.spec.js │ │ ├── compiler-esm.spec.js │ │ ├── compiler-globbing.spec.js │ │ ├── config.spec.js │ │ ├── deprecate.spec.js │ │ ├── diffs.spec.js │ │ ├── duplicate-arguments.spec.js │ │ ├── esm.spec.js │ │ ├── events.spec.js │ │ ├── fifo.spec.js │ │ ├── file-utils.spec.js │ │ ├── fixtures/ │ │ │ ├── __default__.fixture.js │ │ │ ├── cascade.fixture.js │ │ │ ├── collect-files.fixture.mjs │ │ │ ├── common-js-require.fixture.js │ │ │ ├── config/ │ │ │ │ ├── mocha-config/ │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ ├── mocharc.cjs │ │ │ │ ├── mocharc.js │ │ │ │ ├── mocharc.json │ │ │ │ ├── mocharc.mjs │ │ │ │ ├── mocharc.yaml │ │ │ │ └── mocharcWithThrowError.js │ │ │ ├── current-test-title.fixture.js │ │ │ ├── deprecate.fixture.js │ │ │ ├── diffs/ │ │ │ │ ├── diffs.css.in │ │ │ │ ├── diffs.css.out │ │ │ │ ├── diffs.fixture.js │ │ │ │ └── output │ │ │ ├── esm/ │ │ │ │ ├── add.mjs │ │ │ │ ├── dir-cjs-require/ │ │ │ │ │ └── index.js │ │ │ │ ├── esm-failure.fixture.mjs │ │ │ │ ├── esm-success.fixture.mjs │ │ │ │ ├── js-folder/ │ │ │ │ │ ├── add.js │ │ │ │ │ ├── esm-in-js.fixture.js │ │ │ │ │ └── package.json │ │ │ │ ├── loader-with-module-not-found/ │ │ │ │ │ ├── loader-that-recognizes-ts.mjs │ │ │ │ │ ├── test-that-imports-non-existing-module.fixture.mjs │ │ │ │ │ └── test-that-imports-non-existing-module.fixture.ts │ │ │ │ ├── syntax-error/ │ │ │ │ │ └── esm-syntax-error.fixture.mjs │ │ │ │ ├── test-that-uses-dir-cjs-require.fixture.js/ │ │ │ │ │ └── index.js │ │ │ │ └── type-module/ │ │ │ │ ├── package.json │ │ │ │ └── test-that-imports-non-existing-module.fixture.js │ │ │ ├── exit.fixture.js │ │ │ ├── failing-sync.fixture.js │ │ │ ├── failing.fixture.js │ │ │ ├── glob/ │ │ │ │ ├── glob.spec.js │ │ │ │ └── nested/ │ │ │ │ └── glob.spec.js │ │ │ ├── hooks/ │ │ │ │ ├── after-each-hook-async-error.fixture.js │ │ │ │ ├── after-each-hook-error.fixture.js │ │ │ │ ├── after-each-this-test-error.fixture.js │ │ │ │ ├── after-hook-async-error.fixture.js │ │ │ │ ├── after-hook-deepnested-error.fixture.js │ │ │ │ ├── after-hook-error.fixture.js │ │ │ │ ├── after-hook-nested-error.fixture.js │ │ │ │ ├── before-each-hook-async-error.fixture.js │ │ │ │ ├── before-each-hook-error-with-fail-affected.fixture.js │ │ │ │ ├── before-each-hook-error.fixture.js │ │ │ │ ├── before-each-hook-throw-non-error.fixture.js │ │ │ │ ├── before-hook-async-error-tip.fixture.js │ │ │ │ ├── before-hook-async-error.fixture.js │ │ │ │ ├── before-hook-deepnested-error.fixture.js │ │ │ │ ├── before-hook-error-tip.fixture.js │ │ │ │ ├── before-hook-error-with-fail-affected.fixture.js │ │ │ │ ├── before-hook-error.fixture.js │ │ │ │ ├── before-hook-nested-error.fixture.js │ │ │ │ ├── before-hook-root-error.fixture.js │ │ │ │ ├── before-hook-throw-non-error.fixture.js │ │ │ │ ├── multiple-hook-async-error.fixture.js │ │ │ │ └── multiple-hook-error.fixture.js │ │ │ ├── multiple-done-async.fixture.js │ │ │ ├── multiple-done-before-each.fixture.js │ │ │ ├── multiple-done-before.fixture.js │ │ │ ├── multiple-done-specs.fixture.js │ │ │ ├── multiple-done-with-error.fixture.js │ │ │ ├── multiple-done.fixture.js │ │ │ ├── multiple-runs/ │ │ │ │ ├── clean-references.fixture.js │ │ │ │ ├── dispose.fixture.js │ │ │ │ ├── multiple-runs-with-different-output-suite.fixture.js │ │ │ │ ├── multiple-runs-with-flaky-before-each-suite.fixture.js │ │ │ │ ├── multiple-runs-with-flaky-before-each.fixture.js │ │ │ │ ├── run-thrice-helper.js │ │ │ │ ├── run-thrice.fixture.js │ │ │ │ ├── start-second-run-if-previous-is-still-running-suite.fixture.js │ │ │ │ └── start-second-run-if-previous-is-still-running.fixture.js │ │ │ ├── no-diff.fixture.js │ │ │ ├── options/ │ │ │ │ ├── allow-uncaught/ │ │ │ │ │ ├── propagate.fixture.js │ │ │ │ │ └── this-skip-it.fixture.js │ │ │ │ ├── async-only-async.fixture.js │ │ │ │ ├── async-only-sync.fixture.js │ │ │ │ ├── bail-async.fixture.js │ │ │ │ ├── bail-with-after.fixture.js │ │ │ │ ├── bail-with-afterEach.fixture.js │ │ │ │ ├── bail-with-before.fixture.js │ │ │ │ ├── bail-with-beforeEach.fixture.js │ │ │ │ ├── bail-with-test.fixture.js │ │ │ │ ├── bail.fixture.js │ │ │ │ ├── delay-fail.fixture.js │ │ │ │ ├── delay-only.fixture.js │ │ │ │ ├── delay.fixture.js │ │ │ │ ├── dry-run/ │ │ │ │ │ ├── dry-run.fixture.js │ │ │ │ │ └── stack-size.fixture.js │ │ │ │ ├── extension/ │ │ │ │ │ ├── test1.fixture.js │ │ │ │ │ └── test2.fixture.coffee │ │ │ │ ├── file-alpha.fixture.js │ │ │ │ ├── file-beta.fixture.js │ │ │ │ ├── file-theta.fixture.js │ │ │ │ ├── forbid-only/ │ │ │ │ │ ├── only-before-each.fixture.js │ │ │ │ │ ├── only-before.fixture.js │ │ │ │ │ ├── only-empty-suite.fixture.js │ │ │ │ │ ├── only-suite.fixture.js │ │ │ │ │ ├── only.fixture.js │ │ │ │ │ └── passed.fixture.js │ │ │ │ ├── forbid-pending/ │ │ │ │ │ ├── before-this-skip.fixture.js │ │ │ │ │ ├── beforeEach-this-skip.fixture.js │ │ │ │ │ ├── passed.fixture.js │ │ │ │ │ ├── pending.fixture.js │ │ │ │ │ ├── skip-empty-suite.fixture.js │ │ │ │ │ ├── skip-suite.fixture.js │ │ │ │ │ ├── skip.fixture.js │ │ │ │ │ └── this-skip.fixture.js │ │ │ │ ├── grep.fixture.js │ │ │ │ ├── ignore/ │ │ │ │ │ ├── fail.fixture.js │ │ │ │ │ ├── nested/ │ │ │ │ │ │ ├── fail.fixture.js │ │ │ │ │ │ └── pass.fixture.js │ │ │ │ │ └── pass.fixture.js │ │ │ │ ├── jobs/ │ │ │ │ │ └── fail-in-parallel.fixture.js │ │ │ │ ├── only/ │ │ │ │ │ ├── bdd.fixture.js │ │ │ │ │ ├── qunit.fixture.js │ │ │ │ │ └── tdd.fixture.js │ │ │ │ ├── parallel/ │ │ │ │ │ ├── bail.fixture.js │ │ │ │ │ ├── exclusive-test-a.fixture.js │ │ │ │ │ ├── exclusive-test-b.fixture.js │ │ │ │ │ ├── retries-a.fixture.js │ │ │ │ │ ├── retries-b.fixture.js │ │ │ │ │ ├── syntax-err.fixture.js │ │ │ │ │ ├── test-a.fixture.js │ │ │ │ │ ├── test-b.fixture.js │ │ │ │ │ ├── test-c.fixture.js │ │ │ │ │ ├── test-d.fixture.js │ │ │ │ │ └── uncaught.fixture.js │ │ │ │ ├── reporter-esm.fixture.mjs │ │ │ │ ├── reporter-with-options.fixture.js │ │ │ │ ├── retries.fixture.js │ │ │ │ ├── slow-test.fixture.js │ │ │ │ ├── sort-alpha.fixture.js │ │ │ │ ├── sort-beta.fixture.js │ │ │ │ ├── timeout-unref.fixture.js │ │ │ │ └── watch/ │ │ │ │ ├── dependency.fixture.js │ │ │ │ ├── hook.fixture.js │ │ │ │ ├── test-file-change.fixture.js │ │ │ │ └── test-with-dependency.fixture.js │ │ │ ├── parallel/ │ │ │ │ ├── circular-error-array.mjs │ │ │ │ ├── circular-error-object.mjs │ │ │ │ ├── getter-error-object.mjs │ │ │ │ ├── non-circular-error.mjs │ │ │ │ ├── test1.mjs │ │ │ │ ├── test2.mjs │ │ │ │ ├── test3.mjs │ │ │ │ ├── testworkerid1.mjs │ │ │ │ ├── testworkerid2.mjs │ │ │ │ └── testworkerid3.mjs │ │ │ ├── passing-async.fixture.js │ │ │ ├── passing-sync.fixture.js │ │ │ ├── passing.fixture.js │ │ │ ├── pending/ │ │ │ │ ├── programmatic.fixture.js │ │ │ │ ├── skip-async-before-hooks.fixture.js │ │ │ │ ├── skip-async-before-nested.fixture.js │ │ │ │ ├── skip-async-before.fixture.js │ │ │ │ ├── skip-async-beforeEach.fixture.js │ │ │ │ ├── skip-async-spec.fixture.js │ │ │ │ ├── skip-hierarchy.fixture.js │ │ │ │ ├── skip-shorthand.fixture.js │ │ │ │ ├── skip-sync-after.fixture.js │ │ │ │ ├── skip-sync-before-hooks.fixture.js │ │ │ │ ├── skip-sync-before-inner.fixture.js │ │ │ │ ├── skip-sync-before-nested.fixture.js │ │ │ │ ├── skip-sync-before.fixture.js │ │ │ │ ├── skip-sync-beforeEach-cond.fixture.js │ │ │ │ ├── skip-sync-beforeEach.fixture.js │ │ │ │ ├── skip-sync-spec.fixture.js │ │ │ │ └── spec.fixture.js │ │ │ ├── plugins/ │ │ │ │ ├── global-fixtures/ │ │ │ │ │ ├── global-setup-teardown-multiple.fixture.js │ │ │ │ │ ├── global-setup-teardown.fixture.js │ │ │ │ │ ├── global-setup.fixture.js │ │ │ │ │ └── global-teardown.fixture.js │ │ │ │ └── root-hooks/ │ │ │ │ ├── esm/ │ │ │ │ │ ├── package.json │ │ │ │ │ └── root-hook-defs-esm.fixture.js │ │ │ │ ├── root-hook-defs-a.fixture.js │ │ │ │ ├── root-hook-defs-b.fixture.js │ │ │ │ ├── root-hook-defs-c.fixture.js │ │ │ │ ├── root-hook-defs-d.fixture.js │ │ │ │ ├── root-hook-defs-esm-broken.fixture.js │ │ │ │ ├── root-hook-defs-esm.fixture.mjs │ │ │ │ ├── root-hook-test-2.fixture.js │ │ │ │ └── root-hook-test.fixture.js │ │ │ ├── regression/ │ │ │ │ ├── issue-1991.fixture.js │ │ │ │ ├── issue-2315.fixture.js │ │ │ │ ├── issue-2406.fixture.js │ │ │ │ └── issue-2417.fixture.js │ │ │ ├── reporters.fixture.js │ │ │ ├── retries/ │ │ │ │ ├── async.fixture.js │ │ │ │ ├── early-pass.fixture.js │ │ │ │ ├── hooks.fixture.js │ │ │ │ └── nested.fixture.js │ │ │ ├── runner/ │ │ │ │ ├── events-bail-retries.fixture.js │ │ │ │ ├── events-bail.fixture.js │ │ │ │ ├── events-basic.fixture.js │ │ │ │ ├── events-delay.fixture.js │ │ │ │ └── events-retries.fixture.js │ │ │ ├── signals-sigabrt.fixture.js │ │ │ ├── signals-sigterm-numeric.fixture.js │ │ │ ├── signals-sigterm.fixture.js │ │ │ ├── simple-reporter.js │ │ │ ├── simple-ui.fixture.js │ │ │ ├── simple-ui.fixture.mjs │ │ │ ├── suite/ │ │ │ │ ├── suite-no-callback.fixture.js │ │ │ │ ├── suite-returning-value.fixture.js │ │ │ │ ├── suite-skipped-callback.fixture.js │ │ │ │ └── suite-skipped-no-callback.fixture.js │ │ │ ├── test-for-simple-ui.fixture.js │ │ │ ├── timeout-chained-call.fixture.js │ │ │ ├── timeout-override.fixture.js │ │ │ ├── timeout.fixture.js │ │ │ └── uncaught/ │ │ │ ├── after-runner.fixture.js │ │ │ ├── double.fixture.js │ │ │ ├── fatal.fixture.js │ │ │ ├── hook.fixture.js │ │ │ ├── issue-1327.fixture.js │ │ │ ├── issue-1417.fixture.js │ │ │ ├── listeners.fixture.js │ │ │ ├── pending.fixture.js │ │ │ ├── recover.fixture.js │ │ │ └── unhandled.fixture.js │ │ ├── glob.spec.js │ │ ├── helpers.js │ │ ├── hook-err.spec.js │ │ ├── hooks.spec.js │ │ ├── init.spec.js │ │ ├── invalid-arguments.spec.js │ │ ├── multiple-done.spec.js │ │ ├── multiple-runs.spec.js │ │ ├── no-diff.spec.js │ │ ├── only.spec.js │ │ ├── options/ │ │ │ ├── allowUncaught.spec.js │ │ │ ├── asyncOnly.spec.js │ │ │ ├── bail.spec.js │ │ │ ├── delay.spec.js │ │ │ ├── dryRun.spec.js │ │ │ ├── exit.spec.js │ │ │ ├── extension.spec.js │ │ │ ├── failZero.spec.js │ │ │ ├── file.spec.js │ │ │ ├── forbidOnly.spec.js │ │ │ ├── forbidPending.spec.js │ │ │ ├── grep.spec.js │ │ │ ├── ignore.spec.js │ │ │ ├── invert.spec.js │ │ │ ├── jobs.spec.js │ │ │ ├── listInterfaces.spec.js │ │ │ ├── listReporters.spec.js │ │ │ ├── node-flags.spec.js │ │ │ ├── parallel.spec.js │ │ │ ├── passOnFailingTestSuite.spec.js │ │ │ ├── posixExitCodes.spec.js │ │ │ ├── reporter-option.spec.js │ │ │ ├── reporter.spec.js │ │ │ ├── retries.spec.js │ │ │ ├── sort.spec.js │ │ │ ├── timeout.spec.js │ │ │ ├── ui.spec.js │ │ │ └── watch.spec.js │ │ ├── parallel.spec.js │ │ ├── pending.spec.js │ │ ├── plugins/ │ │ │ ├── global-fixtures.spec.js │ │ │ └── root-hooks.spec.js │ │ ├── regression.spec.js │ │ ├── reporters.spec.js │ │ ├── retries.spec.js │ │ ├── suite.spec.js │ │ ├── timeout.spec.js │ │ └── uncaught.spec.js │ ├── interfaces/ │ │ ├── bdd.spec.js │ │ ├── exports.spec.js │ │ ├── qunit.spec.js │ │ └── tdd.spec.js │ ├── jsapi/ │ │ └── index.js │ ├── node-unit/ │ │ ├── buffered-worker-pool.spec.js │ │ ├── cli/ │ │ │ ├── config.spec.js │ │ │ ├── fixtures/ │ │ │ │ ├── bad-module.fixture.js │ │ │ │ └── bad-require.fixture.js │ │ │ ├── mocha-flags.spec.js │ │ │ ├── node-flags.spec.js │ │ │ ├── options.spec.js │ │ │ ├── run-helpers.spec.js │ │ │ └── run.spec.js │ │ ├── esm-utils.spec.js │ │ ├── fixtures/ │ │ │ ├── broken-default-import.mjs │ │ │ ├── broken-syntax.ts │ │ │ ├── dumb-module.fixture.js │ │ │ ├── dumber-module.fixture.js │ │ │ ├── mock-mocha-forbidden-exclusivity-err.ts │ │ │ ├── mock-ts-node-compile-err.ts │ │ │ ├── module-without-default-export.mjs │ │ │ └── wonky-reporter.fixture.js │ │ ├── mocha.spec.js │ │ ├── parallel-buffered-runner.spec.js │ │ ├── reporters/ │ │ │ └── parallel-buffered.spec.js │ │ ├── serializer.spec.js │ │ ├── stack-trace-filter.spec.js │ │ ├── utils.spec.js │ │ └── worker.spec.js │ ├── only/ │ │ ├── bdd-require.spec.js │ │ └── global/ │ │ ├── bdd.spec.js │ │ ├── qunit.spec.js │ │ └── tdd.spec.js │ ├── reporters/ │ │ ├── base.spec.js │ │ ├── doc.spec.js │ │ ├── dot.spec.js │ │ ├── helpers.js │ │ ├── json-stream.spec.js │ │ ├── json.spec.js │ │ ├── landing.spec.js │ │ ├── list.spec.js │ │ ├── markdown.spec.js │ │ ├── min.spec.js │ │ ├── nyan.spec.js │ │ ├── progress.spec.js │ │ ├── spec.spec.js │ │ ├── tap.spec.js │ │ └── xunit.spec.js │ ├── require/ │ │ ├── a.js │ │ ├── b.coffee │ │ ├── c.js │ │ ├── d.coffee │ │ └── require.spec.js │ ├── setup.js │ ├── smoke/ │ │ └── smoke.spec.js │ └── unit/ │ ├── context.spec.js │ ├── duration.spec.js │ ├── errors.spec.js │ ├── globals.spec.js │ ├── grep.spec.js │ ├── hook-async.spec.js │ ├── hook-sync-nested.spec.js │ ├── hook-sync.spec.js │ ├── hook-timeout.spec.js │ ├── hook.spec.js │ ├── mocha.spec.js │ ├── overspecified-async.spec.js │ ├── parse-query.spec.js │ ├── plugin-loader.spec.js │ ├── required-tokens.spec.js │ ├── root.spec.js │ ├── runnable.spec.js │ ├── runner.spec.js │ ├── suite.spec.js │ ├── test.spec.js │ ├── throw.spec.js │ ├── timeout.spec.js │ └── utils.spec.js └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .browserslistrc ================================================ node >= 14 last 2 Chrome versions last 2 Edge versions last 2 Firefox versions last 2 Safari versions last 2 Opera versions unreleased Chrome versions unreleased Edge versions unreleased Firefox versions unreleased Safari versions unreleased Opera versions ================================================ FILE: .editorconfig ================================================ # This file is for unifying the coding style for different editors and IDEs # editorconfig.org root = true [*] end_of_line = lf charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 ================================================ FILE: .gitattributes ================================================ * text=auto eol=lf ================================================ FILE: .github/CODE_OF_CONDUCT.md ================================================ # 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 wrong, or says something accidentally offensive, respond with patience and try to keep it polite and civil. Remember that 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 OpenJS Foundation community should be respectful when dealing with other members as well as with people outside the OpenJS 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. ## When we disagree, try to understand why Disagreements, both social and technical, happen all the time and OpenJS 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 OpenJS Foundation comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues 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 . # 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: - [Contributor Covenant v1.4.1 in english](https://www.contributor-covenant.org/version/1/4/code-of-conduct) - [Contributor Covenant v1.4.1 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/cross-project-council/tree/main/proposals/approved/CODE_OF_CONDUCT). ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Contributing to Mocha > Please read these guidelines before submitting an issue, filing a feature request, or contributing code. ## ❓ Got a Question? If you have a question about using Mocha, please use [StackOverflow](https://stackoverflow.com) or ask the friendly people in [our Discord](https://discord.gg/KeDn2uXhER). ## ✏️ Filing Issues Before adding anything to the issue tracker, **please [search issues](https://github.com/mochajs/mocha/issues) to see if it's already been reported**. Make sure to check closed and/or older issues as well. With the exception of minor documentation typos, all changes to Mocha should be discussed in the issue tracker first. This includes bugs, feature requests, and improvements to documentation. ### 🐛 I Found a Bug Sorry! It happens to the best of us. Please [file an issue using the bug report template](https://github.com/mochajs/mocha/issues/new?assignees=&labels=type%3A+bug&projects=&template=01-bug.yml&title=%F0%9F%90%9B+Bug%3A+%3Cshort+description+of+the+bug%3E) with _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). If we need more information from you, we'll let you know. If you don't within a few weeks, your issue will be closed for inactivity. ### ❗️ Propose a Change Please [file an issue using the feature request template](https://github.com/mochajs/mocha/issues/new?assignees=&labels=type%3A+feature&projects=&template=03-feature-request.yml&title=%F0%9F%9A%80+Feature%3A+%3Cshort+description+of+the+feature%3E). Most importantly: - Let us know _what_ the proposed change is, in as much detail as you can - Explain _why_ you want the change - Include your test code or file(s). If large, please provide a link to a repository or [gist](https://gist.github.com). We'll discuss your proposed changes and how they relate to the overarching goals of Mocha, detailed below in [⚽️ About Project Goals](#%EF%B8%8F-about-project-goals). ## ⚽️ About Project Goals Mocha is a test framework. Developers use it against anything from legacy spaghetti in barely-supported browsers to stage-0 TC39 features in Electron. Mocha is committed to providing support for maintained (LTS) versions of Node.js and popular browsers. 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. We ask you please keep these goals in mind when making or proposing changes. ## 😇 I Just Want To Help _Excellent._ Here's how: - **Handy with JavaScript?** Please check out the issues labeled [`status: accepting prs`](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+accepting+prs%22) or [`good first issue`](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+). 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%3A%22area%3A+documentation%22). - **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/orgs/mochajs/people). - **Do 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 [our Discord's `#help` channel](https://discord.gg/KeDn2uXhER)? ## 🙋 Frequently Asked Questions ### Can I work on this issue? Anyone can work on any issue marked `status: accepting prs` 🙂 Please check if there is already a PR for this issue, and if it's still being worked on. If it hasn't been updated for over a week, you're welcome to open your own PR and we'll review it when we can! ## 👞 Contributing Code: Step-by-Step First follow the steps in [DEVELOPMENT.md](./DEVELOPMENT.md) to get Mocha's repository installed locally. Then: ### 🎋 Initial Creation 1. Make sure the issue is labeled with [`status: accepting prs`](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+accepting+prs%22) 1. Create a new branch in your working copy. 1. Make your changes and add them via `git add`. - Your changes will likely be somewhere in `lib/`, `bin/`, or (if your changes are browser-specific) `browser-entry.js`. - 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 test`. - This will run both Node.js-based and browser-based tests. - 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. - When tests are run in CI, a coverage check is sent to [Codecov](https://app.codecov.io/gh/mochajs/mocha). You'll need to [add the Codecov GitHub app](https://app.codecov.io/login) to upload these results from your fork. This is recommended but not necessary to open a PR. **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 `main` 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 `main` branch using `git checkout main`. - Pull changes from `upstream` using `git pull upstream main`. - If any changes were pulled in, update your branch from `main` by switching back to your branch (`git checkout `) then merging using `git merge main`. 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. At that point, hooray! 🎉 You should see a pull request on github.com/mochajs/mocha/pulls. ### 🤖 AI-Generated Code We recognize that AI tools like GitHub Copilot, Claude, and others can be valuable aids in software development. However, **all code contributions, whether written by humans or generated by AI, must meet the same quality standards**. If you use AI to help generate code for a pull request: - **All automated tests must pass**: Your code must pass linting, unit tests, integration tests, and any other automated checks. - **Manual review is required**: AI-generated code must undergo the same thorough manual inspection as any other contribution. This includes checking for correctness, security vulnerabilities, adherence to project conventions, and overall code quality. - **You are responsible**: As the submitter of the pull request, you are fully responsible for understanding and maintaining the code, regardless of how it was generated. These requirements apply to all contributions and are not unique to AI-generated code—they simply reinforce our existing standards. ### 🏭 PR Process Now that the pull request exists, some tasks will be run on it: 1. If you have not signed our [Contributor License Agreement](docs.linuxfoundation.org/lfx/easycla/v2-current/contributors), 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. 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 `main`. 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. 1. Once you've addressed all the feedback you can, [re-request review on GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review). Join us in [our Discord](https://discord.gg/KeDn2uXhER)! ## 🌐 External Services Mocha uses several external services for project infrastructure: - **[Codecov](https://app.codecov.io/gh/mochajs/mocha)**: Code coverage tracking. PRs must not decrease coverage. Contributors should add the Codecov GitHub app to upload coverage from forks. - **[Discord](https://discord.gg/KeDn2uXhER)**: Official community chat for support, discussions, and connecting with maintainers and users. - **[EasyCLA](https://cla.js.foundation/mochajs/mocha)**: Contributor License Agreement system via Linux Foundation. All code contributions require a signed CLA. A bot prompts contributors on their first PR. - **Netlify**: Hosts the documentation website at mochajs.org. Provides automatic deploy previews for documentation PRs and nightly scheduled deploys to update supporter information. - **[npm registry](https://www.npmjs.com/package/mocha)**: Package distribution. Mocha is also available via GitHub Releases. - **[Open Collective](https://opencollective.com/mochajs)**: Transparent donations to Mocha and expenses from maintainers. - **[OpenJS Foundation](https://openjsf.org)**: Mocha is part of the OpenJS Foundation which provides governance and infrastructure support. See [PROJECT_CHARTER.md](../PROJECT_CHARTER.md) for governance details. ================================================ FILE: .github/DEVELOPMENT.md ================================================ # Development Follow these steps to get going in local development. If you are having trouble, don't be afraid to [ask for help](./CONTRIBUTING.md#❓-got-a-question). ## Prerequisites - [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/nvm-sh/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. ## Setup 1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo) on setting up Git, forking, and cloning. 1. Execute `npm install` to install the development dependencies. - Do not use `yarn install` or `pnpm 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`. ## Developing Mocha When you contribute to Mocha, you will probably want to try to run your changes on the test suite of another project. You can (and should) run the test suite of Mocha itself before committing, but also confirming that your changes give the expected result on another project. For example, [WebSocket.io](https://github.com/LearnBoost/websocket.io/): $ git clone https://github.com/LearnBoost/websocket.io.git Retrieve websocket.io's dependencies, which will include the stable version of Mocha: $ cd websocket.io/ $ npm install Replace the Mocha dependency by the current git repository: $ cd node_modules/ $ mv mocha/ mocha.save $ git clone https://github.com/mochajs/mocha.git Install Mocha's dependencies for the development version: $ cd mocha $ npm install Run websocket.io's test suite using the development version you just installed: $ cd ../.. $ ./node_modules/.bin/mocha ================================================ FILE: .github/FUNDING.yml ================================================ open_collective: mochajs ================================================ FILE: .github/ISSUE_TEMPLATE/01-bug.yml ================================================ body: - attributes: description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you! label: Bug Report Checklist options: - label: This is NOT a [security, `npm audit`, or GitHub Advisory issue](https://mochajs.org/explainers/security-vulnerability-reports). required: true - label: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) required: true - label: I have searched for [related issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue) and [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20), but none matched my issue. required: true - label: I have '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, my usage of Mocha, or Mocha itself. required: true - label: I want to provide a PR to resolve this type: checkboxes - attributes: description: What did you expect to happen? label: Expected type: textarea validations: required: true - attributes: description: What happened instead? label: Actual type: textarea validations: required: true - attributes: description: Detail the steps necessary to reproduce the problem. To get the fastest support, create an [MCVE](https://stackoverflow.com/help/mcve) and upload it to GitHub. label: Minimal, Complete and Verifiable Example type: textarea validations: required: true - attributes: description: What do `mocha --version`, `node_modules/.bin/mocha --version`, and `node --version` output? What name and version of browser/environment, shell, and any other related modules such as transpilers are you using? label: Versions type: textarea validations: required: true - attributes: description: Any additional info you'd like to provide. label: Additional Info type: textarea description: Report a bug trying to use Mocha labels: - "status: in triage" - "type: bug" name: 🐛 Bug title: "🐛 Bug: " ================================================ FILE: .github/ISSUE_TEMPLATE/02-documentation.yml ================================================ body: - attributes: description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you! label: Documentation Request Checklist options: - label: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) required: true - label: I have searched for [related issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue) and [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20), but none matched my issue. required: true - label: I want to provide a PR to resolve this type: checkboxes - attributes: description: What would you like to report? label: Overview type: textarea validations: required: true - attributes: description: Any additional info you'd like to provide. label: Additional Info type: textarea description: Report a typo or missing area of documentation labels: - "area: documentation" - "status: in triage" name: 📝 Docs title: "📝 Docs: " ================================================ FILE: .github/ISSUE_TEMPLATE/03-feature-request.yml ================================================ body: - attributes: description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you! label: Feature Request Checklist options: - label: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) required: true - label: I have searched for [related issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue) and [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20), but none matched my issue. required: true - label: I want to provide a PR to resolve this type: checkboxes - attributes: description: What is the feature gap or problem you'd like to address? label: Overview type: textarea validations: required: true - attributes: description: How would you like to solve this need? label: Suggested Solution type: textarea validations: required: true - attributes: description: What other features or solutions have you also considered? label: Alternatives type: textarea validations: required: true - attributes: description: Any additional info you'd like to provide. label: Additional Info type: textarea description: Request that a new feature be added or an existing feature improved labels: - "status: in triage" - "type: feature" name: 🚀 Feature title: "🚀 Feature: " ================================================ FILE: .github/ISSUE_TEMPLATE/04-performance.yml ================================================ body: - type: markdown attributes: value: | Thanks for taking the time to suggest a performance improvement to Mocha! Please note that Mocha is a widely used library with many millions of weekly downloads, many thousands of dependents, and many years of longstanding behavior. Every change to it is inherently risky and may break user edge cases that we have no way to learn of otherwise. So, to accept a performance improvement, we'd need to see _measurable, non-negligible improvement_ in Mocha's real-world usage. That requires providing at least: - Exhaustive comparison with other alternatives that proves this is the winning approach - Disclosure of any personal affiliation with the proposed solution and alternatives - For runtime performance: some kind of reproducible benchmark to demonstrate exactly what's different - For dependency cleanups: - The specific change to the dependency tree of a project with Mocha and no other dependencies - The specific change to the dependency tree of a project with Mocha and other common dependencies, such as `chai`, `express`, and `sinon` You can always suggest a performance improvement without those validations, but we are unlikely to accept it without them. For more information, see [mochajs/mocha#5377 🛠️ Repo: Add issue template for performance improvements](https://github.com/mochajs/mocha/issues/5377). - attributes: description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you! label: Performance Suggestion Checklist options: - label: I am using the latest version of Mocha. required: true - label: I have read and understood the nuances around performance reports. required: true - label: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) required: true - label: I have searched for [related issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue) and [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20), but none matched my issue. required: true - label: I want to provide a PR to resolve this type: checkboxes - attributes: description: What is your suggestion? label: Overview type: textarea validations: required: true - attributes: description: If you have a suggested implementation, please explain why you believe it's the best one here. label: Validations type: textarea - attributes: description: Any additional info you'd like to provide. label: Additional Info type: textarea description: Suggest a way to make Mocha faster, more memory- and/or space-efficient, or otherwise improve performance labels: - "area: performance" - "status: in triage" name: ⚡️ Performance title: "⚡️ Performance: " ================================================ FILE: .github/ISSUE_TEMPLATE/05-repository-tooling.yml ================================================ body: - attributes: description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you! label: Tooling Suggestion Checklist options: - label: I have tried restarting my IDE and the issue persists. required: true - label: I have pulled the latest `main` branch of the repository. required: true - label: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) required: true - label: I have searched for [related issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue) and [issues with the `faq` label](https://github.com/mochajs/mocha/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Afaq%20), but none matched my issue. required: true - label: I want to provide a PR to resolve this type: checkboxes - attributes: description: What changes would you like, and how do they help contributors? label: Overview type: textarea validations: required: true - attributes: description: Any additional info you'd like to provide. label: Additional Info type: textarea description: Report a bug or request an enhancement in the Mocha repository's internal tooling labels: - "area: repository tooling" - "status: in triage" name: 🛠️ Repository Tooling title: "🛠️ Repo: " ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: true contact_links: - name: Documentation Website about: Please read our documentation website before filing new issues. url: https://mochajs.org - name: Documentation Website > APIs about: If you're using Mocha's API, see also the website's API docs. url: https://mochajs.org/api - name: Discord about: Our Discord is the right place for quick informal questions. url: https://discord.gg/KeDn2uXhER - name: StackOverflow about: For more questions, see the `mocha` tag on StackOverflow. url: https://stackoverflow.com/questions/tagged/mocha ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ ## PR Checklist - [ ] Addresses an existing open issue: fixes #000 - [ ] That issue was marked as [`status: accepting prs`](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [ ] Steps in [CONTRIBUTING.md](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) were taken ## Overview ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" groups: github-actions: patterns: - "*" ================================================ FILE: .github/release-please/config.json ================================================ { "$schema": "https://raw.githubusercontent.com/googleapis/release-please/v17.1.3/schemas/config.json", "release-type": "node", "include-component-in-tag": false, "prerelease": true, "versioning": "prerelease", "changelog-sections": [ { "type": "feat", "section": "🌟 Features", "hidden": false }, { "type": "fix", "section": "🩹 Fixes", "hidden": false }, { "type": "docs", "section": "📚 Documentation", "hidden": false }, { "type": "chore", "section": "🧹 Chores", "hidden": false }, { "type": "perf", "section": "🧹 Chores", "hidden": false }, { "type": "refactor", "section": "🧹 Chores", "hidden": false }, { "type": "test", "section": "🧹 Chores", "hidden": false }, { "type": "build", "section": "🤖 Automation", "hidden": false }, { "type": "ci", "section": "🤖 Automation", "hidden": true } ], "packages": { ".": {} } } ================================================ FILE: .github/release-please/manifest.json ================================================ {".":"12.0.0-beta.10"} ================================================ FILE: .github/workflows/mocha.yml ================================================ name: Tests on: push: branches: - main paths-ignore: ["*.md", "docs/**", ".github/**", ".prettierignore", "AUTHORS", "LICENSE"] pull_request: branches: - main paths-ignore: ["*.md", "docs/**", ".github/**", ".prettierignore", "AUTHORS", "LICENSE"] types: [opened, synchronize, reopened, edited] workflow_dispatch: permissions: contents: read id-token: write # for Codecov OIDC jobs: format: uses: ./.github/workflows/npm-script.yml with: npm-script: format:check lint: uses: ./.github/workflows/npm-script.yml with: npm-script: lint smoke: uses: ./.github/workflows/npm-script.yml with: node-versions: "20,22,24" npm-script: test-smoke test-node-lts: # TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module # https://github.com/mochajs/mocha/issues/5183 uses: ./.github/workflows/npm-script.yml needs: smoke strategy: fail-fast: false matrix: test-part: - interfaces - unit - integration - jsapi - requires - reporters - only with: npm-script: test-node:${{ matrix.test-part }} test-node-all: name: Test ${{ matrix.test-part }} in all environments permissions: id-token: write # for Codecov OIDC contents: read # for Codecov OIDC # TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module # https://github.com/mochajs/mocha/issues/5183 uses: ./.github/workflows/npm-script.yml needs: test-node-lts strategy: fail-fast: false matrix: coverage: [true] test-part: - interfaces - unit - integration - requires - reporters - only include: - test-part: jsapi coverage: false with: os: "ubuntu-latest,windows-latest" # We pin exact versions here per https://github.com/mochajs/mocha/issues/5052 # Ref https://nodejs.org/en/about/previous-releases node-versions: "20.19.4,22.18.0,24.6.0" npm-script: test-node:${{ matrix.test-part }} coverage: ${{ matrix.coverage }} test-browser-local: uses: ./.github/workflows/npm-script.yml with: browsers: ChromeHeadless npm-script: test-browser tsc: uses: ./.github/workflows/npm-script.yml with: npm-script: tsc ================================================ FILE: .github/workflows/nightly-site-deploy.yml ================================================ # Deploy `mochajs.org` branch nightly by hitting a netlify build URL. # This updates the list of supporters # It uses commands from netlify.toml at root of repo name: Nightly mochajs.org Deploy on: schedule: - cron: "0 0 * * *" workflow_dispatch: permissions: contents: read jobs: deploy: runs-on: ubuntu-latest steps: - name: Webhook Action uses: joelwmale/webhook-action@6cebc9d7dc8435b684e1e1945c0013d9023b76a4 env: data: "" WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }} ================================================ FILE: .github/workflows/npm-script.yml ================================================ name: Reusable npm script runner on: workflow_call: inputs: npm-script: description: "npm script" required: true type: string browsers: description: "A comma separated list of browser names to test with." required: false type: string node-versions: description: "A comma separated list of Node versions to test with." required: false type: string os: description: "A comma separated list of operating systems to test on." required: false type: string coverage: description: "Whether to set up coverage reporting or not" required: false type: boolean permissions: contents: read id-token: write jobs: resolve-inputs: runs-on: ubuntu-latest outputs: browsers: ${{ steps.split-browsers.outputs.splitted }} nodeVersions: ${{ steps.split-node-versions.outputs.splitted }} os: ${{ steps.split-os.outputs.splitted }} steps: - id: split-browsers if: inputs.browsers run: echo "splitted=$(echo '${{ inputs.browsers }}' | jq -R -c 'split(",")')" >> $GITHUB_OUTPUT - id: split-node-versions if: inputs.node-versions run: echo "splitted=$(echo '${{ inputs.node-versions }}' | jq -R -c 'split(",")')" >> $GITHUB_OUTPUT - id: split-os if: inputs.os run: echo "splitted=$(echo '${{ inputs.os }}' | jq -R -c 'split(",")')" >> $GITHUB_OUTPUT script: name: ${{ inputs.npm-script }}${{ needs.resolve-inputs.outputs.browsers && format('[{0}]', matrix.browser) }}${{ needs.resolve-inputs.outputs.nodeVersions && format(' with node.js {0}', matrix.node_version) }}${{ needs.resolve-inputs.outputs.os && format(' on {0}', matrix.os) }} runs-on: ${{ matrix.os }} timeout-minutes: 20 needs: - resolve-inputs strategy: fail-fast: false matrix: node_version: ${{ fromJson(needs.resolve-inputs.outputs.nodeVersions || '["22"]') }} os: ${{ fromJson(needs.resolve-inputs.outputs.os || '["ubuntu-latest"]') }} browser: ${{ fromJson(needs.resolve-inputs.outputs.browsers || '[""]') }} steps: - uses: actions/checkout@v6 with: persist-credentials: false - uses: actions/setup-node@v6 with: node-version: ${{ matrix.node_version }} cache: "npm" - run: npm ci --ignore-scripts - run: npm run ${{ inputs.npm-script }} env: BROWSER: ${{ matrix.browser }} COVERAGE: ${{ inputs.coverage && '1'}} NODE_OPTIONS: "--trace-warnings" # Generate and upload coverage, even if tests fail - name: Generate coverage report if: always() && inputs.coverage run: npm run test-coverage-generate # https://github.com/marketplace/actions/codecov # https://app.codecov.io/gh/mochajs/mocha - name: Upload coverage reports if: always() && inputs.coverage uses: codecov/codecov-action@v5 with: fail_ci_if_error: true use_oidc: true ================================================ FILE: .github/workflows/octoguide.yml ================================================ jobs: octoguide: if: ${{ !endsWith(github.actor, '[bot]') }} runs-on: ubuntu-latest steps: - uses: OctoGuide/bot@0.21.10 with: github-token: ${{ secrets.GITHUB_TOKEN }} name: OctoGuide on: discussion: types: [created, edited] discussion_comment: types: [created, deleted, edited] issue_comment: types: [created, deleted, edited] issues: types: [edited, opened] pull_request_review_comment: types: [created, deleted, edited] pull_request_target: types: [edited, opened] permissions: discussions: write issues: write pull-requests: write ================================================ FILE: .github/workflows/release-please.yml ================================================ name: Release Please on: push: branches: - main workflow_dispatch: permissions: contents: read id-token: write jobs: release_please: name: release-please runs-on: ubuntu-latest outputs: releaseCreated: ${{ steps.release.outputs.release_created }} permissions: contents: write pull-requests: write steps: - uses: googleapis/release-please-action@v4 id: release with: config-file: .github/release-please/config.json manifest-file: .github/release-please/manifest.json npm_publish: name: Publish to npm runs-on: ubuntu-latest environment: npm needs: release_please if: needs.release_please.outputs.releaseCreated steps: - uses: actions/checkout@v6 with: show-progress: false - uses: actions/setup-node@v6 with: node-version: "22" registry-url: "https://registry.npmjs.org" - name: Upgrade npm for OIDC support run: npm install -g npm@latest - name: Install dependencies run: npm ci --ignore-scripts --force --no-fund --no-audit - run: npm publish --provenance --access public --tag=next env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} ================================================ FILE: .gitignore ================================================ # Mocha-specific docs/images/supporters mocha.js mocha.js.map .karma/ !bin/mocha.js !lib/mocha.js # Bundle debugging stats.html ######################################### # NON-MOCHA STUFF GOES BELOW THIS THING # ######################################### # Git mergetool # Use `git config mergetool.keepBackup false` to stop generating these files *.orig # 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 .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 # Local Netlify folder .netlify ================================================ FILE: .knip.jsonc ================================================ { "$schema": "https://unpkg.com/knip@5/schema-jsonc.json", "entry": [ "bin/mocha.js!", "bin/_mocha!", "browser-entry.js!", "docs/_data/supporters.cjs", "index.js!", "lib/cli/index.js!", ], "project": ["{bin,lib,scripts,test}/**/*.{js,ts,mjs,cjs}"], "ignore": [ "test/integration/fixtures/esm/type-module/test-that-imports-non-existing-module.fixture.js", "test/integration/fixtures/options/watch/test-with-dependency.fixture.js", ], "ignoreDependencies": [ "@test/esm-only-loader", "coffeescript", "fake", "non-existent-package", ], "mocha": { "entry": ["test/**/*.{js,ts,mjs,cjs}"], }, "webpack": { "config": "test/browser-specific/fixtures/webpack/webpack.config.js", }, "rules": { "exports": "off", }, } ================================================ FILE: .lintstagedrc.json ================================================ { "@(**/*.js|bin/*)": ["eslint --fix"], "!(package*).json": ["prettier --write"], "*.{yml,md,html}": ["prettier --write"] } ================================================ FILE: .mailmap ================================================ # see https://www.git-scm.com/docs/git-check-mailmap for formatting info TJ Holowaychuk 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 ================================================ FILE: .mocharc.yml ================================================ require: "test/setup" ui: "bdd" global: - "okGlobalA,okGlobalB" - "okGlobalC" - "callback*" timeout: 1000 watch-ignore: - ".*" - "docs/_site/**" - "node_modules" - "coverage" - "cache" ================================================ FILE: .npmrc ================================================ message=Release v%s ================================================ FILE: .nycrc ================================================ { "reporter": ["json", "text-summary"], "all": true, "exclude": [ "coverage/**", "docs/**", "packages/*/test{,s}/**", "**/*.d.ts", "test{,s}/**", "test{,-*}.{js,cjs,mjs,ts}", "**/*{.,-}test.{js,cjs,mjs,ts}", "**/__tests__/**", "**/{karma,rollup,webpack}.config.js", "**/{babel.config,.eslintrc,.mocharc}.{js,cjs}", "lib/browser/**", "package-scripts.js", "package-lock.json", "**/package-lock.json", "node_modules/**", "scripts/**" ] } ================================================ FILE: .prettierignore ================================================ /.karma/ /.nyc_output /CHANGELOG.md /coverage /pnpm-lock.yaml /test/*/fixtures/** # release-please generate a compact manifest.json by default /.github/release-please/manifest.json ================================================ FILE: .wallaby.js ================================================ "use strict"; module.exports = () => { 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", "mocharc.yml", "!lib/browser/growl.js", ], 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(1000); // 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, ); require("./test/setup"); }, debug: true, runMode: "onsave", }; }; ================================================ FILE: AUTHORS ================================================ # Authors ordered by first contribution. TJ Holowaychuk James Carr Fredrik Lindin Konstantin Käfer David Henderson Harry Brundage Quang Van hokaccha Guillermo Rauch FARKAS Máté Ben Lindsey Steve Mason Ryunosuke SATO Nathan Rajlich Raynos Yuest Wang Maciej Małecki Joshua Krall Fedor Indutny Will Langstroth Attila Domokos Jussi Virtanen Phil Sung vlad Paul Miller Bjørge Næss Jeff Kunkle Fabio M. Costa Michael Riley Ian Young Jakub Nešetřil Tyson Tate Jo Liss Arian Stolwijk Brendan Nee Xavier Antoviaque Domenic Denicola Brian Beck Dave McKenna Richard Dingwall Cory Thomas R56 Ian Storm Taylor Andreas Brekken abrkn Nathan Bowser László Bácsi Atsuya Takagi Gavin Mogan fengmk2 Seiya Konno Jan Lehnardt Matt Robenolt Jonas Westerlund Koen Punt Jason Barry Austin Birch Adam Crabtree Casey Foster Jonathan Creamer Brian Moore traleig1 John Firebaugh airportyh Aaron Heckmann Russ Bradberry Ivan Corey Butler Paul Armstrong Herman Junge Michael Schoonmaker Wil Moore III Pete Hawkins tgautier@yahoo.com yuitest Matt Smith Katie Gengler Bryan Donovan Nathan Alderson Shawn Krisman Merrick Christensen Timo Tijhof Simon Gaeremynck Jaakko Salonen Jonathan Rajavuori Forbes Lindesay Standa Opichal Matthew Shanley James Lal Greg Perkins Gareth Murphy Juzer Ali Sasha Koss Justin DuJardin Frederico Silva Jesse Dailey Yanis Wang fcrisci Javier Aranda Florian Margaine fool2fish James Bowes Valentin Agachi Mathieu Desvé Glen Huang Simon Goumaz Alexander Early Jimmy Cuadra Russell Munson lodr Liam Newman Dmitry Shirokov Fredrik Enestad Kirill Korolyov grasGendarme Mike Pennisi Victor Costan Tim Ehat Jeremy Martin Mal Graty Di Wu badunk Marc Kuo Sindre Sorhus Salehen Shovon Rahman eiji.ienaga Oscar Godson Daniel Stockman Stephen Mathieson Travis Jeffery Andreas Lind Petersen Romain Prieto JP Bochi Teddy Zeenny Roman Neuhauser XhmikosR Brian Lalor Refael Ackermann ChrisWren Andrew Nesbitt berni Andrey Popp <8mayday@gmail.com> Brian M. Carlson Michael Olson Arnaud Brousseau Peter Rust Vadim Nikitin Roman Shtylman Tapiwa Kelvin Rustem Mustafin Glen Mailer Nathan Black sebv andy matthews Benjie Gillam Noshir Patel Ben Noordhuis Jacob Wejendorp claudyus Denis Bardadym Connor Dunn Jonathan Ong Harish Michal Charemza startswithaj Gareth Aye Nick Fitzgerald Jan Kopriva kavun Christoffer Hallas Jonathan Park Devin Weaver John Doty Shaine Hatch Ben Bradley qiuzuhui Jean Ponchon Linus Unnebäck Mattias Tidlund Matija Marohnić Michael Jackson Joel Kemp Zsolt Takács jsdevel lakmeer Joshua Appelman Christopher Hiller Michael Demmer Giovanni Bassi Panu Horsmalahti nishigori Nicolo Taddei Diogo Monteiro mrShturman PoppinL samuel goldszmidt Rob Wu Kent C. Dodds Kevin Conway Dominique Quatravaux zhiyelee Quanlong He omardelarosa Ariel Mashraki Sean Lang David da Silva Contín C. Scott Ananian Douglas Christopher Wilson Richard Knop Buck Doyle Jonas Dohse oveddan monowerker Marcello Bastea-Forte Benoît Zugmeyer Vlad Magdalin Moshe Kolodny Tom Coquereau Timothy Gu Ian Zamojc Martin Marko Chris Buckley Jake Craige Fede Ramirez Parker Moore Todd Agulnick Daniel St. Jules Rico Sta. Cruz Anis Safine Adam Gruber Sam Mussell klaemo Stewart Taylor Jordan Sexton Keith Cirkel Andrii Shumada Dominic Barnes Maximilian Antoni Sune Simonsen Kyle Mitchell James Nylen Jonathan Delgado Jake Marsh slyg Tomer Eskenazi Jeff Schilling Ryan Hubbard amsul Kevin Kirsche Gabriel Silk Johnathon Sanders Max Goodman Nathan Houle Ben Vinegar Duncan Beevers Tingan Ho Guy Arye Nik Nyby Artem Govorov Ajay Kodali Ryan Tablada Pavel Zubkou gigadude Outsider Jason Lai Aaron Krause wsw Kevin Burke Berker Peksag nexdrew Hugo Giraudel Rich Trott Matt Giles Joey Cozza Kris Rasmussen James G. Kim Sorin Iclanzan Rob Raux Sergey Simonchik Ian W. Remmel tmont John Reeves Fagner Brack Mark Banner Michiel de Jong Benoit Larroque Charles Lowell Joao Moreno Long Ho Robert Rossmann Aaron Hamid Stone Tom Hughes Soel Mislav Marohnić Prayag Verma Frank Leon Rose Ryan Shaw Thedark1337 Gyandeep Singh ryym Josh Lory Jonathan Kim Al Scott Tobias Bieniek Benjamin Eidelman Julien Wajsberg sarehag Alexander Shepelin OlegTsyba Xavier Damman Mick Brooks Erik Eng Kelong Wang Jérémie Astori ScottFreeCode Sergio Santoro Adrian Ludwig Anders Olsen Sandvik Thomas Grainger jimenglish81 Avi Vahl Jason Leyba silentcloud Dmitriy Simushev simov Ross Warren Benson Trent rmacklin Rob Loach Shinnosuke Watanabe Callum Macrae ELLIOTTCABLE Anton Peter Müller APerson not-an-aardvark Alhadis Slobodan Mišković Philip M. White Christian anton Dmitry Sorin Vivek Ganesan Josh Eversmann inxorable Ben Harris Aaron Petcoff Matt Bierner Ville Saukkonen Ben Hutchison Volker Buzek Scott Kao Sulabh Bista rotemdan Fumiaki MATSUSHIMA Markus Tacker Christoph Neuroth Enric Pallerols Craig Taub Yoshiya Hinosawa Sebastian Van Sande Chris Lamb Igwe Kalu Kevin Wang Laurence Rowe Jakob Krigovsky Chris Kunal Nagpal elergy Jupp Müller Poprádi Árpád Charlie Rudolph Angelica Valenta Jan Krems Josh Soref solodynamo Eli Skeggs Nikolaos Georgiou olsonpm David Neubauer Darryl Pogue 38elements Guangcong Luo David M. Lee tripu Pat Finnigan Eugene Tiutiunnyk Aaron Brady Charles Merriam Kevin Partington Lane Kelly Cube yehiyam Jon Surrell 现充 Ahmad Bamieh Capacitor Set Anthony Can Oztokmak ImgBot <31427850+ImgBotApp@users.noreply.github.com> Thomas Broadley FND Dina Berry Marais Rossouw Andrew Krawchyk <903716+akrawchyk@users.noreply.github.com> Ted Yavuzkurt Daniel Ruf Harry Wolff Valeri Karpov Silvio Massari Joseph Lin Honza Javorek Harry Sarson Anish Karandikar Victor Emanuele Thomas Vantuycom Alex Bainter Jerry Muzsik Nicolas Girault dfberry DavNej Paul Roebuck Tim Harshman Charles Samborski Tobias Mollstam Ben Glassman Mark Owsiak fargies Marc Udoff gizemkeser <44727928+gizemkeser@users.noreply.github.com> Fin Chen Brittany Moore Fábio Santos Jayasankar Juerg B <44573692+juergba@users.noreply.github.com> Svetlana <39729453+Lana-Light@users.noreply.github.com> Martijn Cuppens Anna Henningsen Andreas Lind Chen Yangjian <252317+cyjake@users.noreply.github.com> Corey Farrell Wanseob Lim Szauka <33459309+Szauka@users.noreply.github.com> Brian Tomlin Sylvain Adam Ginzberg XhmikosR Gastón I. Silva Andrew Bradley Andrew Bradley DavidLi119 James D. Rogers Carl-Erik Kopseng juergba Sylvester Keil Bjorn Stromberg Stephen Hess toyjhlee Piotr Kuczynski Thomas Scholtes Brian Lagerman <49239617+brian-lagerman@users.noreply.github.com> Pascal Gabe Gorelick Daniel Ruf <827205+DanielRuf@users.noreply.github.com> Mario Díaz Ceñera <46492068+MarioDiaz98@users.noreply.github.com> Oliver Salzburg Sona Lee Park Seong-beom EunChan Park Mia Lindsay-Needs-Sleep <51773923+Lindsay-Needs-Sleep@users.noreply.github.com> Soobin Bak Peter Schmidt SheetJSDev HyunSangHan Jan-Philip Gehrcke Robert Kieffer Saerom Bang Kyle Fuller Rens Groothuijsen Hugo Kim KyoungWan Zirak Christian Holm Kai Cataldo Gil Tayar Ulises Gascón kundol Arvid Ottenberg Daniel0113 Nico Jansen JacobLey <37151850+JacobLey@users.noreply.github.com> Gil Tayar Martin Oppitz Benjamin E. Coe Michael Brade Gopishankar Haridas devjeel Martin Oppitz indieisaconcept Sri Harsha irrationnelle Donghoon Song <32301380+Donghoon759@users.noreply.github.com> Sujin Park KIM HYO RIN Chuf <42591821+GChuf@users.noreply.github.com> Donghoon Song Evaline Ju Park Juhyung François Hodierne Evaline Ju <69598118+evaline-ju@users.noreply.github.com> Valeria Jordan Stephens Adam Keating <1427265+akeating@users.noreply.github.com> Hazem José Jesús Sinohui Fernández Maxwell Gerber Sebastian Noack Christian Bromann Alexander Fenster MoonSupport Dayzen Alexander Fenster kirill-golovan <57108967+kirill-golovan@users.noreply.github.com> Michal Dorner Curtis Man 华 <1395348685z@gmail.com> Andrei Rusu Quentin Barbe Mattias Norlander CommanderRoot Elihu Cruz Sukka Darius Dzien Yeting Li Greggman Josh Goldberg Kleis Auke Wolthuizen Paulo Gonçalves Anton Usmansky jb2311 <32516995+jb2311@users.noreply.github.com> Aras Abbasi Spencer <16455389+Spencer-Doak@users.noreply.github.com> Feng Yu Pelle Wessman Orgad Shaneh Lucas Lopes Bryan Mishkin <698306+bmish@users.noreply.github.com> Ville Lahdenvuo Nathan Phillip Brink Ståle Tomten dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Sleepy Flower StevenMia <166844090+StevenMia@users.noreply.github.com> Simon Hanna <33220646+simhnna@users.noreply.github.com> Ilia Choly Marjorie Saito Khoa Huynh <58313491+khoaHyh@users.noreply.github.com> Sam Adams <107990625+sam-super@users.noreply.github.com> Marc Durdin Ilya Goncharov github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Mark Wiemer <7833360+mark-wiemer@users.noreply.github.com> Danny Lin Kristján Oddsson David Huggins-Daines Joy Dey Julian Grinblat Linda_pp Eric Cornelissen Kelechi Ebiri <56020538+TG199@users.noreply.github.com> Dinika Kevin Locke Phillip Barta Grzegorz Godlewski Darren DeRidder <73rhodes@users.noreply.github.com> Chengzhong Wu Marcelo Shima Chengzhong Wu Samuel Henrique Mark Wiemer Martin Slota <46676886+martinslota@users.noreply.github.com> # Generated by scripts/update-authors.js ================================================ FILE: CHANGELOG.md ================================================ # Changelog ## [12.0.0-beta-10](https://github.com/mochajs/mocha/compare/v12.0.0-beta-9...v12.0.0-beta-10) (2026-02-21) ### 🌟 Features * remove Sauce Labs ([#5700](https://github.com/mochajs/mocha/issues/5700)) ([625c34e](https://github.com/mochajs/mocha/commit/625c34e8469562dbde8440c2b4d64e820f7019fa)) ### 🩹 Fixes * change Pending to properly extend Error ([#5679](https://github.com/mochajs/mocha/issues/5679)) ([158effd](https://github.com/mochajs/mocha/commit/158effd7de677c21b3a4ccd79ce0879fe0f97f8b)) * **deps:** update dependency chokidar to v5 ([#5734](https://github.com/mochajs/mocha/issues/5734)) ([ff2f17f](https://github.com/mochajs/mocha/commit/ff2f17fb25e5001420d48035f81f5b19a5f0974f)) * **deps:** update dependency minimatch to v10 ([#5743](https://github.com/mochajs/mocha/issues/5743)) ([3f3e449](https://github.com/mochajs/mocha/commit/3f3e449f889cb2ddcf950e7bf2268091000b9f7c)) * **deps:** update dependency starlight-package-managers to ^0.12.0 ([#5717](https://github.com/mochajs/mocha/issues/5717)) ([aa4ba48](https://github.com/mochajs/mocha/commit/aa4ba483a4a25f5dfc36334439caf2b8935874d2)) ### 📚 Documentation * fix client redirects ([#5697](https://github.com/mochajs/mocha/issues/5697)) ([dd9145d](https://github.com/mochajs/mocha/commit/dd9145dd9c5a684aa918ca5ed10155293df2bb91)), closes [#5696](https://github.com/mochajs/mocha/issues/5696) ### 🧹 Chores * Configure Renovate ([#5678](https://github.com/mochajs/mocha/issues/5678)) ([a9c9b90](https://github.com/mochajs/mocha/commit/a9c9b90098a831d82e69d82bfc7ce8c7aa749911)) * **deps:** update dependency @rollup/plugin-alias to v6 ([#5718](https://github.com/mochajs/mocha/issues/5718)) ([267d751](https://github.com/mochajs/mocha/commit/267d751dd05270de4e18e0348584fbb12d90ce04)) * **deps:** update dependency @rollup/plugin-commonjs to v29 ([#5719](https://github.com/mochajs/mocha/issues/5719)) ([9ed4ee5](https://github.com/mochajs/mocha/commit/9ed4ee55d975281ea54f237d23666d7b0307a596)) * **deps:** update dependency astro to v5.17.1 ([#5703](https://github.com/mochajs/mocha/issues/5703)) ([ec3d1fa](https://github.com/mochajs/mocha/commit/ec3d1fa02e285a4430942942c11c376e63d395ca)) * **deps:** update dependency chai to v4.5.0 ([#5705](https://github.com/mochajs/mocha/issues/5705)) ([870f9f8](https://github.com/mochajs/mocha/commit/870f9f8df7d1f9cace40bfc29a9b5b79a26ccb4e)) * **deps:** update dependency cross-env to v10 ([#5721](https://github.com/mochajs/mocha/issues/5721)) ([20b7476](https://github.com/mochajs/mocha/commit/20b7476904592b356a48c3f89817e930c78f15cb)) * **deps:** update dependency knip to v5.83.1 ([#5708](https://github.com/mochajs/mocha/issues/5708)) ([d833413](https://github.com/mochajs/mocha/commit/d833413622807c91cc2dea243c2be3518e2fe10b)) * **deps:** update dependency npm-run-all2 to v8 ([#5727](https://github.com/mochajs/mocha/issues/5727)) ([e38e0ec](https://github.com/mochajs/mocha/commit/e38e0ec3dd91be11b2b999959e6245ec721168e3)) * **deps:** update dependency prettier to v3.8.1 ([#5709](https://github.com/mochajs/mocha/issues/5709)) ([2f98cfd](https://github.com/mochajs/mocha/commit/2f98cfd1e3e9fce8a3c1a645f99a6b4b3b69ea6c)) * **deps:** update dependency rimraf to v6 ([#5728](https://github.com/mochajs/mocha/issues/5728)) ([ba124e9](https://github.com/mochajs/mocha/commit/ba124e9161e5efd052df77dda50925c5666ccd6d)) * **deps:** update dependency rollup to v4.57.1 ([#5710](https://github.com/mochajs/mocha/issues/5710)) ([178749d](https://github.com/mochajs/mocha/commit/178749da1bee978b5ef109a253337ae88206365c)) * **deps:** update dependency unexpected-map to v3 ([#5736](https://github.com/mochajs/mocha/issues/5736)) ([c1f3379](https://github.com/mochajs/mocha/commit/c1f33798ab925c76c5f9a69dcb8c1ce71da2fbc9)) * **deps:** update dependency unist-util-visit to v5.1.0 ([#5711](https://github.com/mochajs/mocha/issues/5711)) ([7ede894](https://github.com/mochajs/mocha/commit/7ede8943ff8f7925b51d4e4a226ee76b0a77619d)) * **deps:** update dependency webdriverio to v9 ([#5739](https://github.com/mochajs/mocha/issues/5739)) ([ff334df](https://github.com/mochajs/mocha/commit/ff334df744c93f27c7cce08ced320833ee69cb2f)) * **deps:** update dependency webpack-cli to v6 ([#5741](https://github.com/mochajs/mocha/issues/5741)) ([95c9d75](https://github.com/mochajs/mocha/commit/95c9d75120078e4c1fbb87d23f4fd7ec1f8a5405)) * **deps:** update dependency workerpool to v9.3.4 ([#5715](https://github.com/mochajs/mocha/issues/5715)) ([c030a3b](https://github.com/mochajs/mocha/commit/c030a3bd4774db679ac8dc7d56e705975f1a1b6e)) * **deps:** update remark ([#5745](https://github.com/mochajs/mocha/issues/5745)) ([37a25f1](https://github.com/mochajs/mocha/commit/37a25f174e6f3f16cae34923b86ab7d2504985ce)) * fix timeout issue with some XUnit tests ([53cc467](https://github.com/mochajs/mocha/commit/53cc46755571ed53e32254fb7d896f599a1a7d1f)) * switch Suite from util.inherits to ES2015 classes ([#5179](https://github.com/mochajs/mocha/issues/5179)) ([1ce690e](https://github.com/mochajs/mocha/commit/1ce690e590ca7bff7f47b108d3a5cc61dde6aa1b)) ### 🤖 Automation * **deps:** bump OctoGuide/bot in the github-actions group ([#5724](https://github.com/mochajs/mocha/issues/5724)) ([87224d8](https://github.com/mochajs/mocha/commit/87224d8400fa3b074f77a8ba1baadf7e0b99d864)) * run `npm audit fix` ([#5695](https://github.com/mochajs/mocha/issues/5695)) ([c7b00b0](https://github.com/mochajs/mocha/commit/c7b00b0e4f03583c4dcc407f28a5453df436f32b)) ## [12.0.0-beta-9](https://github.com/mochajs/mocha/compare/v12.0.0-beta-8...v12.0.0-beta-9) (2026-02-13) ### 🌟 Features * remove `log-symbols` dependency ([#5469](https://github.com/mochajs/mocha/issues/5469)) ([b92168f](https://github.com/mochajs/mocha/commit/b92168f5625be7343fb94d458d8a055cca8ff0a4)) ## [12.0.0-beta-8](https://github.com/mochajs/mocha/compare/v12.0.0-beta-7...v12.0.0-beta-8) (2026-02-06) ### 🧹 Chores * use OIDC to publish to npm ([#5681](https://github.com/mochajs/mocha/issues/5681)) ([5567aed](https://github.com/mochajs/mocha/commit/5567aed50a00b63074d5c7703c6d8196dee92088)) ## [12.0.0-beta-7](https://github.com/mochajs/mocha/compare/v12.0.0-beta-6...v12.0.0-beta-7) (2026-02-03) ### 🩹 Fixes * bump diff dependency to ^8.0.3 ([#5674](https://github.com/mochajs/mocha/issues/5674)) ([15fb31a](https://github.com/mochajs/mocha/commit/15fb31a8b25a4d03242e5c5f901ff3800889263e)) * print helpful message when internal CLI error happens ([#5344](https://github.com/mochajs/mocha/issues/5344)) ([1e11836](https://github.com/mochajs/mocha/commit/1e118367dbb27f558edb7389985cca97d6d7da4b)) ### 📚 Documentation * update sponsor image to be larger ([#5659](https://github.com/mochajs/mocha/issues/5659)) ([bbe2bdb](https://github.com/mochajs/mocha/commit/bbe2bdbb69f7aa560645a5ab2cbd596dd0b43448)) ### 🧹 Chores * move nyc config changes from package.json into .nycrc ([#5668](https://github.com/mochajs/mocha/issues/5668)) ([e923e40](https://github.com/mochajs/mocha/commit/e923e4063f6a24dcaf7c6d7c7a3c8be998cb7980)) * remove extra newline ([bbe2bdb](https://github.com/mochajs/mocha/commit/bbe2bdbb69f7aa560645a5ab2cbd596dd0b43448)) ## [12.0.0-beta-6](https://github.com/mochajs/mocha/compare/v12.0.0-beta-5...v12.0.0-beta-6) (2026-01-23) ### 🩹 Fixes * allow chain call timeout to override nested items timeout ([#5612](https://github.com/mochajs/mocha/issues/5612)) ([5525da6](https://github.com/mochajs/mocha/commit/5525da60cf8d2596e14ff5441ea518d47bd732da)) * import() fallback prevention ([#5647](https://github.com/mochajs/mocha/issues/5647)) ([6a78fa3](https://github.com/mochajs/mocha/commit/6a78fa39576ffb42700811661a94c9ac996707f2)) ### 🤖 Automation * **deps:** bump OctoGuide/bot in the github-actions group ([#5653](https://github.com/mochajs/mocha/issues/5653)) ([e06cce7](https://github.com/mochajs/mocha/commit/e06cce7a49b79a163e33db166e9b078b0d7b4001)) ## [12.0.0-beta-5](https://github.com/mochajs/mocha/compare/v12.0.0-beta-4...v12.0.0-beta-5) (2026-01-16) ### 🌟 Features * add --fail-hook-affected-tests option to report skipped tests as failed ([#5519](https://github.com/mochajs/mocha/issues/5519)) ([0ed524a](https://github.com/mochajs/mocha/commit/0ed524af347b59200e03b972c2450d36f6818a45)) ### 📚 Documentation * add missing /next/* redirects ([#5627](https://github.com/mochajs/mocha/issues/5627)) ([8fa183d](https://github.com/mochajs/mocha/commit/8fa183d592b29346901b55e2fa479c8f598a1ec3)) ### 🧹 Chores * cleanup issue templates ([#5624](https://github.com/mochajs/mocha/issues/5624)) ([1972dd7](https://github.com/mochajs/mocha/commit/1972dd76ec66e8e11532bb6aca9157c4f8892d3c)) * remove unused assets folder ([#5638](https://github.com/mochajs/mocha/issues/5638)) ([ddf8644](https://github.com/mochajs/mocha/commit/ddf864482ff66b1ca46ef7f08e63ca923222e717)) * update spam filter ([#5645](https://github.com/mochajs/mocha/issues/5645)) ([cf945fb](https://github.com/mochajs/mocha/commit/cf945fb73b7c5a74f0856cabca5b5b1c8a6ff1c8)) * update tagline ([#5635](https://github.com/mochajs/mocha/issues/5635)) ([8ff0209](https://github.com/mochajs/mocha/commit/8ff0209db575c8231eea77e6ab23e6fe95620c92)) ### 🤖 Automation * **deps:** bump OctoGuide/bot in the github-actions group ([#5648](https://github.com/mochajs/mocha/issues/5648)) ([fed6bbd](https://github.com/mochajs/mocha/commit/fed6bbdb891c518e61e8ef4bbf07ed46b469f860)) * **docs/dev-deps:** use JS-native `fetch` to get supporters data instead of external `needle` ([#5643](https://github.com/mochajs/mocha/issues/5643)) ([e37e56f](https://github.com/mochajs/mocha/commit/e37e56fbe6a1072f1784ef87278d46f7ac48cdb8)) * initial file implementation for ocotoguide ([#5608](https://github.com/mochajs/mocha/issues/5608)) ([a5f5c64](https://github.com/mochajs/mocha/commit/a5f5c6442505069573a17798a515f267c24a38f3)) ## [12.0.0-beta-4](https://github.com/mochajs/mocha/compare/v12.0.0-beta-3...v12.0.0-beta-4) (2026-01-04) ### 🌟 Features * ESM configuration file ([#5397](https://github.com/mochajs/mocha/issues/5397)) ([dff9d78](https://github.com/mochajs/mocha/commit/dff9d7873f2d47a799e0adef338a7d6045ba0731)) * migrate Markdown lint to `@eslint/markdown` ([#5593](https://github.com/mochajs/mocha/issues/5593)) ([d9e1f0a](https://github.com/mochajs/mocha/commit/d9e1f0aa7e39caa11edb81581c14cd02b3f40b3f)) ### 🩹 Fixes * remove `run` and use globalThis `setup` ([#5592](https://github.com/mochajs/mocha/issues/5592)) ([1544c39](https://github.com/mochajs/mocha/commit/1544c39dcd76916cca23a111c88eee8cbb781c24)) ### 📚 Documentation * fix v3_older changelog duplicate headings ([#5602](https://github.com/mochajs/mocha/issues/5602)) ([a750518](https://github.com/mochajs/mocha/commit/a7505180b64541ac71639ec3d1193f26e73527d9)) ### 🧹 Chores * **ci:** use OIDC token for trusted publishing to `npm` ([#5610](https://github.com/mochajs/mocha/issues/5610)) ([dc0fdb7](https://github.com/mochajs/mocha/commit/dc0fdb767fe46b885f7a0ccfb67acfb453156a3b)) * create exclusions for nyc ([#5609](https://github.com/mochajs/mocha/issues/5609)) ([702473a](https://github.com/mochajs/mocha/commit/702473a54d9348948a63b4600171afa6956ccb0b)) * **main:** release 12.0.0-beta-4 ([#5598](https://github.com/mochajs/mocha/issues/5598)) ([424516e](https://github.com/mochajs/mocha/commit/424516ed3c34c6716afbf554425cf5df439cd86c)) * prevent unwanted Prettier rewrites ([#5591](https://github.com/mochajs/mocha/issues/5591)) ([3ea1578](https://github.com/mochajs/mocha/commit/3ea15789ddb4b77c591d9da36d2476ac359de00d)) * remove broken browser-test.yml ([#5615](https://github.com/mochajs/mocha/issues/5615)) ([33ce345](https://github.com/mochajs/mocha/commit/33ce345f9ab4f47573a4994c5c01de6eda2af45d)) * remove legacy `docs/` ([#5583](https://github.com/mochajs/mocha/issues/5583)) ([d8c310e](https://github.com/mochajs/mocha/commit/d8c310e3eddd235be55ad1891cde84c3be6f56f3)) * revert "chore(main): release 12.0.0-beta-4 ([#5598](https://github.com/mochajs/mocha/issues/5598))" ([#5619](https://github.com/mochajs/mocha/issues/5619)) ([dba8091](https://github.com/mochajs/mocha/commit/dba809196541df415fac2681822f5cd35cf20442)) ### 🤖 Automation * **dep:** update `diff` from v7 to v8 ([#5605](https://github.com/mochajs/mocha/issues/5605)) ([8ca311c](https://github.com/mochajs/mocha/commit/8ca311c6c9b0d353b1c9d65b5751296d9baddd83)) * update npm command for format ([#5603](https://github.com/mochajs/mocha/issues/5603)) ([c6a29cc](https://github.com/mochajs/mocha/commit/c6a29ccb38f81d65100cb2a0e6d73ad4303f58fb)) ## [12.0.0-beta-3](https://github.com/mochajs/mocha/compare/v12.0.0-beta-2...v12.0.0-beta-3) (2026-01-01) ### 🌟 Features * add mocha.mjs export ([#5527](https://github.com/mochajs/mocha/issues/5527)) ([e1cf23c](https://github.com/mochajs/mocha/commit/e1cf23cbc2049a375ab9980337dbf2486450f7cb)) * bump serialize-javascript from 6.0.2 to 7.0.2 ([#5589](https://github.com/mochajs/mocha/issues/5589)) ([24fb1b6](https://github.com/mochajs/mocha/commit/24fb1b6f8a45b4ca93b4577838bc1d9a47c74ec1)) * bump strip-json-comments from 3 to 5 ([#5484](https://github.com/mochajs/mocha/issues/5484)) ([9b0db24](https://github.com/mochajs/mocha/commit/9b0db24740c65717dcd1838dcafccbfc1c538d3b)) ### 🩹 Fixes * allow importing ESM interface and reporters ([#5563](https://github.com/mochajs/mocha/issues/5563)) ([bc9fc84](https://github.com/mochajs/mocha/commit/bc9fc842213d00cf7ac4a4b0de898bf29e38bdad)) * **docs-next:** backer's logo is consistent regardless of size ([#5594](https://github.com/mochajs/mocha/issues/5594)) ([1a53a10](https://github.com/mochajs/mocha/commit/1a53a100a4f3b83a725ccf3c166dcbefebca8602)) * surface ts-node compile errors ([#5572](https://github.com/mochajs/mocha/issues/5572)) ([add4cf8](https://github.com/mochajs/mocha/commit/add4cf8166b330c9af4342def643c606459331d7)) ### 📚 Documentation * bumped docs-next Astro to ^5.16.6 ([#5574](https://github.com/mochajs/mocha/issues/5574)) ([806222b](https://github.com/mochajs/mocha/commit/806222b0998ffb4d09399090f4ec638e90974427)) * fix light mode Astro accent text color ([#5585](https://github.com/mochajs/mocha/issues/5585)) ([9cc3ada](https://github.com/mochajs/mocha/commit/9cc3ada85b4ab4a4f2a8c7dc1b9d9ff8f101ffc1)) * update Contributor License Agreement link in CONTRIBUTING.md ([#5567](https://github.com/mochajs/mocha/issues/5567)) ([410ce0d](https://github.com/mochajs/mocha/commit/410ce0d2a0f799aaca2c0bc627294d70c62dd3f4)) ### 🧹 Chores * normalized ESLint config to v9's recommended structure ([#5575](https://github.com/mochajs/mocha/issues/5575)) ([7f9ed1f](https://github.com/mochajs/mocha/commit/7f9ed1fb3480e0658c2c7d84c60a1b505c941ce5)) * update Rollup to v4 ([#5510](https://github.com/mochajs/mocha/issues/5510)) ([cafa782](https://github.com/mochajs/mocha/commit/cafa782f010021e7055f8482ede2c02c6503f0a0)) ### 🤖 Automation * **dev-deps:** upgrade `eslint` from v8 to v9 ([#5559](https://github.com/mochajs/mocha/issues/5559)) ([bb24ca8](https://github.com/mochajs/mocha/commit/bb24ca8fde15471ff68d5b01b74c2d7e6047d966)) * **dev-deps:** upgrade `markdownlint-cli` to latest v0.46.0 ([#5560](https://github.com/mochajs/mocha/issues/5560)) ([a124f1d](https://github.com/mochajs/mocha/commit/a124f1d3b7d0f8277962cae295cd43878294e183)) * **dev-deps:** upgrade `nyc` from 15 to 17 ([#5556](https://github.com/mochajs/mocha/issues/5556)) ([599ab01](https://github.com/mochajs/mocha/commit/599ab013f526e78b3888a092a928ea4bc67138c0)) ## [12.0.0-beta-2](https://github.com/mochajs/mocha/compare/v12.0.0-beta-1...v12.0.0-beta-2) (2025-11-25) ### 🧹 Chores * bump glob to version 13 ([#5546](https://github.com/mochajs/mocha/issues/5546)) ([f4d4ad2](https://github.com/mochajs/mocha/commit/f4d4ad23e9e994668c7d95c5a9bf59f581dccebf)) ## [12.0.0-beta-1](https://github.com/mochajs/mocha/compare/v11.7.4...v12.0.0-beta-1) (2025-11-25) ### ⚠ BREAKING CHANGES * cleanup references of --compilers ([#5403](https://github.com/mochajs/mocha/issues/5403)) * change the default of --forbid-only to check for process.env.CI ([#5496](https://github.com/mochajs/mocha/issues/5496)) * bump minimum Node.js version from 18.18.0 to 20.19.0 ([#5477](https://github.com/mochajs/mocha/issues/5477)) ### 🌟 Features * allow FIFOs as test files ([#5512](https://github.com/mochajs/mocha/issues/5512)) ([ca4af43](https://github.com/mochajs/mocha/commit/ca4af439d5766fdfb2b5a7d7e06db0280b1abb6e)) * bump minimum Node.js version from 18.18.0 to 20.19.0 ([#5477](https://github.com/mochajs/mocha/issues/5477)) ([1c34eef](https://github.com/mochajs/mocha/commit/1c34eef426f29e5e46ec348272ccaa869ae43922)) * change the default of --forbid-only to check for process.env.CI ([#5496](https://github.com/mochajs/mocha/issues/5496)) ([3d94dde](https://github.com/mochajs/mocha/commit/3d94ddea2f45d18473bf00e71db2b9766ab227fe)) * cleanup references of --compilers ([#5403](https://github.com/mochajs/mocha/issues/5403)) ([f75d150](https://github.com/mochajs/mocha/commit/f75d150cf6115334e7f14b8ee1fbbda04eb87087)) ### 🩹 Fixes * correct assertion import syntax in getting-started guide ([#5526](https://github.com/mochajs/mocha/issues/5526)) ([fb0215b](https://github.com/mochajs/mocha/commit/fb0215bd4fba44fde0cc7b8f9b91a4f07020a13b)) * handle empty null-prototyped objects ([#5506](https://github.com/mochajs/mocha/issues/5506)) ([2a0bce0](https://github.com/mochajs/mocha/commit/2a0bce02f6f696c74fb8fdcd9f72089e82935903)) ### 📚 Documentation * add maintainer expectations to MAINTAINERS.md ([#5514](https://github.com/mochajs/mocha/issues/5514)) ([76f95a1](https://github.com/mochajs/mocha/commit/76f95a1113ea0472800ff6b1781f2750836a6db7)) * migrate how-to wiki pages to main documentation ([#5463](https://github.com/mochajs/mocha/issues/5463)) ([b85aec6](https://github.com/mochajs/mocha/commit/b85aec6e4307903f31b2b8039dd749efc44ffcf5)) * migrate programmatic usage to docs, development content to DEVELOPMENT.md ([#5464](https://github.com/mochajs/mocha/issues/5464)) ([cb47925](https://github.com/mochajs/mocha/commit/cb47925f99b39bd66bdd09218395bf5e0a54802d)) * test/integration/README: remove ref to non-existent dir ([#5516](https://github.com/mochajs/mocha/issues/5516)) ([d2c2d40](https://github.com/mochajs/mocha/commit/d2c2d4026d0f6a09b96344f034e9cba9ee6277af)) ### 🧹 Chores * applied formatting to all files ([#5493](https://github.com/mochajs/mocha/issues/5493)) ([76d7194](https://github.com/mochajs/mocha/commit/76d719495d09dc4afb37d1179ede8911c52a011e)) * fix broken link in .github/CONTRIBUTING.md ([681e843](https://github.com/mochajs/mocha/commit/681e843800051a9d3ab66c1bfb7ad71428e34315)) * remove Node.js 18 from test-smoke in CI too ([d643105](https://github.com/mochajs/mocha/commit/d643105aa6f3fbac9d13e8a44f4c4c7302512193)) * switch from Coveralls to Codecov ([#5447](https://github.com/mochajs/mocha/issues/5447)) ([f4e7e54](https://github.com/mochajs/mocha/commit/f4e7e54eb285765d7c50bce9c501db2e1b1e22be)) * unpin node-version in release-please ([#5550](https://github.com/mochajs/mocha/issues/5550)) ([62c90cd](https://github.com/mochajs/mocha/commit/62c90cd2aea4c719d2014e7134b2a1d7c189fd7a)) * use `ps-list` instead of `pidtree` to remove wmic ([#5479](https://github.com/mochajs/mocha/issues/5479)) ([b2985b3](https://github.com/mochajs/mocha/commit/b2985b3428b4b88ca220a14a26e9eb7139e8d445)) ### 🤖 Automation * **deps:** bump actions/checkout in the github-actions group ([#5547](https://github.com/mochajs/mocha/issues/5547)) ([561eb03](https://github.com/mochajs/mocha/commit/561eb039f7cfc36563a9583b17c7d4cb7ec30652)) * **deps:** bump actions/setup-node in the github-actions group ([#5503](https://github.com/mochajs/mocha/issues/5503)) ([9a70533](https://github.com/mochajs/mocha/commit/9a7053349589344236b20301de965030eaabfea9)) ## [11.7.4](https://github.com/mochajs/mocha/compare/v11.7.3...v11.7.4) (2025-10-01) ### 🩹 Fixes * watch mode using chokidar v4 ([#5379](https://github.com/mochajs/mocha/issues/5379)) ([c2667c3](https://github.com/mochajs/mocha/commit/c2667c3b3fca33c21306f59a1cca55bb7e1dac1f)) ### 📚 Documentation * migrate remaining legacy wiki pages to main documentation ([#5465](https://github.com/mochajs/mocha/issues/5465)) ([bff9166](https://github.com/mochajs/mocha/commit/bff91660733b71b124aad939538dee7747cfbeb8)) ### 🧹 Chores * remove trailing spaces ([#5475](https://github.com/mochajs/mocha/issues/5475)) ([7f68e5c](https://github.com/mochajs/mocha/commit/7f68e5c1565606bcebeb715b8591c52973d00dff)) ## [11.7.3](https://github.com/mochajs/mocha/compare/v11.7.2...v11.7.3) (2025-09-30) ### 🩹 Fixes * use original require() error for TS files if ERR_UNKNOWN_FILE_EXTENSION ([#5408](https://github.com/mochajs/mocha/issues/5408)) ([ebdbc48](https://github.com/mochajs/mocha/commit/ebdbc487693254498de62068c59e3e43d078eff1)) ### 📚 Documentation * add security escalation policy ([#5466](https://github.com/mochajs/mocha/issues/5466)) ([4122c7d](https://github.com/mochajs/mocha/commit/4122c7d13d0941be451365397fbf43e1f3103027)) * fix duplicate global leak documentation ([#5461](https://github.com/mochajs/mocha/issues/5461)) ([1164b9d](https://github.com/mochajs/mocha/commit/1164b9da895e56cf745acda2792e634080018ff6)) * migrate third party UIs wiki page to docs ([#5434](https://github.com/mochajs/mocha/issues/5434)) ([6654704](https://github.com/mochajs/mocha/commit/66547045cb9bd2fa8209b34c36da2a5ef49d23fc)) * update maintainer release notes for release-please ([#5453](https://github.com/mochajs/mocha/issues/5453)) ([185ae1e](https://github.com/mochajs/mocha/commit/185ae1eabe5c1e92c758bdfb398f7f47b6ef9483)) ### 🤖 Automation * **deps:** bump actions/setup-node in the github-actions group ([#5459](https://github.com/mochajs/mocha/issues/5459)) ([48c6f40](https://github.com/mochajs/mocha/commit/48c6f4068b5d22ebc49220900f0b53f8ecdc2b74)) ## [11.7.2](https://github.com/mochajs/mocha/compare/v11.7.1...v11.7.2) (2025-09-01) ### 🩹 Fixes * fail with an informative error message on a file with a broken default import ([#5413](https://github.com/mochajs/mocha/issues/5413)) ([b0e6135](https://github.com/mochajs/mocha/commit/b0e61350594f2a044bf34ea153d1fab1e82e80cc)) * load mjs files correctly ([#5429](https://github.com/mochajs/mocha/issues/5429)) ([a947b9b](https://github.com/mochajs/mocha/commit/a947b9b95501a35efa73c18aa57a74dad555c03a)) ### 📚 Documentation * add banner from old site to new site, link from new to old ([#5414](https://github.com/mochajs/mocha/issues/5414)) ([dedef11](https://github.com/mochajs/mocha/commit/dedef110a2af2f8632fb6c1b864fa0a46ad6ca9c)) * add info on spies to legacy docs ([#5421](https://github.com/mochajs/mocha/issues/5421)) ([21f5544](https://github.com/mochajs/mocha/commit/21f554459c75f5a75b22556b6e2ac70d6ac0e9fc)) * explain node import swallowing error ([#5401](https://github.com/mochajs/mocha/issues/5401)) ([09f5b2c](https://github.com/mochajs/mocha/commit/09f5b2c9de67ef40d5bd1775c3fca3bdb138f371)) * fix links in new site ([#5416](https://github.com/mochajs/mocha/issues/5416)) ([b2bc769](https://github.com/mochajs/mocha/commit/b2bc769c6c8d87311ba0bdc9df8b9b588494eba5)) * migrate assertion libraries wiki link to main docs ([#5442](https://github.com/mochajs/mocha/issues/5442)) ([95f3ca8](https://github.com/mochajs/mocha/commit/95f3ca8bc3a6c6af2932f7fd59a404768c0c6693)) * migrate count assertions wiki page to docs ([#5438](https://github.com/mochajs/mocha/issues/5438)) ([02a306c](https://github.com/mochajs/mocha/commit/02a306c6cbf31f4eef7d4c9bf5e06c917d3efc11)) * migrate shared behaviours to docs-next ([#5432](https://github.com/mochajs/mocha/issues/5432)) ([1dc4aa9](https://github.com/mochajs/mocha/commit/1dc4aa98eb3793865fa2a4da3373534dafc1c9a7)) * migrate Spies wiki page to explainers ([#5420](https://github.com/mochajs/mocha/issues/5420)) ([cbcf007](https://github.com/mochajs/mocha/commit/cbcf007c5ae25f203863aac0b43eca1e8aefe093)) * Migrate tagging wiki page to docs ([#5435](https://github.com/mochajs/mocha/issues/5435)) ([876247a](https://github.com/mochajs/mocha/commit/876247a8a636cc7bb1c3bf31390e7771182a090a)) * migrate third party reporters wiki page to docs ([#5433](https://github.com/mochajs/mocha/issues/5433)) ([f70764c](https://github.com/mochajs/mocha/commit/f70764c9a56fcf12e316d5539788c7be0693b6a9)) * migrate to global leak wiki page to docs ([#5437](https://github.com/mochajs/mocha/issues/5437)) ([8a6fdca](https://github.com/mochajs/mocha/commit/8a6fdcafccd94c888fae5e8be47dd29a604241b6)) * update /next bug report link to be docs issue template ([#5424](https://github.com/mochajs/mocha/issues/5424)) ([668cb66](https://github.com/mochajs/mocha/commit/668cb66e1288051369ab144ccb50c840ebe34267)) ### 🧹 Chores * add issue form for ⚡️ Performance ([#5406](https://github.com/mochajs/mocha/issues/5406)) ([a908b3b](https://github.com/mochajs/mocha/commit/a908b3b86604d41d5751cccfaff505d7092c114f)) * add test for `-R import-only-loader` ([#5391](https://github.com/mochajs/mocha/issues/5391)) ([6ee5b48](https://github.com/mochajs/mocha/commit/6ee5b483b8c29e0593c7765ad7a5c7b7f7764fc3)) * also test Node.js 24 in CI ([#5405](https://github.com/mochajs/mocha/issues/5405)) ([15f5980](https://github.com/mochajs/mocha/commit/15f59805287f4c84ab8d057735a391a795be23f1)) * bump CI to use 20.19.4, 22.18.0, 24.6.0 ([#5430](https://github.com/mochajs/mocha/issues/5430)) ([ace5eb4](https://github.com/mochajs/mocha/commit/ace5eb47a7926fe9d56ebcd95fd659c557a5be4d)) * bump Knip to 5.61.2 ([#5394](https://github.com/mochajs/mocha/issues/5394)) ([f3d7430](https://github.com/mochajs/mocha/commit/f3d743061d6523f7077b21749089e6fb2f9c32e3)) * cleanup references of --opts ([#5402](https://github.com/mochajs/mocha/issues/5402)) ([1096b37](https://github.com/mochajs/mocha/commit/1096b376c3c3bb9d4256c643ad35a459ed750928)) * enabled ESLint's no-unused-vars ([#5399](https://github.com/mochajs/mocha/issues/5399)) ([d4168ae](https://github.com/mochajs/mocha/commit/d4168aef4c21f8fd119385da1cf1794a1ec5c2e1)) * move callback and object typedefs to a new types.d.ts ([#5351](https://github.com/mochajs/mocha/issues/5351)) ([3300d21](https://github.com/mochajs/mocha/commit/3300d2155a1b06059fbe89c98a1d8bf979539019)) * rewrite base path instead of copy-pasting ([#5431](https://github.com/mochajs/mocha/issues/5431)) ([c6c6740](https://github.com/mochajs/mocha/commit/c6c6740fb45da43510f86c1d22ea46ce9ee6a7ae)) * unify caught errors as err ([#5439](https://github.com/mochajs/mocha/issues/5439)) ([d4912e7](https://github.com/mochajs/mocha/commit/d4912e705cf9ae1c3aa274b6449a6a0ff6d408c5)) * Update experimental module detection test and pin exact Node versions ([#5417](https://github.com/mochajs/mocha/issues/5417)) ([2489090](https://github.com/mochajs/mocha/commit/2489090223f2629e4a380abe4cc6d46858ada922)) ### 🤖 Automation * **deps:** bump actions/checkout in the github-actions group ([#5419](https://github.com/mochajs/mocha/issues/5419)) ([03ac2d0](https://github.com/mochajs/mocha/commit/03ac2d0e6e75e95b3dc7fb08f2e1a1117d9718ca)) ## [11.7.1](https://github.com/mochajs/mocha/compare/v11.7.0...v11.7.1) (2025-06-24) ### 🩹 Fixes * always fallback to import() if require() fails ([#5384](https://github.com/mochajs/mocha/issues/5384)) ([295c168](https://github.com/mochajs/mocha/commit/295c168628c2583245fb67d371b640309ba243ba)) ### 🧹 Chores * add esm loader test ([#5383](https://github.com/mochajs/mocha/issues/5383)) ([f58e49f](https://github.com/mochajs/mocha/commit/f58e49f08df2066e27f87f93ad7ee9cd6f91d225)) ## [11.7.0](https://github.com/mochajs/mocha/compare/v11.6.0...v11.7.0) (2025-06-18) ### 🌟 Features * use require to load esm ([#5366](https://github.com/mochajs/mocha/issues/5366)) ([41e24a2](https://github.com/mochajs/mocha/commit/41e24a242944da0cfc9d4d6989dede85f648cb40)) ## [11.6.0](https://github.com/mochajs/mocha/compare/v11.5.0...v11.6.0) (2025-06-09) ### 🌟 Features * bump workerpool from ^6.5.1 to ^9.2.0 ([#5350](https://github.com/mochajs/mocha/issues/5350)) ([581a3c5](https://github.com/mochajs/mocha/commit/581a3c554489855ac02860689d3f4ae772c2ea79)) ## [11.5.0](https://github.com/mochajs/mocha/compare/v11.4.0...v11.5.0) (2025-05-22) ### 🌟 Features * bump mimimatch from ^5.1.6 to ^9.0.5 ([#5349](https://github.com/mochajs/mocha/issues/5349)) ([a3dea85](https://github.com/mochajs/mocha/commit/a3dea85b316e229ea95f51c715ad61708e9ab9a3)) ## [11.4.0](https://github.com/mochajs/mocha/compare/v11.3.0...v11.4.0) (2025-05-19) ### 🌟 Features * bump diff from ^5.2.0 to ^7.0.0 ([#5348](https://github.com/mochajs/mocha/issues/5348)) ([554d6bb](https://github.com/mochajs/mocha/commit/554d6bbec92c3c938af0a533109749b6f3b7bd2c)) ### 📚 Documentation * added CHANGELOG.md note around 11.1 yargs-parser update ([#5362](https://github.com/mochajs/mocha/issues/5362)) ([618415d](https://github.com/mochajs/mocha/commit/618415d9c6fa3ef4e959207c8dd404f4703de7a7)) ## [11.3.0](https://github.com/mochajs/mocha/compare/v11.2.2...v11.3.0) (2025-05-16) ### 🌟 Features * add option to use posix exit code upon fatal signal ([#4989](https://github.com/mochajs/mocha/issues/4989)) ([91bbf85](https://github.com/mochajs/mocha/commit/91bbf855012ee9b83700d3c563b517483de0831c)) ### 📚 Documentation * Deploy new site alongside old one ([#5360](https://github.com/mochajs/mocha/issues/5360)) ([6c96545](https://github.com/mochajs/mocha/commit/6c96545aee03efeee78c55feedcf70664426514c)) * mention explicit browser support range ([#5354](https://github.com/mochajs/mocha/issues/5354)) ([c514c0b](https://github.com/mochajs/mocha/commit/c514c0bfad044f8450a63b2f9c6c781b9ce6f164)) * update Node.js version requirements for 11.x ([#5329](https://github.com/mochajs/mocha/issues/5329)) ([abf3dd9](https://github.com/mochajs/mocha/commit/abf3dd921544b45c4c09eef8f7c9c3c4481a3d66)) ### 🧹 Chores * remove prerelease setting in release-please config ([#5363](https://github.com/mochajs/mocha/issues/5363)) ([8878f22](https://github.com/mochajs/mocha/commit/8878f222c418a0bf4fe170c17573c30b5ea2d567)) ## [11.2.2](https://github.com/mochajs/mocha/compare/v11.2.1...v11.2.2) (2025-04-10) ### 🩹 Fixes * **deps:** update chokidar to v4 ([#5256](https://github.com/mochajs/mocha/issues/5256)) ([8af0f1a](https://github.com/mochajs/mocha/commit/8af0f1a9005a948fbefeb19be618a64dd910d39f)) ### 📚 Documentation * add ClientRedirects.astro ([#5324](https://github.com/mochajs/mocha/issues/5324)) ([b88d441](https://github.com/mochajs/mocha/commit/b88d441cc7616253892572778150998627d746ec)) * add example/tests.html to docs-next ([#5325](https://github.com/mochajs/mocha/issues/5325)) ([6ec5762](https://github.com/mochajs/mocha/commit/6ec5762edd419578e9d3ce2fcc2b8dedcb0caf06)) ## [11.2.1](https://github.com/mochajs/mocha/compare/v11.2.0...v11.2.1) (2025-04-10) ### 🩹 Fixes * switch from ansi-colors to picocolors ([#5323](https://github.com/mochajs/mocha/issues/5323)) ([7c08d09](https://github.com/mochajs/mocha/commit/7c08d0944d2255084bc4415238430b13c90f0df5)) ### 📚 Documentation * fix new website typos, improve readability ([#5312](https://github.com/mochajs/mocha/issues/5312)) ([fbceb19](https://github.com/mochajs/mocha/commit/fbceb19bbdad121f0100ec3434258775bd87aeaf)) ### 🧹 Chores * "force" Netlify to use npm to build new site ([#5319](https://github.com/mochajs/mocha/issues/5319)) ([3a46855](https://github.com/mochajs/mocha/commit/3a46855294f82e58a5a414aed3525e394b82aced)) * Fix tests ([#5320](https://github.com/mochajs/mocha/issues/5320)) ([18699a0](https://github.com/mochajs/mocha/commit/18699a0d668ed2654dd15433f03b74348baf9559)) ## [11.2.0](https://github.com/mochajs/mocha/compare/v11.1.0...v11.2.0) (2025-03-17) ### 🌟 Features * enable reporters to show relative paths of tests ([#5292](https://github.com/mochajs/mocha/issues/5292)) ([81ea666](https://github.com/mochajs/mocha/commit/81ea6667e9286c55ffa67977448b776a23c6da2d)) ### 📚 Documentation * add instructions for API docs ([#5287](https://github.com/mochajs/mocha/issues/5287)) ([b720ec1](https://github.com/mochajs/mocha/commit/b720ec1b3ca630a90f80311da391b2a0cdfead4e)) * add new website using Astro Starlight ([#5246](https://github.com/mochajs/mocha/issues/5246)) ([b1f1cb7](https://github.com/mochajs/mocha/commit/b1f1cb78b655191b7a43dc962b513bf1b076890c)) * improve third-party reporter docs ([#5285](https://github.com/mochajs/mocha/issues/5285)) ([c5a0ef5](https://github.com/mochajs/mocha/commit/c5a0ef523d52d8cab50e4a9b226af3790f54e75f)) ### 🧹 Chores * enabled eslint-plugin-n ([#5280](https://github.com/mochajs/mocha/issues/5280)) ([945d6e3](https://github.com/mochajs/mocha/commit/945d6e3bf5a9de19c3aa26fbdac966a721006b58)) * pin node-lts tests to 22.11.0 ([#5279](https://github.com/mochajs/mocha/issues/5279)) ([664e1f4](https://github.com/mochajs/mocha/commit/664e1f49f7ae214a9666c90f388407e9fa100309)) * replace `fs-extra` with newer `fs` built-ins ([#5284](https://github.com/mochajs/mocha/issues/5284)) ([75dcf8c](https://github.com/mochajs/mocha/commit/75dcf8c6c40ed1ce134ae5e174b6f4c4ca4d8c42)) ## [11.1.0](https://github.com/mochajs/mocha/compare/v11.0.2...v11.1.0) (2025-01-02) ### 🌟 Features * bump yargs to 17 ([#5165](https://github.com/mochajs/mocha/issues/5165)) ([8f1c8d8](https://github.com/mochajs/mocha/commit/8f1c8d888b0104afcd95ca55a517320399755749)) * Note that this also included a version bump of [`yargs-parser`](http://npmjs.com/package/yargs-parser) from `^20.2.9` to `^21.1.`, which fixed a bug that caused extra quotes in file paths to be removed. See [#5341](https://github.com/mochajs/mocha/issues/5341) for more information. * replace `strip-ansi` with `util.stripVTControlCharacters` ([#5267](https://github.com/mochajs/mocha/issues/5267)) ([3c191c0](https://github.com/mochajs/mocha/commit/3c191c05d9db1e99aec9b600edac2ce10a6b6d71)), closes [#5265](https://github.com/mochajs/mocha/issues/5265) ## [11.0.2](https://github.com/mochajs/mocha/compare/v11.0.1...v11.0.2) (2024-12-09) ### 🩹 Fixes * catch exceptions setting Error.stackTraceLimit ([#5254](https://github.com/mochajs/mocha/issues/5254)) ([259f8f8](https://github.com/mochajs/mocha/commit/259f8f8ba5709b5d84fa66e17cd10560a11f45c9)) * error handling for unexpected numeric arguments passed to cli ([#5263](https://github.com/mochajs/mocha/issues/5263)) ([210d658](https://github.com/mochajs/mocha/commit/210d658678a2ec3b6f85c59d4b300b4722671099)) ### 📚 Documentation * correct outdated `status: accepting prs` link ([#5268](https://github.com/mochajs/mocha/issues/5268)) ([f729cd0](https://github.com/mochajs/mocha/commit/f729cd09b61bb598409f19b3c76b9e9536812237)) * replace "New in" with "Since" in version annotations ([#5262](https://github.com/mochajs/mocha/issues/5262)) ([6f10d12](https://github.com/mochajs/mocha/commit/6f10d12c6c6dfa4df7d5221a3ce688f687aaf320)) ## [11.0.1](https://github.com/mochajs/mocha/compare/v11.0.0...v11.0.1) (2024-12-02) ### 🌟 Features * bumped glob dependency from 8 to 10 ([#5250](https://github.com/mochajs/mocha/issues/5250)) ([43c3157](https://github.com/mochajs/mocha/commit/43c3157c6ef4f2d4bfecf3ad3a42479fd64187b8)) ### 📚 Documentation * fix examples for `linkPartialObjects` methods ([#5255](https://github.com/mochajs/mocha/issues/5255)) ([34e0e52](https://github.com/mochajs/mocha/commit/34e0e52e047a9119aeae9cb5b660a8438656a1e0)) ## [11.0.0](https://github.com/mochajs/mocha/compare/v10.8.2...v11.0.0) (2024-11-11) ### ⚠ BREAKING CHANGES - adapt new engine range for Mocha 11 ([#5216](https://github.com/mochajs/mocha/issues/5216)) ### 🌟 Features - allow calling hook methods ([#5231](https://github.com/mochajs/mocha/issues/5231)) ([e3da641](https://github.com/mochajs/mocha/commit/e3da641b08bed20f12df524fc64cb9579f980c1e)) ### 🩹 Fixes - adapt new engine range for Mocha 11 ([#5216](https://github.com/mochajs/mocha/issues/5216)) ([80da25a](https://github.com/mochajs/mocha/commit/80da25a4132ca50d3ad35087cb62c9b0f8fc946a)) ### 📚 Documentation - downgrade example/tests chai to 4.5.0 ([#5245](https://github.com/mochajs/mocha/issues/5245)) ([eac87e1](https://github.com/mochajs/mocha/commit/eac87e10f49207a9b388f87d77d198583c6f889a)) ## [10.8.2](https://github.com/mochajs/mocha/compare/v10.8.1...v10.8.2) (2024-10-30) ### 🩹 Fixes - support errors with circular dependencies in object values with --parallel ([#5212](https://github.com/mochajs/mocha/issues/5212)) ([ba0fefe](https://github.com/mochajs/mocha/commit/ba0fefe10b08a689cf49edc3818026938aa3a240)) - test link in html reporter ([#5224](https://github.com/mochajs/mocha/issues/5224)) ([f054acc](https://github.com/mochajs/mocha/commit/f054acc1f60714bbe00ad1ab270fb4977836d045)) ### 📚 Documentation - indicate 'exports' interface does not work in browsers ([#5181](https://github.com/mochajs/mocha/issues/5181)) ([14e640e](https://github.com/mochajs/mocha/commit/14e640ee49718d587779a9594b18f3796c42cf2a)) ### 🧹 Chores - fix docs builds by re-adding eleventy and ignoring gitignore again ([#5240](https://github.com/mochajs/mocha/issues/5240)) ([881e3b0](https://github.com/mochajs/mocha/commit/881e3b0ca2e24284aab2a04f63639a0aa9e0ad1b)) ### 🤖 Automation - **deps:** bump the github-actions group with 1 update ([#5132](https://github.com/mochajs/mocha/issues/5132)) ([e536ab2](https://github.com/mochajs/mocha/commit/e536ab25b308774e3103006c044cb996a2e17c87)) ## [10.8.1](https://github.com/mochajs/mocha/compare/v10.8.0...v10.8.1) (2024-10-29) ### 🩹 Fixes - handle case of invalid package.json with no explicit config ([#5198](https://github.com/mochajs/mocha/issues/5198)) ([f72bc17](https://github.com/mochajs/mocha/commit/f72bc17cb44164bcfff7abc83d0d37d99a061104)) - Typos on mochajs.org ([#5237](https://github.com/mochajs/mocha/issues/5237)) ([d8ca270](https://github.com/mochajs/mocha/commit/d8ca270a960554c9d5c5fbf264e89d668d01ff0d)) - use accurate test links in HTML reporter ([#5228](https://github.com/mochajs/mocha/issues/5228)) ([68803b6](https://github.com/mochajs/mocha/commit/68803b685d55dcccc51fa6ccfd27701cda4e26ed)) ## [10.8.0](https://github.com/mochajs/mocha/compare/v10.7.3...v10.8.0) (2024-10-29) ### 🌟 Features - highlight browser failures ([#5222](https://github.com/mochajs/mocha/issues/5222)) ([8ff4845](https://github.com/mochajs/mocha/commit/8ff48453a8b12d9cacf56b0c0c544c8256af64c7)) ### 🩹 Fixes - remove `:is()` from `mocha.css` to support older browsers ([#5225](https://github.com/mochajs/mocha/issues/5225)) ([#5227](https://github.com/mochajs/mocha/issues/5227)) ([0a24b58](https://github.com/mochajs/mocha/commit/0a24b58477ea8ad146afc798930800b02c08790a)) ### 📚 Documentation - add `SECURITY.md` pointing to Tidelift ([#5210](https://github.com/mochajs/mocha/issues/5210)) ([bd7e63a](https://github.com/mochajs/mocha/commit/bd7e63a1f6d98535ce1ed1ecdb57b3e4db8a33c5)) - adopt Collective Funds Guidelines 0.1 ([#5199](https://github.com/mochajs/mocha/issues/5199)) ([2b03d86](https://github.com/mochajs/mocha/commit/2b03d865eec63d627ff229e07d777f25061260d4)) - update README, LICENSE and fix outdated ([#5197](https://github.com/mochajs/mocha/issues/5197)) ([1203e0e](https://github.com/mochajs/mocha/commit/1203e0ed739bbbf12166078738357fdb29a8c000)) ### 🧹 Chores - fix npm scripts on windows ([#5219](https://github.com/mochajs/mocha/issues/5219)) ([1173da0](https://github.com/mochajs/mocha/commit/1173da0bf614e8d2a826687802ee8cbe8671ccf1)) - remove trailing whitespace in SECURITY.md ([7563e59](https://github.com/mochajs/mocha/commit/7563e59ae3c78ada305d26eadb86998ab54342da)) ## [10.7.3](https://github.com/mochajs/mocha/compare/v10.7.2...v10.7.3) (2024-08-09) ### 🩹 Fixes - make release-please build work ([#5194](https://github.com/mochajs/mocha/issues/5194)) ([afd66ef](https://github.com/mochajs/mocha/commit/afd66ef3df20fab51ce38b97216c09108e5c2bfd)) ## [10.7.2](https://github.com/mochajs/mocha/compare/v10.7.1...v10.7.2) (2024-08-06) ### 📚 Documentation - improve filtering ([#5191](https://github.com/mochajs/mocha/issues/5191)) ([1ac5b55](https://github.com/mochajs/mocha/commit/1ac5b552e3f32694d349023cb7f6196ba92b180e)) ### 🧹 Chores - fix failing markdown linting ([#5193](https://github.com/mochajs/mocha/issues/5193)) ([7e7a2ec](https://github.com/mochajs/mocha/commit/7e7a2ecb9bf8daba7e885a880bd8314b7b6fe07d)) ## [10.7.1](https://github.com/mochajs/mocha/compare/v10.7.0...v10.7.1) (2024-08-06) ### 🩹 Fixes - crash with --parallel and --retries both enabled ([#5173](https://github.com/mochajs/mocha/issues/5173)) ([d7013dd](https://github.com/mochajs/mocha/commit/d7013ddb1099cfafe66a1af9640370998290e62c)) ### 🧹 Chores - add knip to validate included dependencies ([5c2989f](https://github.com/mochajs/mocha/commit/5c2989fcc7ae17618d9db16d7c99e23dfb1d38ee)) - more fully remove assetgraph-builder and canvas ([#5175](https://github.com/mochajs/mocha/issues/5175)) ([1883c41](https://github.com/mochajs/mocha/commit/1883c41a49fad009bd407efc1bece3a5c75fd10a)) - replace `nps` with npm scripts ([#5128](https://github.com/mochajs/mocha/issues/5128)) ([c44653a](https://github.com/mochajs/mocha/commit/c44653a3a04b8418ec24a942fa7513a4673f3667)), closes [#5126](https://github.com/mochajs/mocha/issues/5126) ## 10.7.0 / 2024-07-20 ### :tada: Enhancements - [#4771](https://github.com/mochajs/mocha/pull/4771) feat: add option to not fail on failing test suite ([**@ilgonmic**](https://github.com/ilgonmic)) ## 10.6.1 / 2024-07-20 ### :bug: Fixes - [#3825](https://github.com/mochajs/mocha/pull/3825) fix: do not exit when only unref'd timer is present in test code ([**@boneskull**](https://github.com/boneskull)) - [#5040](https://github.com/mochajs/mocha/pull/5040) fix: support canonical module ([**@JacobLey**](https://github.com/JacobLey)) ## 10.6.0 / 2024-07-02 ### :tada: Enhancements - [#5150](https://github.com/mochajs/mocha/pull/5150) feat: allow ^ versions for character encoding packages ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5151](https://github.com/mochajs/mocha/pull/5151) feat: allow ^ versions for file matching packages ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5152](https://github.com/mochajs/mocha/pull/5152) feat: allow ^ versions for yargs packages ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5153](https://github.com/mochajs/mocha/pull/5153) feat: allow ^ versions for data serialization packages ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5154](https://github.com/mochajs/mocha/pull/5154) feat: allow ^ versions for miscellaneous packages ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) ## 10.5.2 / 2024-06-25 ### :bug: Fixes - [#5032](https://github.com/mochajs/mocha/pull/5032) fix: better tracking of seen objects in error serialization ([**@sam-super**](https://github.com/sam-super)) ## 10.5.1 / 2024-06-24 ### :bug: Fixes - [#5086](https://github.com/mochajs/mocha/pull/5086) fix: Add error handling for nonexistent file case with --file option ([**@khoaHyh**](https://github.com/khoaHyh)) ## 10.5.0 / 2024-06-24 ### :tada: Enhancements - [#5015](https://github.com/mochajs/mocha/pull/5015) feat: use \ and \ for browser progress indicator instead of \ ([**@yourWaifu**](https://github.com/yourWaifu)) - [#5143](https://github.com/mochajs/mocha/pull/5143) feat: allow using any 3.x chokidar dependencies ([**@simhnna**](https://github.com/simhnna)) - [#4835](https://github.com/mochajs/mocha/pull/4835) feat: add MOCHA\_OPTIONS env variable ([**@icholy**](https://github.com/icholy)) ### :bug: Fixes - [#5107](https://github.com/mochajs/mocha/pull/5107) fix: include stack in browser uncaught error reporting ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) ### :nut\_and\_bolt: Other - [#5110](https://github.com/mochajs/mocha/pull/5110) chore: switch two-column list styles to be opt-in ([**@marjys**](https://github.com/marjys)) - [#5135](https://github.com/mochajs/mocha/pull/5135) chore: fix some typos in comments ([**@StevenMia**](https://github.com/StevenMia)) - [#5130](https://github.com/mochajs/mocha/pull/5130) chore: rename 'master' to 'main' in docs and tooling ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) ## 10.4.0 / 2024-03-26 ### :tada: Enhancements - [#4829](https://github.com/mochajs/mocha/pull/4829) feat: include `.cause` stacks in the error stack traces ([**@voxpelli**](https://github.com/voxpelli)) - [#4985](https://github.com/mochajs/mocha/pull/4985) feat: add file path to xunit reporter ([**@bmish**](https://github.com/bmish)) ### :bug: Fixes - [#5074](https://github.com/mochajs/mocha/pull/5074) fix: harden error handling in `lib/cli/run.js` ([**@stalet**](https://github.com/stalet)) ### :nut\_and\_bolt: Other - [#5077](https://github.com/mochajs/mocha/pull/5077) chore: add mtfoley/pr-compliance-action ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5060](https://github.com/mochajs/mocha/pull/5060) chore: migrate ESLint config to flat config ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5095](https://github.com/mochajs/mocha/pull/5095) chore: revert [#5069](https://github.com/mochajs/mocha/pull/5069) to restore Netlify builds ([**@voxpelli**](https://github.com/voxpelli)) - [#5097](https://github.com/mochajs/mocha/pull/5097) docs: add sponsored to sponsorship link rels ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5093](https://github.com/mochajs/mocha/pull/5093) chore: add 'status: in triage' label to issue templates and docs ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5083](https://github.com/mochajs/mocha/pull/5083) docs: fix CHANGELOG.md headings to start with a root-level h1 ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5100](https://github.com/mochajs/mocha/pull/5100) chore: fix header generation and production build crashes ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5104](https://github.com/mochajs/mocha/pull/5104) chore: bump ESLint ecmaVersion to 2020 ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5116](https://github.com/mochajs/mocha/pull/5116) fix: eleventy template builds crash with 'unexpected token at ": string, msg..."' ([**@LcsK**](https://github.com/LcsK)) - [#4869](https://github.com/mochajs/mocha/pull/4869) docs: fix documentation concerning glob expansion on UNIX ([**@binki**](https://github.com/binki)) - [#5122](https://github.com/mochajs/mocha/pull/5122) test: fix xunit integration test ([**@voxpelli**](https://github.com/voxpelli)) - [#5123](https://github.com/mochajs/mocha/pull/5123) chore: activate dependabot for workflows ([**@voxpelli**](https://github.com/voxpelli)) - [#5125](https://github.com/mochajs/mocha/pull/5125) build(deps): bump the github-actions group with 2 updates ([**@dependabot**](https://github.com/dependabot)) ## 10.3.0 / 2024-02-08 This is a stable release equivalent to [10.30.0-prerelease](#1030-prerelease--2024-01-18). ## 10.3.0-prerelease / 2024-01-18 This is a prerelease version to test our ability to release. Other than removing or updating dependencies, it contains no intended user-facing changes. ### :nut\_and\_bolt: Other - [#5069](https://github.com/mochajs/mocha/pull/5069): chore: remove unnecessary canvas dependency ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5068](https://github.com/mochajs/mocha/pull/5068): fix: add alt text to Built with Netlify badge ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5056](https://github.com/mochajs/mocha/pull/5056): chore: inline nyan reporter's write function ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5050](https://github.com/mochajs/mocha/pull/5050): docs: touchups to labels and a template title post-revamp ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5038](https://github.com/mochajs/mocha/pull/5038): docs: overhaul contributing and maintenance docs for end-of-year 2023 ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5029](https://github.com/mochajs/mocha/pull/5029): chore: remove stale workflow ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#5024](https://github.com/mochajs/mocha/pull/5024): chore: remove nanoid as dependency ([**@Uzlopak**](https://github.com/Uzlopak)) - [#5023](https://github.com/mochajs/mocha/pull/5023): chore: remove touch as dev dependency ([**@Uzlopak**](https://github.com/Uzlopak)) - [#5022](https://github.com/mochajs/mocha/pull/5022): chore: remove uuid dev dependency ([**@Uzlopak**](https://github.com/Uzlopak)) - [#5021](https://github.com/mochajs/mocha/pull/5021): update can-i-use ([**@Uzlopak**](https://github.com/Uzlopak)) - [#5020](https://github.com/mochajs/mocha/pull/5020): chore: fix the ci ([**@Uzlopak**](https://github.com/Uzlopak)) - [#4974](https://github.com/mochajs/mocha/pull/4974): Add Node v19 to test matrix ([**@juergba**](https://github.com/juergba)) - [#4970](https://github.com/mochajs/mocha/pull/4970): fix [#4837](https://github.com/mochajs/mocha/issues/4837) Update glob due to vulnerability in dep ([**@jb2311**](https://github.com/jb2311)) - [#4962](https://github.com/mochajs/mocha/pull/4962): Fix deprecated warn gh actions ([**@outsideris**](https://github.com/outsideris)) - [#4927](https://github.com/mochajs/mocha/pull/4927): docs: use mocha.js instead of mocha in the example run ([**@nikolas**](https://github.com/nikolas)) - [#4918](https://github.com/mochajs/mocha/pull/4918): docs: fix fragment ID for yargs' "extends" documentation ([**@Spencer-Doak**](https://github.com/Spencer-Doak)) - [#4886](https://github.com/mochajs/mocha/pull/4886): docs: fix jsdoc return type of titlePath method ([**@F3n67u**](https://github.com/F3n67u)) ## 10.2.0 / 2022-12-11 ### :tada: Enhancements - [#4945](https://github.com/mochajs/mocha/issues/4945): API: add possibility to decorate ESM name before import ([**@j0tunn**](https://github.com/j0tunn)) ### :bug: Fixes - [#4946](https://github.com/mochajs/mocha/issues/4946): Browser: color of failed test icon ([**@kleisauke**](https://github.com/kleisauke)) ### :book: Documentation - [#4944](https://github.com/mochajs/mocha/issues/4944): Remove duplicated header ([**@PauloGoncalvesBH**](https://github.com/PauloGoncalvesBH)) ## 10.1.0 / 2022-10-16 ### :tada: Enhancements - [#4896](https://github.com/mochajs/mocha/issues/4896): Browser: add support for `prefers-color-scheme: dark` ([**@greggman**](https://github.com/greggman)) ### :nut\_and\_bolt: Other - [#4912](https://github.com/mochajs/mocha/issues/4912): Browser: increase contrast for replay buttons ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg)) - [#4905](https://github.com/mochajs/mocha/issues/4905): Use standard `Promise.allSettled` instead of polyfill ([**@outsideris**](https://github.com/outsideris)) - [#4899](https://github.com/mochajs/mocha/issues/4899): Upgrade official GitHub actions to latest ([**@ddzz**](https://github.com/ddzz)) - [#4770](https://github.com/mochajs/mocha/issues/4770): Fix regex in function `clean`([**@yetingli**](https://github.com/yetingli)) ## 10.0.0 / 2022-05-01 ### :boom: Breaking Changes - [#4845](https://github.com/mochajs/mocha/issues/4845): **Drop Node.js v12.x support** ([**@juergba**](https://github.com/juergba)) - [#4848](https://github.com/mochajs/mocha/issues/4848): Drop Internet-Explorer-11 support ([**@juergba**](https://github.com/juergba)) - [#4857](https://github.com/mochajs/mocha/issues/4857): Drop AMD/RequireJS support ([**@juergba**](https://github.com/juergba)) - [#4866](https://github.com/mochajs/mocha/issues/4866): Drop Growl notification support ([**@juergba**](https://github.com/juergba)) - [#4863](https://github.com/mochajs/mocha/issues/4863): Rename executable `bin/mocha` to `bin/mocha.js` ([**@juergba**](https://github.com/juergba)) - [#4865](https://github.com/mochajs/mocha/issues/4865): `--ignore` option in Windows: upgrade Minimatch ([**@juergba**](https://github.com/juergba)) - [#4861](https://github.com/mochajs/mocha/issues/4861): Remove deprecated `Runner` signature ([**@juergba**](https://github.com/juergba)) ### :nut\_and\_bolt: Other - [#4878](https://github.com/mochajs/mocha/issues/4878): Update production dependencies ([**@juergba**](https://github.com/juergba)) - [#4876](https://github.com/mochajs/mocha/issues/4876): Add Node.js v18 to CI test matrix ([**@outsideris**](https://github.com/outsideris)) - [#4852](https://github.com/mochajs/mocha/issues/4852): Replace deprecated `String.prototype.substr()` ([**@CommanderRoot**](https://github.com/CommanderRoot)) Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https://github.com/SukkaW) for improvements to our documentation. ## 9.2.2 / 2022-03-11 ### :bug: Fixes - [#4842](https://github.com/mochajs/mocha/issues/4842): Loading of reporter throws wrong error ([**@juergba**](https://github.com/juergba)) - [#4839](https://github.com/mochajs/mocha/issues/4839): `dry-run`: prevent potential call-stack crash ([**@juergba**](https://github.com/juergba)) ### :nut\_and\_bolt: Other - [#4843](https://github.com/mochajs/mocha/issues/4843): Update production dependencies ([**@juergba**](https://github.com/juergba)) ## 9.2.1 / 2022-02-19 ### :bug: Fixes - [#4832](https://github.com/mochajs/mocha/issues/4832): Loading of config files throws wrong error ([**@juergba**](https://github.com/juergba)) - [#4799](https://github.com/mochajs/mocha/issues/4799): Reporter: configurable `maxDiffSize` reporter-option ([**@norla**](https://github.com/norla)) ## 9.2.0 / 2022-01-24 ### :tada: Enhancements - [#4813](https://github.com/mochajs/mocha/issues/4813): Parallel: assign each worker a worker-id ([**@forty**](https://github.com/forty)) ### :nut\_and\_bolt: Other - [#4818](https://github.com/mochajs/mocha/issues/4818): Update production dependencies ([**@juergba**](https://github.com/juergba)) ## 9.1.4 / 2022-01-14 ### :bug: Fixes - [#4807](https://github.com/mochajs/mocha/issues/4807): `import` throws wrong error if loader is used ([**@giltayar**](https://github.com/giltayar)) ### :nut\_and\_bolt: Other - [#4777](https://github.com/mochajs/mocha/issues/4777): Add Node v17 to CI test matrix ([**@outsideris**](https://github.com/outsideris)) ## 9.1.3 / 2021-10-15 ### :bug: Fixes - [#4769](https://github.com/mochajs/mocha/issues/4769): Browser: re-enable `bdd` ES6 style import ([**@juergba**](https://github.com/juergba)) ### :nut\_and\_bolt: Other - [#4764](https://github.com/mochajs/mocha/issues/4764): Revert deprecation of `EVENT_SUITE_ADD_*` events ([**@beatfactor**](https://github.com/beatfactor)) ## 9.1.2 / 2021-09-25 ### :bug: Fixes - [#4746](https://github.com/mochajs/mocha/issues/4746): Browser: stop using all global vars in `browser-entry.js` ([**@PaperStrike**](https://github.com/PaperStrike)) ### :nut\_and\_bolt: Other - [#4754](https://github.com/mochajs/mocha/issues/4754): Remove dependency wide-align ([**@juergba**](https://github.com/juergba)) - [#4736](https://github.com/mochajs/mocha/issues/4736): ESM: remove code for Node versions <10 ([**@juergba**](https://github.com/juergba)) ## 9.1.1 / 2021-08-28 ### :bug: Fixes - [#4623](https://github.com/mochajs/mocha/issues/4623): `XUNIT` and `JSON` reporter crash in `parallel` mode ([**@curtisman**](https://github.com/curtisman)) ## 9.1.0 / 2021-08-20 ### :tada: Enhancements - [#4716](https://github.com/mochajs/mocha/issues/4716): Add new option `--fail-zero` ([**@juergba**](https://github.com/juergba)) - [#4691](https://github.com/mochajs/mocha/issues/4691): Add new option `--node-option` ([**@juergba**](https://github.com/juergba)) - [#4607](https://github.com/mochajs/mocha/issues/4607): Add output option to `JSON` reporter ([**@dorny**](https://github.com/dorny)) ## 9.0.3 / 2021-07-25 ### :bug: Fixes - [#4702](https://github.com/mochajs/mocha/issues/4702): Error rethrow from cwd-relative path while loading `.mocharc.js` ([**@kirill-golovan**](https://github.com/kirill-golovan)) - [#4688](https://github.com/mochajs/mocha/issues/4688): Usage of custom interface in parallel mode ([**@juergba**](https://github.com/juergba)) - [#4687](https://github.com/mochajs/mocha/issues/4687): ESM: don't swallow `MODULE_NOT_FOUND` errors in case of `type:module` ([**@giltayar**](https://github.com/giltayar)) ## 9.0.2 / 2021-07-03 ### :bug: Fixes - [#4668](https://github.com/mochajs/mocha/issues/4668): ESM: make `--require ` work with new `import`-first loading ([**@giltayar**](https://github.com/giltayar)) ### :nut\_and\_bolt: Other - [#4674](https://github.com/mochajs/mocha/issues/4674): Update production dependencies ([**@juergba**](https://github.com/juergba)) ## 9.0.1 / 2021-06-18 ### :nut\_and\_bolt: Other - [#4657](https://github.com/mochajs/mocha/issues/4657): Browser: add separate bundle for modern browsers ([**@juergba**](https://github.com/juergba)) We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we skipped the transpilation down to ES5. This is an **experimental step towards freezing Mocha's support of IE11**. - [#4653](https://github.com/mochajs/mocha/issues/4653): ESM: proper version check in `hasStableEsmImplementation` ([**@alexander-fenster**](https://github.com/alexander-fenster)) ## 9.0.0 / 2021-06-07 ### :boom: Breaking Changes - [#4633](https://github.com/mochajs/mocha/issues/4633): **Drop Node.js v10.x support** ([**@juergba**](https://github.com/juergba)) - [#4635](https://github.com/mochajs/mocha/issues/4635): `import`-first loading of test files ([**@giltayar**](https://github.com/giltayar)) **Mocha is going ESM-first!** This means that it will now use ESM `import(test_file)` to load the test files, instead of the CommonJS `require(test_file)`. This is not a problem, as `import` can also load most files that `require` does. In the rare cases where this fails, it will fallback to `require(...)`. This ESM-first approach is the next step in Mocha's ESM migration, and allows ESM loaders to load and transform the test file. - [#4636](https://github.com/mochajs/mocha/issues/4636): Remove deprecated `utils.lookupFiles()` ([**@juergba**](https://github.com/juergba)) - [#4638](https://github.com/mochajs/mocha/issues/4638): Limit the size of `actual`/`expected` for `diff` generation ([**@juergba**](https://github.com/juergba)) - [#4389](https://github.com/mochajs/mocha/issues/4389): Refactoring: Consuming log-symbols alternate to code for win32 in reporters/base ([**@MoonSupport**](https://github.com/MoonSupport)) ### :tada: Enhancements - [#4640](https://github.com/mochajs/mocha/issues/4640): Add new option `--dry-run` ([**@juergba**](https://github.com/juergba)) ### :bug: Fixes - [#4128](https://github.com/mochajs/mocha/issues/4128): Fix: control stringification of error message ([**@syeutyu**](https://github.com/syeutyu)) ### :nut\_and\_bolt: Other - [#4646](https://github.com/mochajs/mocha/issues/4646): Deprecate `Runner(suite: Suite, delay: boolean)` signature ([**@juergba**](https://github.com/juergba)) - [#4643](https://github.com/mochajs/mocha/issues/4643): Update production dependencies ([**@juergba**](https://github.com/juergba)) ## 8.4.0 / 2021-05-07 ### :tada: Enhancements - [#4502](https://github.com/mochajs/mocha/issues/4502): CLI file parsing errors now have error codes ([**@evaline-ju**](https://github.com/evaline-ju)) ### :bug: Fixes - [#4614](https://github.com/mochajs/mocha/issues/4614): Watch: fix crash when reloading files ([**@outsideris**](https://github.com/outsideris)) ### :book: Documentation - [#4630](https://github.com/mochajs/mocha/issues/4630): Add `options.require` to Mocha constructor for `root hook` plugins on parallel runs ([**@juergba**](https://github.com/juergba)) - [#4617](https://github.com/mochajs/mocha/issues/4617): Dynamically generating tests with `top-level await` and ESM test files ([**@juergba**](https://github.com/juergba)) - [#4608](https://github.com/mochajs/mocha/issues/4608): Update default file extensions ([**@outsideris**](https://github.com/outsideris)) Also thanks to [**@outsideris**](https://github.com/outsideris) for various improvements on our GH actions workflows. ## 8.3.2 / 2021-03-12 ### :bug: Fixes - [#4599](https://github.com/mochajs/mocha/issues/4599): Fix regression in `require` interface ([**@alexander-fenster**](https://github.com/alexander-fenster)) ### :book: Documentation - [#4601](https://github.com/mochajs/mocha/issues/4601): Add build to GH actions run ([**@christian-bromann**](https://github.com/christian-bromann)) - [#4596](https://github.com/mochajs/mocha/issues/4596): Filter active sponsors/backers ([**@juergba**](https://github.com/juergba)) - [#4225](https://github.com/mochajs/mocha/issues/4225): Update config file examples ([**@pkuczynski**](https://github.com/pkuczynski)) ## 8.3.1 / 2021-03-06 ### :bug: Fixes - [#4577](https://github.com/mochajs/mocha/issues/4577): Browser: fix `EvalError` caused by regenerator-runtime ([**@snoack**](https://github.com/snoack)) - [#4574](https://github.com/mochajs/mocha/issues/4574): ESM: allow `import` from mocha in parallel mode ([**@nicojs**](https://github.com/nicojs)) ## 8.3.0 / 2021-02-11 ### :tada: Enhancements - [#4506](https://github.com/mochajs/mocha/issues/4506): Add error code for test timeout errors ([**@boneskull**](https://github.com/boneskull)) - [#4112](https://github.com/mochajs/mocha/issues/4112): Add BigInt support to stringify util function ([**@JosejeSinohui**](https://github.com/JosejeSinohui)) ### :bug: Fixes - [#4557](https://github.com/mochajs/mocha/issues/4557): Add file location when SyntaxError happens in ESM ([**@giltayar**](https://github.com/giltayar)) - [#4521](https://github.com/mochajs/mocha/issues/4521): Fix `require` error when bundling Mocha with Webpack ([**@devhazem**](https://github.com/devhazem)) ### :book: Documentation - [#4507](https://github.com/mochajs/mocha/issues/4507): Add support for typescript-style docstrings ([**@boneskull**](https://github.com/boneskull)) - [#4503](https://github.com/mochajs/mocha/issues/4503): Add GH Actions workflow status badge ([**@outsideris**](https://github.com/outsideris)) - [#4494](https://github.com/mochajs/mocha/issues/4494): Add example of generating tests dynamically with a closure ([**@maxwellgerber**](https://github.com/maxwellgerber)) ### :nut\_and\_bolt: Other - [#4556](https://github.com/mochajs/mocha/issues/4556): Upgrade all dependencies to latest stable ([**@AviVahl**](https://github.com/AviVahl)) - [#4543](https://github.com/mochajs/mocha/issues/4543): Update dependencies yargs and yargs-parser ([**@juergba**](https://github.com/juergba)) Also thanks to [**@outsideris**](https://github.com/outsideris) and [**@HyunSangHan**](https://github.com/HyunSangHan) for various fixes to our website and documentation. ## 8.2.1 / 2020-11-02 Fixed stuff. ### :bug: Fixes - [#4489](https://github.com/mochajs/mocha/issues/4489): Fix problematic handling of otherwise-unhandled `Promise` rejections and erroneous "`done()` called twice" errors ([**@boneskull**](https://github.com/boneskull)) - [#4496](https://github.com/mochajs/mocha/issues/4496): Avoid `MaxListenersExceededWarning` in watch mode ([**@boneskull**](https://github.com/boneskull)) Also thanks to [**@akeating**](https://github.com/akeating) for a documentation fix! ## 8.2.0 / 2020-10-16 The major feature added in v8.2.0 is addition of support for [*global fixtures*](https://mochajs.org/#global-fixtures). While Mocha has always had the ability to run setup and teardown via a hook (e.g., a `before()` at the top level of a test file) when running tests in serial, Mocha v8.0.0 added support for parallel runs. Parallel runs are *incompatible* with this strategy; e.g., a top-level `before()` would only run for the file in which it was defined. With [global fixtures](https://mochajs.org/#global-fixtures), Mocha can now perform user-defined setup and teardown *regardless* of mode, and these fixtures are guaranteed to run *once and only once*. This holds for parallel mode, serial mode, and even "watch" mode (the teardown will run once you hit Ctrl-C, just before Mocha finally exits). Tasks such as starting and stopping servers are well-suited to global fixtures, but not sharing resources--global fixtures do *not* share context with your test files (but they do share context with each other). Here's a short example of usage: ```js // fixtures.js // can be async or not exports.mochaGlobalSetup = async function () { this.server = await startSomeServer({port: process.env.TEST_PORT}); console.log(`server running on port ${this.server.port}`); }; exports.mochaGlobalTeardown = async function () { // the context (`this`) is shared, but not with the test files await this.server.stop(); console.log(`server on port ${this.server.port} stopped`); }; // this file can contain root hook plugins as well! // exports.mochaHooks = { ... } ``` Fixtures are loaded with `--require`, e.g., `mocha --require fixtures.js`. For detailed information, please see the [documentation](https://mochajs.org/#global-fixtures) and this handy-dandy [flowchart](https://mochajs.org/#test-fixture-decision-tree-wizard-thing) to help understand the differences between hooks, root hook plugins, and global fixtures (and when you should use each). ### :tada: Enhancements - [#4308](https://github.com/mochajs/mocha/issues/4308): Support run-once [global setup & teardown fixtures](https://mochajs.org/#global-fixtures) ([**@boneskull**](https://github.com/boneskull)) - [#4442](https://github.com/mochajs/mocha/issues/4442): Multi-part extensions (e.g., `test.js`) now usable with `--extension` option ([**@jordanstephens**](https://github.com/jordanstephens)) - [#4472](https://github.com/mochajs/mocha/issues/4472): Leading dots (e.g., `.js`, `.test.js`) now usable with `--extension` option ([**@boneskull**](https://github.com/boneskull)) - [#4434](https://github.com/mochajs/mocha/issues/4434): Output of `json` reporter now contains `speed` ("fast"/"medium"/"slow") property ([**@wwhurin**](https://github.com/wwhurin)) - [#4464](https://github.com/mochajs/mocha/issues/4464): Errors thrown by serializer in parallel mode now have error codes ([**@evaline-ju**](https://github.com/evaline-ju)) *For implementors of custom reporters:* - [#4409](https://github.com/mochajs/mocha/issues/4409): Parallel mode and custom reporter improvements ([**@boneskull**](https://github.com/boneskull)): - Support custom worker-process-only reporters (`Runner.prototype.workerReporter()`); reporters should subclass `ParallelBufferedReporter` in `mocha/lib/nodejs/reporters/parallel-buffered` - Allow opt-in of object reference matching for "sufficiently advanced" custom reporters (`Runner.prototype.linkPartialObjects()`); use if strict object equality is needed when consuming `Runner` event data - Enable detection of parallel mode (`Runner.prototype.isParallelMode()`) ### :bug: Fixes - [#4476](https://github.com/mochajs/mocha/issues/4476): Workaround for profoundly bizarre issue affecting `npm` v6.x causing some of Mocha's deps to be installed when `mocha` is present in a package's `devDependencies` and `npm install --production` is run the package's working copy ([**@boneskull**](https://github.com/boneskull)) - [#4465](https://github.com/mochajs/mocha/issues/4465): Worker processes guaranteed (as opposed to "very likely") to exit before Mocha does; fixes a problem when using `nyc` with Mocha in parallel mode ([**@boneskull**](https://github.com/boneskull)) - [#4419](https://github.com/mochajs/mocha/issues/4419): Restore `lookupFiles()` in `mocha/lib/utils`, which was broken/missing in Mocha v8.1.0; it now prints a deprecation warning (use `const {lookupFiles} = require('mocha/lib/cli')` instead) ([**@boneskull**](https://github.com/boneskull)) Thanks to [**@AviVahl**](https://github.com/AviVahl), [**@donghoon-song**](https://github.com/donghoon-song), [**@ValeriaVG**](https://github.com/ValeriaVG), [**@znarf**](https://github.com/znarf), [**@sujin-park**](https://github.com/sujin-park), and [**@majecty**](https://github.com/majecty) for other helpful contributions! ## 8.1.3 / 2020-08-28 ### :bug: Fixes - [#4425](https://github.com/mochajs/mocha/issues/4425): Restore `Mocha.utils.lookupFiles()` and Webpack compatibility (both broken since v8.1.0); `Mocha.utils.lookupFiles()` is now **deprecated** and will be removed in the next major revision of Mocha; use `require('mocha/lib/cli').lookupFiles` instead ([**@boneskull**](https://github.com/boneskull)) ## 8.1.2 / 2020-08-25 ### :bug: Fixes - [#4418](https://github.com/mochajs/mocha/issues/4418): Fix command-line flag incompatibility in forthcoming Node.js v14.9.0 ([**@boneskull**](https://github.com/boneskull)) - [#4401](https://github.com/mochajs/mocha/issues/4401): Fix missing global variable in browser ([**@irrationnelle**](https://github.com/irrationnelle)) ### :lock: Security Fixes - [#4396](https://github.com/mochajs/mocha/issues/4396): Update many dependencies ([**@GChuf**](https://github.com/GChuf)) ### :book: Documentation - Various fixes by [**@sujin-park**](https://github.com/sujin-park), [**@wwhurin**](https://github.com/wwhurin) & [**@Donghoon759**](https://github.com/Donghoon759) ## 8.1.1 / 2020-08-04 ### :bug: Fixes - [#4394](https://github.com/mochajs/mocha/issues/4394): Fix regression wherein certain reporters did not correctly detect terminal width ([**@boneskull**](https://github.com/boneskull)) ## 8.1.0 / 2020-07-30 In this release, Mocha now builds its browser bundle with Rollup and Babel, which will provide the project's codebase more flexibility and consistency. While we've been diligent about backwards compatibility, it's *possible* consumers of the browser bundle will encounter differences (other than an increase in the bundle size). If you *do* encounter an issue with the build, please [report it here](https://github.com/mochajs/mocha/issues/new?labels=unconfirmed-bug\&template=bug_report.md\&title=). This release **does not** drop support for IE11. Other community contributions came from [**@Devjeel**](https://github.com/Devjeel), [**@Harsha509**](https://github.com/Harsha509) and [**@sharath2106**](https://github.com/sharath2106). *Thank you* to everyone who contributed to this release! > Do you read Korean? See [this guide to running parallel tests in Mocha](https://blog.outsider.ne.kr/1489), translated by our maintainer, [**@outsideris**](https://github.com/outsideris). ### :tada: Enhancements - [#4287](https://github.com/mochajs/mocha/issues/4287): Use background colors with inline diffs for better visual distinction ([**@michael-brade**](https://github.com/michael-brade)) ### :bug: Fixes - [#4328](https://github.com/mochajs/mocha/issues/4328): Fix "watch" mode when Mocha run in parallel ([**@boneskull**](https://github.com/boneskull)) - [#4382](https://github.com/mochajs/mocha/issues/4382): Fix root hook execution in "watch" mode ([**@indieisaconcept**](https://github.com/indieisaconcept)) - [#4383](https://github.com/mochajs/mocha/issues/4383): Consistent auto-generated hook titles ([**@cspotcode**](https://github.com/cspotcode)) - [#4359](https://github.com/mochajs/mocha/issues/4359): Better errors when running `mocha init` ([**@boneskull**](https://github.com/boneskull)) - [#4341](https://github.com/mochajs/mocha/issues/4341): Fix weirdness when using `delay` option in browser ([**@craigtaub**](https://github.com/craigtaub)) ### :lock: Security Fixes - [#4378](https://github.com/mochajs/mocha/issues/4378), [#4333](https://github.com/mochajs/mocha/issues/4333): Update [javascript-serialize](https://npm.im/javascript-serialize) ([**@martinoppitz**](https://github.com/martinoppitz), [**@wnghdcjfe**](https://github.com/wnghdcjfe)) - [#4354](https://github.com/mochajs/mocha/issues/4354): Update [yargs-unparser](https://npm.im/yargs-unparser) ([**@martinoppitz**](https://github.com/martinoppitz)) ### :book: Documentation & Website - [#4173](https://github.com/mochajs/mocha/issues/4173): Document how to use `--enable-source-maps` with Mocha ([**@bcoe**](https://github.com/bcoe)) - [#4343](https://github.com/mochajs/mocha/issues/4343): Clean up some API docs ([**@craigtaub**](https://github.com/craigtaub)) - [#4318](https://github.com/mochajs/mocha/issues/4318): Sponsor images are now self-hosted ([**@Munter**](https://github.com/Munter)) ### :nut\_and\_bolt: Other - [#4293](https://github.com/mochajs/mocha/issues/4293): Use Rollup and Babel in build pipeline; add source map to published files ([**@Munter**](https://github.com/Munter)) ## 8.0.1 / 2020-06-10 The obligatory patch after a major. ### :bug: Fixes - [#4328](https://github.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@boneskull**](https://github.com/boneskull)) ## 8.0.0 / 2020-06-10 In this major release, Mocha adds the ability to *run tests in parallel*. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](https://github.com/nicojs) to the maintenance team! ### :boom: Breaking Changes - [#4164](https://github.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.12.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@UlisesGascon**](https://github.com/UlisesGascon)) - [#4175](https://github.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@juergba**](https://github.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#4260](https://github.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@craigtaub**](https://github.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#4315](https://github.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@juergba**](https://github.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#4309](https://github.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@juergba**](https://github.com/juergba)) - [#4282](https://github.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@arvidOtt**](https://github.com/arvidOtt)) - [#4223](https://github.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@juergba**](https://github.com/juergba)) - [#4178](https://github.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@wnghdcjfe**](https://github.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` ### :tada: Enhancements - [#4245](https://github.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@boneskull**](https://github.com/boneskull)) :exclamation: See also [#4244](https://github.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- *root hooks must be defined via Root Hook Plugins to work in parallel mode* - [#4304](https://github.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@JacobLey**](https://github.com/JacobLey)) - [#4299](https://github.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- *use at your own risk!* ([**@giltayar**](https://github.com/giltayar)) ### :book: Documentation - [#4246](https://github.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@boneskull**](https://github.com/boneskull)) ### :nut\_and\_bolt: Other - [#4200](https://github.com/mochajs/mocha/issues/4200): Drop mkdirp and replace it with fs.mkdirSync ([**@HyunSangHan**](https://github.com/HyunSangHan)) ### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above) ## 7.2.0 / 2020-05-22 ### :tada: Enhancements - [#4234](https://github.com/mochajs/mocha/issues/4234): Add ability to run tests in a mocha instance multiple times ([**@nicojs**](https://github.com/nicojs)) - [#4219](https://github.com/mochajs/mocha/issues/4219): Exposing filename in JSON, doc, and json-stream reporters ([**@Daniel0113**](https://github.com/Daniel0113)) - [#4244](https://github.com/mochajs/mocha/issues/4244): Add Root Hook Plugins ([**@boneskull**](https://github.com/boneskull)) ### :bug: Fixes - [#4258](https://github.com/mochajs/mocha/issues/4258): Fix missing dot in name of configuration file ([**@sonicdoe**](https://github.com/sonicdoe)) - [#4194](https://github.com/mochajs/mocha/issues/4194): Check if module.paths really exists ([**@ematipico**](https://github.com/ematipico)) - [#4256](https://github.com/mochajs/mocha/issues/4256): `--forbid-only` does not recognize `it.only` when `before` crashes ([**@arvidOtt**](https://github.com/arvidOtt)) - [#4152](https://github.com/mochajs/mocha/issues/4152): Bug with multiple async done() calls ([**@boneskull**](https://github.com/boneskull)) - [#4275](https://github.com/mochajs/mocha/issues/4275): Improper warnings for invalid reporters ([**@boneskull**](https://github.com/boneskull)) - [#4288](https://github.com/mochajs/mocha/issues/4288): Broken hook.spec.js test for IE11 ([**@boneskull**](https://github.com/boneskull)) ### :book: Documentation - [#4081](https://github.com/mochajs/mocha/issues/4081): Insufficient white space for API docs in view on mobile ([**@HyunSangHan**](https://github.com/HyunSangHan)) - [#4255](https://github.com/mochajs/mocha/issues/4255): Update mocha-docdash for UI fixes on API docs ([**@craigtaub**](https://github.com/craigtaub)) - [#4235](https://github.com/mochajs/mocha/issues/4235): Enable emoji on website; enable normal ul elements ([**@boneskull**](https://github.com/boneskull)) - [#4272](https://github.com/mochajs/mocha/issues/4272): Fetch sponsors at build time, show ALL non-skeevy sponsors ([**@boneskull**](https://github.com/boneskull)) ### :nut\_and\_bolt: Other - [#4249](https://github.com/mochajs/mocha/issues/4249): Refactoring improving encapsulation ([**@arvidOtt**](https://github.com/arvidOtt)) - [#4242](https://github.com/mochajs/mocha/issues/4242): CI add job names, add Node.js v14 to matrix ([**@boneskull**](https://github.com/boneskull)) - [#4237](https://github.com/mochajs/mocha/issues/4237): Refactor validatePlugins to throw coded errors ([**@boneskull**](https://github.com/boneskull)) - [#4236](https://github.com/mochajs/mocha/issues/4236): Better debug output ([**@boneskull**](https://github.com/boneskull)) ## 7.1.2 / 2020-04-26 ### :nut\_and\_bolt: Other - [#4251](https://github.com/mochajs/mocha/issues/4251): Prevent karma-mocha from stalling ([**@juergba**](https://github.com/juergba)) - [#4222](https://github.com/mochajs/mocha/issues/4222): Update dependency mkdirp to v0.5.5 ([**@outsideris**](https://github.com/outsideris)) ### :book: Documentation - [#4208](https://github.com/mochajs/mocha/issues/4208): Add Wallaby logo to site ([**@boneskull**](https://github.com/boneskull)) ## 7.1.1 / 2020-03-18 ### :lock: Security Fixes - [#4204](https://github.com/mochajs/mocha/issues/4204): Update dependencies mkdirp, yargs-parser and yargs ([**@juergba**](https://github.com/juergba)) ### :bug: Fixes - [#3660](https://github.com/mochajs/mocha/issues/3660): Fix `runner` listening to `start` and `end` events ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#4190](https://github.com/mochajs/mocha/issues/4190): Show Netlify badge on footer ([**@outsideris**](https://github.com/outsideris)) ## 7.1.0 / 2020-02-26 ### :tada: Enhancements [#4038](https://github.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@giltayar**](https://github.com/giltayar)) Mocha supports writing your test files as ES modules: - Node.js only v12.11.0 and above - Node.js below v13.2.0, you must set `--experimental-modules` option - current limitations: please check our [documentation](https://mochajs.org/#nodejs-native-esm-support) - for programmatic usage: see [API: loadFilesAsync()](https://mochajs.org/api/mocha#loadFilesAsync) **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** ### :bug: Fixes - [#4181](https://github.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@juergba**](https://github.com/juergba)) - [#4174](https://github.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#4058](https://github.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@outsideris**](https://github.com/outsideris)) ### :nut\_and\_bolt: Other - [#4138](https://github.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@kaicataldo**](https://github.com/kaicataldo)) ## 7.0.1 / 2020-01-25 ### :bug: Fixes - [#4165](https://github.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@juergba**](https://github.com/juergba)) - [#4153](https://github.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@holm**](https://github.com/holm)) - [#4150](https://github.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@juergba**](https://github.com/juergba)) - [#4147](https://github.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#4146](https://github.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@boneskull**](https://github.com/boneskull)) - [#4140](https://github.com/mochajs/mocha/issues/4140): Fix broken links ([**@KyoungWan**](https://github.com/KyoungWan)) ### :nut\_and\_bolt: Other - [#4133](https://github.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@Zirak**](https://github.com/Zirak)) ## 7.0.0 / 2020-01-05 ### :boom: Breaking Changes - [#3885](https://github.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@mojosoeun**](https://github.com/mojosoeun)) - [#3890](https://github.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@juergba**](https://github.com/juergba)) - [#3962](https://github.com/mochajs/mocha/issues/3962): Changes to command-line options ([**@ParkSB**](https://github.com/ParkSB)): - `--list-interfaces` replaces `--interfaces` - `--list-reporters` replaces `--reporters` - Hook pattern of `this.skip()` ([**@juergba**](https://github.com/juergba)): - [#3859](https://github.com/mochajs/mocha/issues/3859): When conditionally skipping in a `it` test, related `afterEach` hooks are now executed - [#3741](https://github.com/mochajs/mocha/issues/3741): When conditionally skipping in a `beforeEach` hook, subsequent inner `beforeEach` hooks are now skipped and related `afterEach` hooks are executed - [#4136](https://github.com/mochajs/mocha/issues/4136): Disallow `this.skip()` within `after` hooks - [#3967](https://github.com/mochajs/mocha/issues/3967): Remove deprecated `getOptions()` and `lib/cli/options.js` ([**@juergba**](https://github.com/juergba)) - [#4083](https://github.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@juergba**](https://github.com/juergba)) - [#4004](https://github.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@juergba**](https://github.com/juergba)) ### :tada: Enhancements - [#3980](https://github.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@geigerzaehler**](https://github.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#3979](https://github.com/mochajs/mocha/issues/3979): Type "rs\n" to restart tests ([**@broofa**](https://github.com/broofa)) ### :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: - [#3968](https://github.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@juergba**](https://github.com/juergba)) ### :bug: Fixes - [#4125](https://github.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@juergba**](https://github.com/juergba)) - [#4070](https://github.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@juergba**](https://github.com/juergba)) - [#4068](https://github.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@rgroothuijsen**](https://github.com/rgroothuijsen)) - [#4030](https://github.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@juergba**](https://github.com/juergba)) ### :mag: Coverage - [#4109](https://github.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#4129](https://github.com/mochajs/mocha/issues/4129): Fix broken links ([**@SaeromB**](https://github.com/SaeromB)) - [#4127](https://github.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@khg0712**](https://github.com/khg0712)) - [#4101](https://github.com/mochajs/mocha/issues/4101): Clarify invalid usage of `done()` ([**@jgehrcke**](https://github.com/jgehrcke)) - [#4092](https://github.com/mochajs/mocha/issues/4092): Replace `:coffee:` with emoji ☕️ ([**@pzrq**](https://github.com/pzrq)) - [#4088](https://github.com/mochajs/mocha/issues/4088): Initial draft of project charter ([**@boneskull**](https://github.com/boneskull)) - [#4066](https://github.com/mochajs/mocha/issues/4066): Change `sh` to `bash` for code block in docs/index.md ([**@HyunSangHan**](https://github.com/HyunSangHan)) - [#4045](https://github.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@HyunSangHan**](https://github.com/HyunSangHan)) - [#3988](https://github.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@outsideris**](https://github.com/outsideris)) ### :nut\_and\_bolt: Other - [#4118](https://github.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@kylef**](https://github.com/kylef)) - [#4097](https://github.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@SheetJSDev**](https://github.com/SheetJSDev)) - [#4089](https://github.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@Munter**](https://github.com/Munter)) - [#4077](https://github.com/mochajs/mocha/issues/4077): Improve integration tests ([**@soobing**](https://github.com/soobing)) ## 6.2.3 / 2020-03-25 ### :lock: Security Fixes - [848d6fb8](https://github.com/mochajs/mocha/commit/848d6fb8feef659564b296db457312d38176910d): Update dependencies mkdirp, yargs-parser and yargs ([**@juergba**](https://github.com/juergba)) ## 6.2.2 / 2019-10-18 ### :bug: Fixes - [#4025](https://github.com/mochajs/mocha/issues/4025): Fix duplicate `EVENT_RUN_END` events upon uncaught exception ([**@juergba**](https://github.com/juergba)) - [#4051](https://github.com/mochajs/mocha/issues/4051): Fix "unhide" function in `html` reporter (browser) ([**@pec9399**](https://github.com/pec9399)) - [#4063](https://github.com/mochajs/mocha/issues/4063): Fix use of [esm](https://npm.im/esm) in Node.js v8.x ([**@boneskull**](https://github.com/boneskull)) - [#4033](https://github.com/mochajs/mocha/issues/4033): Fix output when multiple async exceptions are thrown ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#4046](https://github.com/mochajs/mocha/issues/4046): Site accessibility fixes ([**@Mia-jeong**](https://github.com/Mia-jeong)) - [#4026](https://github.com/mochajs/mocha/issues/4026): Update docs for custom reporters in browser ([**@Lindsay-Needs-Sleep**](https://github.com/Lindsay-Needs-Sleep)) - [#3971](https://github.com/mochajs/mocha/issues/3971): Adopt new OpenJS Foundation Code of Conduct ([**@craigtaub**](https://github.com/craigtaub)) ## 6.2.1 / 2019-09-29 ### :bug: Fixes - [#3955](https://github.com/mochajs/mocha/issues/3955): tty.getWindowSize is not a function inside a "worker\_threads" worker ([**@1999**](https://github.com/1999)) - [#3970](https://github.com/mochajs/mocha/issues/3970): remove extraGlobals() ([**@juergba**](https://github.com/juergba)) - [#3984](https://github.com/mochajs/mocha/issues/3984): Update yargs-unparser to v1.6.0 ([**@juergba**](https://github.com/juergba)) - [#3983](https://github.com/mochajs/mocha/issues/3983): Package 'esm': spawn child-process for correct loading ([**@juergba**](https://github.com/juergba)) - [#3986](https://github.com/mochajs/mocha/issues/3986): Update yargs to v13.3.0 and yargs-parser to v13.1.1 ([**@juergba**](https://github.com/juergba)) ### :book: Documentation - [#3886](https://github.com/mochajs/mocha/issues/3886): fix styles on mochajs.org ([**@outsideris**](https://github.com/outsideris)) - [#3966](https://github.com/mochajs/mocha/issues/3966): Remove jsdoc index.html placeholder from eleventy file structure and fix broken link in jsdoc tutorial ([**@Munter**](https://github.com/Munter)) - [#3765](https://github.com/mochajs/mocha/issues/3765): Add Matomo to website ([**@MarioDiaz98**](https://github.com/MarioDiaz98)) - [#3947](https://github.com/mochajs/mocha/issues/3947): Clarify effect of .skip() ([**@oliversalzburg**](https://github.com/oliversalzburg)) ## 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)) ================================================ FILE: FUNDING.md ================================================ # Fund Usage Guidelines This project follows [Collective Funds Guidelines 0.1](https://github.com/collective-funds/guidelines) with the below customizations. ## Rates - TSC Members: $75.00 USD/hour - Project Contributors: $50.00 USD/hour ## Additional notes The project funds are collected in the [Mocha collective](https://opencollective.com/mochajs) on [Open Collective](https://opencollective.com/) which is hosted by the [Open Source Collective](https://oscollective.org/). In additions to the [Collective Funds Guidelines](https://github.com/collective-funds/guidelines) this project abides by the [Open Source Collective](https://oscollective.org/)'s [Terms of Fiscal Sponsorship](https://docs.oscollective.org/getting-started/terms-of-fiscal-sponsorship). When/if the two are in conflict, the Terms of Fiscal Sponsorship is the one that will be followed. ================================================ FILE: LICENSE ================================================ (The MIT License) Copyright (c) 2011-2024 OpenJS Foundation and contributors, https://openjsf.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: MAINTAINERS.md ================================================ # Mocha Maintainer's Handbook ## 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/main/.github/CODE_OF_CONDUCT.md) when interacting in Mocha's "official" social spaces. This includes: - Any channel under the `mochajs` Discord - Any project under the `mochajs` organization on GitHub - 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 [our Discord](https://discord.gg/KeDn2uXhER), [StackOverflow](https://stackoverflow.com), 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/main/.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**. That can be daily, weekly, or even just a few times a month -- as long as it's regular. We are all people with Real Lives, and for many of us, contributing to OSS is just an occasional 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 `main` 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. #### Expected Activity Levels We generally expect maintainers to average at least: - Multiple contributions of any kind in a week - One meaningful, non-trivial contribution per month These are rough averages, not strict minimums! It's totally fine to skip a week or two here and there, as long as you do a little more before or after. Meaningful, non-trivial contributions can be a well-thought-out comment, sending a non-straightforward pull request, or anything else that adds real value to the project. If you have to step away longer than a couple of weeks, that's totally fine too. Just let the other maintainers know ahead of time. - If you need to step away for up to a month or two, don't sweat it. - If we don't hear from you for a month without prior notice, we'll check in with you to see if you want to remain a maintainer. - After three months of inactivity, or two without prior notice, we'll likely remove you as a maintainer. Again, don't stress about this if you can't always be available. Your boss doesn't work here; contribute as often as you reasonably can. Even if you step down or are removed, if you can come back and be regularly active we'll happily reinstate you. #### About "Owners" Some maintainers will have full admin rights to the [mochajs GitHub org](https://github.com/mochajs) and/or will have access to publish to npm. - Those with publish access must 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. We will wait at least two weeks for consensus votes in most cases, and a month for especially important decisions. 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 [Mocha Discord](https://discord.gg/KeDn2uXhER). This is a _public_ Discord, 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 ## Issue Triage Issues should be filed according to one of our [GitHub Issue forms](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms). If any required information is missing, add the `status: waiting for author` label and politely ask for the missing information. ### Issue Meta For all issues, apply the following labels based on which area(s) the issue pertains to: - `area: async`: Issues around Mocha's asynchronous usage - `area: browser`: Issues unique to a browser environment - `area: parallel`: Issues around Mocha's parallel mode - `area: reporter`: Usually concerning Mocha's output - `area: repository tooling`: Issues around Mocha's CI, own test suite, or other internal tooling - `area: security`: Involving vulnerabilities, actual or potential - `area: windows`: Windows-specific issues, particularly around path discrepancies Additionally: - `good first issue`: If the implementation is likely doable by someone who's never contributed to Mocha (or potentially any other open source project) before - `status: duplicate`: If an equivalent issue was already filed, add this label, close as not planned, and comment with something like `duplicate of #` - `status: in discussion`: Add this whenever the issue is blocked on community input and/or deeper discussions - `status: in triage`: Added on new issues; re-add this whenever the issue is awaiting maintainer attention - `status: waiting for author`: Add this whenever the issue is blocked on something from the author ### 🐛 Bugs Bug reports should include a way to reproduce the issue that someone who is not deeply familiar with Mocha can work with locally. Depending on that reproduction, remove `status: in triage` and add the following label(s) in addition to the auto-added `type: bug`: - If the bug is valid and reproduction works: add `status: accepting prs` - If the bug might be valid but the reproduction isn't workable: - Add `status: waiting for author` - Politely comment explaining why the reproduction isn't workable - If the bug might be valid but it's not clear whether it's worth it: - Add `status: in discussion` - Explain that it _might_ be worth it and that more community input is needed - If the bug is clearly not worth it or valid, explain why, close the issue as not planned, and: - If it isn't a bug at all: add the `invalid` label - If it is roughly a bug but isn't something that can or should be fixed: add the `status: wontfix` label ### 📝 Documentation Documentation reports should clearly indicate a gap or problem that should be addressed in documentation. Triage documentation issues similar to bugs and/or feature requests - documentation is its own form of product area. Remove `status: in triage` and keep the auto-added `area: documentation` label. ### 🚀 Features Feature requests should include a compelling reason why we should spend the maintenance time on the feature. Given that Mocha is prioritizing stability over growth, this can be a high bar. Depending on the reasoning, remove `status: in triage` and add the following label(s) in addition to the auto-added `type: feature`: - If the reasoning is valid and seems worth the maintenance cost: add `status: accepting prs` - If the reasoning is unclear: - Add `status: waiting for author` - Politely comment explaining what's missing - If the feature might be valid but it's not clear whether it's worth it: - Add `status: in discussion` - Explain that it _might_ be worth it and that more community input is needed - If the feature is not valid, explain why, close the issue as not planned, and: - If it isn't a feature request at all: add the `invalid` label - If it is roughly a feature request but isn't something that can or should be implemented: add the `status: wontfix` label ### 🛠 Tooling Issues filed about improvements to Mocha's internal development processes. These can be more informally discussed by maintainers. Remove `status: in triage` and keep the auto-added `area: repository tooling`. ### ❓ Questions Our issue tracker is not the right place to ask questions. If an issue is filed that seems like it's more of a question, remove `status: in triage`, add the `type: question` label, politely direct the user to the [❓ Got a Question?](./.github/CONTRIBUTING.md#❓-got-a-question) section, and close the issue as not planned. 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. If this issue seems to be _repeatedly_ asked, add the `faq` label. This may also apply to questions which receive a lot of 👍 reactions. ### Closing Issues Write "closes #000" (where 000 is the issue number) or "resolves #000" 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 #000" 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. ### 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 OpenJS 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 `main` is the only maintained branch in `mochajs/mocha` or any of the other repos. **`main` 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 We prefer to [squash merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits) PRs. Requiring users to keep clean histories for rebasing would be a large ask that we don't feel justifies the benefits. **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 `main` as the latest version. **This is subject to change, hopefully.** ## Mocha's Release Process Releases are managed by [Release Please](https://github.com/googleapis/release-please) and require manual approval after tests pass. To create a new release after merging changes, merge the _`chore(main): release...`_ pull request that its automation has created. Doing so will: 1. Create a new GitHub release 2. Cause a CI job to run on `main` that will publish the package to npm You'll then need to go to the `chore(main): release ...` commit _Publish to npm_ job run logs and click the _Review pending deployments_ link. ### Major releases For major releases, we follow an even-odd pattern: - Even versions only update dependencies and avoid breaking functional changes - Odd versions can update dependencies and add breaking functional changes This results in even versions being quite small but easy to migrate to, and odd versions can usually focus on the functional changes. For large releases, we recommend betas, then release candidates (RCs), then a full release. Betas are when most features are available, but more will likely be added before full release. RCs are almost ready for release, but would benefit from user testing before a full release. To start a new major version beta, add `Release-As: 12.0.0-beta.1` to the additional details of your PR commit message. This must be part the last line of the commit message, not the PR description. Release Please respects this property and will update accordingly. You can also set Release Please to prelease mode to increment the beta number. > **Important:** Always use a dot (`.`) as the separator between the pre-release label and the number (e.g. `beta.1`, not `beta-1`). > The `semver` library (used by npm) treats dot-separated numeric identifiers numerically, so `beta.10 > beta.9`. > With a dash separator, `beta-10` is a single string identifier and sorts before `beta-9` alphabetically. To transition to an RC, add `Release-As: 12.0.0-rc.1` at the end of the PR commit message. To transition from betas or RCs to a full release, just change Release Please back to `prerelease: false`. ## About The OpenJS Foundation The [OpenJS 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 OpenJS 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 [Mocha Discord](https://discord.gg/KeDn2uXhER)! ================================================ FILE: PROJECT_CHARTER.md ================================================ # Mocha Charter This project charter serves as a statement of scope and objectives for the **Mocha** project. ## §1: Guiding Principles The **Mocha** project is part of the [OpenJS Foundation], which operates transparently, openly, collaboratively, and ethically. Project proposals, timelines, and status must not merely be open, but also easily visible to outsiders. ## §2: Scope **Mocha** is a unopinionated, _general-purpose testing framework_ for the JavaScript community. **Mocha** favors flexibility over rigidity, stability over disruption, and deliberation over agility. **Mocha** aims to do one thing, and do it well. **Mocha** will strive to evolve with the needs of the community, but will make every effort not to abandon its current users in doing so. ### §2.1: In-Scope - APIs ("interfaces") to write and organize tests written in JavaScript or compile-to-JavaScript languages - Command-line executable to run tests in a Node.js-based terminal environment - API to run tests in a browser environment - Output test results and errors (provide "reporters") to: - Terminal - File - Browser - Memory - APIs to extend functionality - File-based and code-based configuration - Internal test coverage for all of the above - Documentation including (but not limited to): - Website ([https://mochajs.org](https://mochajs.org)) contents and design - Test-writing and test-organizing APIs - Reporters - [Extensible APIs](https://mochajs.org/api) - Tutorials and [code samples](https://github.com/mochajs/mocha-examples) - Command-line execution and options - Browser-based execution and options - [Project administration](https://github.com/mochajs/admin) - [Contribution guide](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) - General support for multiple levels of tests, including (but not limited to): - Unit tests - Integration tests - Functional/end-to-end tests - Operational readiness tests - Tool configuration for project tests, build, documentation or website deployment - Bespoke tools, if needed - LTS (long-term support) policies, processes, and release cadence - Third-party service integrations (e.g., bots, CI servers, SCM) - Project-endorsed spaces for collaboration (chat rooms, mailing lists, forums, etc.) - Project-maintained social media, if any ### §2.2: Out-of-Scope - [Test assertions](https://wikipedia.org/wiki/Test_assertion) and [mocks](https://en.wikipedia.org/wiki/Mock_object) or related - Compatibility with other 3rd-party libraries not hosted under GitHub's [mochajs organization](https://github.com/mochajs) unless explicitly stated in [§2: Scope](#2-scope) - Note: _existence of "official" code samples does not imply explicit support_ - Efforts must be made to retain compatibility with popular libraries, frameworks and tools, but not at the expense of Mocha itself - Use within _unmaintained_ versions of Node.js - Use within browsers not meeting a threshold decided upon by maintainers - Use within non-Node.js or non-browser environments, unless otherwise explicitly stated in [§2: Scope](#2-scope) - "Unofficial" collaboration or Q&A spaces (including Stack Overflow and Quora) - Certain classes of contributions: - Bug fixes or enhancements without associated test coverage - Features having limited general-purpose use (as determined by maintainers) - Bug fixes which "break" more users than are affected by the bug itself, _regardless_ of "correctness" - Breaking changes to API without demonstrated need, especially those which would cause correct, currently-passing tests to fail - Changes that significantly negatively impact performance without demonstrated need - Code reviews, issue comments or pull requests which are dogmatic, demanding, or excessively critical as to discourage contributions by others - Those which violate Mocha's [Code of Conduct] ## §3: Relationship with OpenJS Foundation CPC Technical leadership for the projects within the [OpenJS Foundation] is delegated to the projects through their project charters by the [OpenJS Foundation Cross-Project Council](https://openjsf.org/about/governance/) (CPC). In the case of the Mocha project, it is delegated exclusively to the maintainers of Mocha. The OpenJS Foundation's business leadership is the Board of Directors. Changes to the following **cannot** unilaterally be applied by project leadership, and must be ratified by the CPC: - Mocha's Project Charter (this document) - Mocha's [Code of Conduct] - Mocha's licenses: [MIT](https://github.com/mochajs/mocha/blob/main/LICENSE) (for code) and [CC-BY-4.0](https://github.com/mochajs/mocha/blob/main/docs/LICENSE-CC-BY-4.0) (for documentation/website) ### §3.1: Other Formal Project Relationships Section Intentionally Left Blank ## §4: Mocha's Governing Body Mocha is governed by its maintainers. See [MAINTAINERS.md] for more information. ## §5: Roles & Responsibilities The roles and responsibilities of Mocha's maintainers are described in [MAINTAINERS.md]. ### §5.1: Project Operations & Management Project operations and processes are described in [MAINTAINERS.md]. ### §5.2: Decision-making, Voting, and/or Elections Mocha uses a loose consensus-seeking process, described in [MAINTAINERS.md]. ### §5.3: Other Project Roles Section Intentionally Left Blank ## §6: Definitions Section Intentionally Left Blank [openjs foundation]: https://openjsf.org [maintainers.md]: https://github.com/mochajs/mocha/blob/main/MAINTAINERS.md [code of conduct]: https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md ================================================ FILE: README.md ================================================

Mocha test framework logo

☕️ Classic, reliable, trusted test framework for Node.js and the browser ☕️

NPM Version Node Version [![GitHub Actions Build Status](https://github.com/mochajs/mocha/actions/workflows/mocha.yml/badge.svg)](https://github.com/mochajs/mocha/actions/workflows/mocha.yml) Codecov Coverage Status
Chat - Discord OpenCollective Sponsors OpenCollective Backers [![Collective Funds Guidelines v0.1](https://img.shields.io/badge/collective_funds_guidelines-v0.1-D8E8D4?style=flat&labelColor=3A6457)](https://github.com/collective-funds/guidelines)
## Links - **[Documentation](https://mochajs.org)** - **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)** - [Code of Conduct](https://github.com/mochajs/mocha/blob/main/.github/CODE_OF_CONDUCT.md) - [Contributing](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) - [Development](https://github.com/mochajs/mocha/blob/main/.github/DEVELOPMENT.md) - [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!) - [Issue Tracker](https://github.com/mochajs/mocha/issues) ## Backers [Become a backer](https://opencollective.com/mochajs) and show your support to our open source project on [our site](https://mochajs.org/#backers). Mocha's backers on Open Collective ## 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#sponsors) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs). [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/0/avatar)](https://opencollective.com/mochajs/tiers/sponsors/0/website) [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/1/avatar)](https://opencollective.com/mochajs/tiers/sponsors/1/website) [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/2/avatar)](https://opencollective.com/mochajs/tiers/sponsors/2/website) [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/3/avatar)](https://opencollective.com/mochajs/tiers/sponsors/3/website) ## Development You might want to know that: - Mocha is one of the _most-depended-upon_ modules 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%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - The [maintainer's handbook](https://github.com/mochajs/mocha/blob/main/MAINTAINERS.md) explains how things get done Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXhER) if you want to help with: - Triaging issues, answering questions - Review, merging, and closing pull requests - Other project-maintenance-y things ## License Copyright 2011-2024 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/main/LICENSE). ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Security contact information To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. ## Escalation If you do not receive an acknowledgement of your report within 6 business days, or if you cannot find a private security contact for the project, you may escalate to the OpenJS Foundation CNA at `security@lists.openjsf.org`. If the project acknowledges your report but does not provide any further response or engagement within 14 days, escalation is also appropriate. ================================================ FILE: bin/_mocha ================================================ #!/usr/bin/env node "use strict"; /** * This file remains for backwards compatibility only. * Don't put stuff in this file. * @see module:lib/cli */ require("../lib/cli").main(); ================================================ FILE: bin/mocha.js ================================================ #!/usr/bin/env node "use strict"; /** * 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 */ const os = require("node:os"); 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 SIGNAL_OFFSET = 128; let hasInspect = false; 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 %s disabled timeouts", value); mochaArgs.timeout = 0; } }; /** * 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]; } else { mochaArgs[opt] = opts[opt]; } }); // disable 'timeout' for debugFlags Object.keys(nodeArgs).forEach((opt) => disableTimeouts(opt)); mochaArgs["node-option"] && mochaArgs["node-option"].forEach((opt) => disableTimeouts(opt)); // Native debugger handling // see https://nodejs.org/api/debugger.html#debugger_debugger // look for 'inspect' 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"); if (i > -1) { mochaArgs._.splice(i, 1); disableTimeouts("inspect"); hasInspect = true; } } if (mochaArgs["node-option"] || Object.keys(nodeArgs).length || hasInspect) { const { spawn } = require("node:child_process"); const mochaPath = require.resolve("../lib/cli/cli.js"); const nodeArgv = (mochaArgs["node-option"] && mochaArgs["node-option"].map((v) => "--" + v)) || unparseNodeFlags(nodeArgs); if (hasInspect) nodeArgv.unshift("inspect"); delete mochaArgs["node-option"]; debug("final node argv", nodeArgv); const args = [].concat( nodeArgv, mochaPath, unparse(mochaArgs, { alias: aliases }), ); debug( "forking child process via command: %s %s", process.execPath, args.join(" "), ); const proc = spawn(process.execPath, args, { stdio: "inherit", }); proc.on("exit", (code, signal) => { process.on("exit", () => { if (signal) { signal = typeof signal === "string" ? os.constants.signals[signal] : signal; if (mochaArgs["posix-exit-codes"] === true) { process.exitCode = SIGNAL_OFFSET + signal; } process.kill(process.pid, signal); } else { process.exit(Math.min(code, mochaArgs["posix-exit-codes"] ? 1 : 255)); } }); }); // terminate children. process.on("SIGINT", () => { // XXX: a previous comment said this would abort the runner, but I can't see that it does // anything with the default runner. debug("main process caught SIGINT"); proc.kill("SIGINT"); // if running in parallel mode, we will have a proper SIGINT handler, so the below won't // be needed. if (!args.parallel || args.jobs < 2) { // win32 does not support SIGTERM, so use next best thing. if (os.platform() === "win32") { proc.kill("SIGKILL"); } else { // using SIGKILL won't cleanly close the output streams, which can result // in cut-off text or a befouled terminal. debug("sending SIGTERM to child process"); proc.kill("SIGTERM"); } } }); } else { debug("running Mocha in-process"); require("../lib/cli/cli").main([], mochaArgs); } ================================================ FILE: browser-entry.js ================================================ "use strict"; /* eslint no-unused-vars: off */ /** * Shim process.stdout. */ process.stdout = require("browser-stdout")({ label: false }); var parseQuery = require("./lib/browser/parse-query"); var highlightTags = require("./lib/browser/highlight-tags"); var Mocha = require("./lib/mocha"); /** * Create a Mocha instance. * * @return {undefined} */ var mocha = new Mocha({ reporter: "html" }); /** * 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; var uncaughtExceptionHandlers = []; var originalOnerrorHandler = global.onerror; /** * Remove uncaughtException listener. * Revert to original onerror handler if previously defined. */ process.removeListener = function (e, fn) { if (e === "uncaughtException") { if (originalOnerrorHandler) { global.onerror = originalOnerrorHandler; } else { global.onerror = function () {}; } var i = uncaughtExceptionHandlers.indexOf(fn); if (i !== -1) { uncaughtExceptionHandlers.splice(i, 1); } } }; /** * Implements listenerCount for 'uncaughtException'. */ process.listenerCount = function (name) { if (name === "uncaughtException") { return uncaughtExceptionHandlers.length; } return 0; }; /** * Implements uncaughtException listener. */ process.on = function (e, fn) { if (e === "uncaughtException") { global.onerror = function (msg, url, line, col, err) { fn(err || new Error(msg + " (" + url + ":" + line + ":" + col + ")")); return !mocha.options.allowUncaught; }; uncaughtExceptionHandlers.push(fn); } }; process.listeners = function (err) { if (err === "uncaughtException") { return uncaughtExceptionHandlers; } return []; }; // The BDD UI is registered by default, but no UI will be functional in the // browser without an explicit call to the overridden `mocha.ui` (see below). // Ensure that this default UI does not expose its methods to the global scope. mocha.suite.removeAllListeners("pre-require"); var immediateQueue = []; var immediateTimeout; function timeslice() { var immediateStart = new Date().getTime(); while (immediateQueue.length && new Date().getTime() - immediateStart < 100) { immediateQueue.shift()(); } if (immediateQueue.length) { immediateTimeout = setTimeout(timeslice, 0); } else { immediateTimeout = null; } } /** * High-performance override of Runner.immediately. */ Mocha.Runner.immediately = function (callback) { immediateQueue.push(callback); if (!immediateTimeout) { immediateTimeout = setTimeout(timeslice, 0); } }; /** * Function to allow assertion libraries to throw errors directly into mocha. * 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) { uncaughtExceptionHandlers.forEach(function (fn) { fn(err); }); throw err; }; /** * Override ui to ensure that the ui functions are initialized. * Normally this would happen in Mocha.prototype.loadFiles. */ mocha.ui = function (ui) { Mocha.prototype.ui.call(this, ui); this.suite.emit("pre-require", global, null, this); return this; }; /** * Setup mocha with the given setting options. */ mocha.setup = function (opts) { if (typeof opts === "string") { opts = { ui: opts }; } if (opts.delay === true) { this.delay(); } var self = this; Object.keys(opts) .filter(function (opt) { return opt !== "delay"; }) .forEach(function (opt) { if (Object.prototype.hasOwnProperty.call(opts, opt)) { self[opt](opts[opt]); } }); return this; }; /** * Run mocha, returning the Runner. */ mocha.run = function (fn) { var options = mocha.options; mocha.globals("location"); var query = parseQuery(global.location.search || ""); if (query.grep) { mocha.grep(query.grep); } if (query.fgrep) { mocha.fgrep(query.fgrep); } if (query.invert) { mocha.invert(); } 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 ) { highlightTags("code"); } if (fn) { fn(err); } }); }; /** * Expose the process shim. * https://github.com/mochajs/mocha/pull/916 */ Mocha.process = process; /** * Expose mocha. */ global.Mocha = Mocha; global.mocha = mocha; // for bundlers: enable `import {describe, it} from 'mocha'` // `bdd` interface only // prettier-ignore [ 'describe', 'context', 'it', 'specify', 'xdescribe', 'xcontext', 'xit', 'xspecify', 'before', 'beforeEach', 'afterEach', 'after' ].forEach(function(key) { mocha[key] = global[key]; }); module.exports = mocha; ================================================ FILE: docs/.gitignore ================================================ .astro/ dist/ node_modules/ src/content/data/supporters.json ================================================ FILE: docs/.knip.jsonc ================================================ { "$schema": "https://unpkg.com/knip@5/schema-jsonc.json", // Entry points marked with ! are analyzed but not reported as unused "entry": ["src/content/**/*.mdx!"], "project": ["src/**/*.{ts,js,mjs,cjs,astro}"], "astro": { "config": "astro.config.ts", }, "rules": { "exports": "off", }, } ================================================ FILE: docs/.prettierrc.json ================================================ { "bracketSpacing": true } ================================================ FILE: docs/README.md ================================================ # Mocha Docs: Built on Astro Starlight This is the current Mocha documentation website, hosted at [mochajs.org](https://mochajs.org) and built with [Astro Starlight](https://starlight.astro.build). > For details on the legacy site, see [https://github.com/mochajs/docs-legacy](mochajs/docs-legacy). ## Preview the new site To run this site: ```shell cd docs npm i npm run generate npm run dev ``` ================================================ FILE: docs/_data/blocklist.json ================================================ [ "cheap-writing-service", "coin-master-free-spins", "cyberflix-tv", "device-tricks1", "domywriting", "emailmarketingservices-io", "hurtiglaan-nu", "igor-noskov", "mochajs", "my-true-media", "open-apk-file", "thetoy", "trust-my-paper", "writemypaper4me", "writerseperhour", "yiannakis-ttafounas-ttafounas" ] ================================================ FILE: docs/_data/supporters.cjs ================================================ /** * This script gathers metadata for active supporters of Mocha from OpenCollective's * API by aggregating order ("donation") information. * * It's intended to be used with 11ty, but can be run directly. Running directly * enables debug output. * * - gathers logo/avatar images (they are always pngs) * - gathers links * - sorts by tier and total contributions * - validates images * - writes images to a temp dir * @see https://docs.opencollective.com/help/contributing/development/api */ "use strict"; const { writeFile, mkdir, rm } = require("node:fs").promises; const { resolve } = require("node:path"); const debug = require("debug")("mocha:docs:data:supporters"); const blocklist = new Set(require("./blocklist.json")); /** * In addition to the blocklist, any account slug matching this regex will not * be displayed on the website. */ const BLOCKED_STRINGS = /(?:[ck]a[sz]ino|seo|slot|gambl(?:e|ing)|crypto|follow|buy|cheap|instagram|hacks|tiktok|likes|youtube|subscriber|boost|deposit|mushroom|bingo|broker|promotion|bathroom|landscaping|lawn care|groundskeeping|remediation|esports|links|coupon|review|refer|promocode|rabattkod|jämför|betting|reddit|hire|fortune|equity|download|marketing|comment|rank|scrapcar|lawyer|celeb|concrete|firestick|playground|betking)/i; /** * Add a few Categories exposed by Open Collective to help moderation */ const BLOCKED_CATEGORIES = [ "adult", "casino", "credit", "gambling", "seo", "writer", "review", ]; /** * The OC API endpoint */ const API_ENDPOINT = "https://api.opencollective.com/graphql/v2"; const SPONSOR_TIER = "sponsors"; const BACKER_TIER = "backers"; // if this percent of fetches completes, the build will pass const PRODUCTION_SUCCESS_THRESHOLD = 0.9; const SUPPORTER_IMAGE_PATH = resolve(__dirname, "../images/supporters"); const SUPPORTER_QUERY = `query account($limit: Int, $offset: Int, $slug: String) { account(slug: $slug) { orders(limit: $limit, offset: $offset, status: ACTIVE, filter: INCOMING) { limit offset totalCount nodes { fromAccount { id name slug website imgUrlMed: imageUrl(height:64) imgUrlSmall: imageUrl(height:32) type categories } tier { slug } totalDonations { value } createdAt } } } }`; const GRAPHQL_PAGE_SIZE = 1000; const invalidSupporters = []; const nodeToSupporter = (node) => ({ id: node.fromAccount.id, name: node.fromAccount.name, slug: node.fromAccount.slug, website: node.fromAccount.website, imgUrlMed: node.fromAccount.imgUrlMed, imgUrlSmall: node.fromAccount.imgUrlSmall, type: node.fromAccount.type, categories: node.fromAccount.categories, tier: (node.tier && node.tier.slug) || BACKER_TIER, totalDonations: node.totalDonations.value * 100, firstDonation: node.createdAt, }); const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD ? async (supporter) => { invalidSupporters.push(supporter); } : async (supporter) => { try { const { avatar: url } = supporter; const response = await fetch(url, { signal: AbortSignal.timeout(30000), }); if (response.headers.get("content-type")?.startsWith("text/html")) { throw new TypeError( "received html and expected a png; outage likely", ); } const imageBuf = Buffer.from(await response.arrayBuffer()); debug("fetched %s", url); const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + ".png"); await writeFile(filePath, imageBuf); debug("wrote %s", filePath); } catch (err) { console.error( `failed to load ${supporter.avatar}; will discard ${supporter.tier} "${supporter.name} (${supporter.slug}). reason:\n`, err, ); invalidSupporters.push(supporter); } }; /** * Retrieves donation data from OC * * Handles pagination * @param {string} slug - Collective slug to get donation data from * @returns {Promise} Array of raw donation data */ const getAllOrders = async (slug = "mochajs") => { let allOrders = []; const variables = { limit: GRAPHQL_PAGE_SIZE, offset: 0, slug }; // Handling pagination if necessary (2 pages for ~1400 results in May 2019) while (true) { const response = await fetch(API_ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query: SUPPORTER_QUERY, variables: variables, }), }); const result = await response.json(); const orders = result.data.account.orders.nodes; allOrders = [...allOrders, ...orders]; variables.offset += GRAPHQL_PAGE_SIZE; if (orders.length < GRAPHQL_PAGE_SIZE) { debug("retrieved %d orders", allOrders.length); return allOrders; } else { debug( "loading page %d of orders...", Math.floor(variables.offset / GRAPHQL_PAGE_SIZE), ); } } }; const isAllowed = ({ name, slug, website, categories }) => { const allowed = !blocklist.has(slug) && !BLOCKED_STRINGS.test(name) && !BLOCKED_STRINGS.test(slug) && !BLOCKED_STRINGS.test(website) && !categories.some((category) => BLOCKED_CATEGORIES.includes(category)); if (!allowed) { debug("filtering %o", { categories, name, slug, website }); } else { // debug('keeping %o', {categories, name, slug, website}, BLOCKED_STRINGS.test(website)); } return allowed; }; const getSupporters = async () => { const orders = await getAllOrders(); // Deduplicating supporters with multiple orders const uniqueSupporters = new Map(); const supporters = orders // turn raw query result into a better data structure .map(nodeToSupporter) // aggregate total $ donated by unique supporter (using slug) .reduce((supporters, supporter) => { if (uniqueSupporters.has(supporter.slug)) { uniqueSupporters.get(supporter.slug).totalDonations += supporter.totalDonations; return supporters; } uniqueSupporters.set(supporter.slug, supporter); return [...supporters, supporter]; }, []) // discard spammy supporters .filter(isAllowed) // sort by total $ donated, descending .sort((a, b) => b.totalDonations - a.totalDonations) // determine which url to use depending on tier .reduce( (supporters, supporter) => { if (supporter.tier === BACKER_TIER) { if (supporter.name !== "anonymous") { supporters[BACKER_TIER] = [ ...supporters[BACKER_TIER], { ...supporter, avatar: encodeURI(supporter.imgUrlSmall), }, ]; } } else { supporters[SPONSOR_TIER] = [ ...supporters[SPONSOR_TIER], { ...supporter, avatar: encodeURI(supporter.imgUrlMed), }, ]; } return supporters; }, { [SPONSOR_TIER]: [], [BACKER_TIER]: [], }, ); await rm(SUPPORTER_IMAGE_PATH, { recursive: true, force: true }); debug("blasted %s", SUPPORTER_IMAGE_PATH); await mkdir(SUPPORTER_IMAGE_PATH, { recursive: true }); debug("created %s", SUPPORTER_IMAGE_PATH); // Fetch images for sponsors and save their image dimensions await Promise.all([ ...supporters[SPONSOR_TIER].map(fetchImage), ...supporters[BACKER_TIER].map(fetchImage), ]); debug("fetched images"); invalidSupporters.forEach((supporter) => { supporters[supporter.tier].splice( supporters[supporter.tier].indexOf(supporter), 1, ); }); debug("tossed out invalid supporters"); const backerCount = supporters[BACKER_TIER].length; const sponsorCount = supporters[SPONSOR_TIER].length; const totalSupportersCount = backerCount + sponsorCount; const successRate = 1 - invalidSupporters.length / totalSupportersCount; debug( "found %d valid backers and %d valid sponsors (%d total; %d invalid; %d blocked)", backerCount, sponsorCount, totalSupportersCount, invalidSupporters.length, uniqueSupporters.size - totalSupportersCount, ); if (successRate < PRODUCTION_SUCCESS_THRESHOLD) { if (process.env.NETLIFY && process.env.CONTEXT !== "deploy-preview") { throw new Error( `Failed to meet success threshold ${ PRODUCTION_SUCCESS_THRESHOLD * 100 }% (was ${ successRate * 100 }%) for a production deployment; refusing to deploy`, ); } else { console.warn( `WARNING: Success rate of ${ successRate * 100 }% fails to meet production threshold of ${ PRODUCTION_SUCCESS_THRESHOLD * 100 }%; would fail a production deployment!`, ); } } debug("supporter image pull completed"); // TODO: we'll sunset the classic docs and only have docs. // At that point we'll have supporters.js only used for writing files. if (process.argv.includes("--write-supporters-json")) { await mkdir("src/content/data", { recursive: true }); await writeFile( "src/content/data/supporters.json", JSON.stringify(supporters, null, 4), ); } return supporters; }; module.exports = getSupporters; if (require.main === module) { require("debug").enable("mocha:docs:data:supporters"); process.on("unhandledRejection", (err) => { throw err; }); getSupporters(); } ================================================ FILE: docs/_redirects ================================================ /api/* https://legacy.mochajs.org/api/:splat 301 /next/* https://mochajs.org/:splat 301 ================================================ FILE: docs/astro.config.ts ================================================ import { defineConfig } from "astro/config"; import starlight from "@astrojs/starlight"; export default defineConfig({ integrations: [ starlight({ components: { Footer: "./src/components/Footer.astro", Head: "./src/components/Head.astro", PageTitle: "./src/components/PageTitle.astro", }, customCss: ["./src/style/custom.css"], logo: { dark: "./src/components/icon-dark.svg", light: "./src/components/icon-light.svg", }, sidebar: [ { label: "Getting Started", slug: "getting-started" }, { items: [ { label: "Browsers", slug: "running/browsers" }, { label: "CLI", slug: "running/cli" }, { label: "Configuring", slug: "running/configuring" }, { label: "Editor plugins", slug: "running/editor-plugins" }, { label: "Test globs", slug: "running/test-globs" }, ], label: "Running Mocha", }, { items: [ { label: "Dynamic tests", slug: "declaring/dynamic-tests" }, { label: "Exclusive tests", slug: "declaring/exclusive-tests" }, { label: "Inclusive tests", slug: "declaring/inclusive-tests" }, { label: "Pending tests", slug: "declaring/pending-tests" }, { label: "Retrying tests", slug: "declaring/retrying-tests" }, ], label: "Declaring Tests", }, { items: [ { label: "Arrow functions", slug: "features/arrow-functions" }, { label: "Assertions", slug: "features/assertions" }, { label: "Asynchronous code", slug: "features/asynchronous-code" }, { label: "Diffs", slug: "features/diffs" }, { label: "Error codes", slug: "features/error-codes" }, { label: "Global fixtures", slug: "features/global-fixtures" }, { label: "Hooks", slug: "features/hooks" }, { label: "Parallel mode", slug: "features/parallel-mode" }, { label: "Root hook plugins", slug: "features/root-hook-plugins" }, { label: "Timeouts", slug: "features/timeouts" }, ], label: "Features", }, { collapsed: true, items: [ { label: "About", slug: "interfaces/about" }, { label: "BDD (default)", slug: "interfaces/bdd" }, { label: "Exports", slug: "interfaces/exports" }, { label: "QUnit", slug: "interfaces/qunit" }, { label: "Require", slug: "interfaces/require" }, { label: "TDD", slug: "interfaces/tdd" }, { label: "Third-Party", slug: "interfaces/third-party" }, ], label: "Interfaces", }, { collapsed: true, items: [ { label: "About", slug: "reporters/about" }, { label: "Doc", slug: "reporters/doc" }, { label: "Dot", slug: "reporters/dot" }, { label: "HTML", slug: "reporters/html" }, { label: "JSON Stream", slug: "reporters/json-stream" }, { label: "JSON", slug: "reporters/json" }, { label: "Landing", slug: "reporters/landing" }, { label: "List", slug: "reporters/list" }, { label: "Markdown", slug: "reporters/markdown" }, { label: "Min", slug: "reporters/min" }, { label: "Nyan", slug: "reporters/nyan" }, { label: "Progress", slug: "reporters/progress" }, { label: "Spec (default)", slug: "reporters/spec" }, { label: "Tap", slug: "reporters/tap" }, { label: "Third-Party", slug: "reporters/third-party" }, { label: "XUnit", slug: "reporters/xunit" }, ], label: "Reporters", }, { collapsed: true, items: [ { label: "Compilers deprecation", slug: "explainers/compilers-deprecation", }, { label: "Counting assertions", slug: "explainers/count-assertions", }, { label: "Detecting multiple calls to done()", slug: "explainers/detecting-multiple-calls-to-done", }, { label: "Environment variables", slug: "explainers/environment-variables", }, { label: "Find global leaks", slug: "explainers/find-global-leaks", }, { label: "Global variables", slug: "explainers/global-variables", }, { label: "Node.js native ESM support", slug: "explainers/nodejs-native-esm-support", }, { label: "Programmatic usage", slug: "explainers/programmatic-usage", }, { label: "Related tools", slug: "explainers/related-tools", }, { label: "Run cycle overview", slug: "explainers/run-cycle-overview", }, { label: "Security vulnerability reports", slug: "explainers/security-vulnerability-reports", }, { label: "Shared behaviours", slug: "explainers/shared-behaviours", }, { label: "Spies", slug: "explainers/spies", }, { label: "Stub stdout", slug: "explainers/stub-stdout", }, { label: "Tagging with --grep", slug: "explainers/tagging", }, { label: "Test duration", slug: "explainers/test-duration" }, { label: "Test fixture decision tree", slug: "explainers/test-fixture-decision-tree", }, { label: "Third party reporters", slug: "explainers/third-party-reporters", }, { label: "Third party UIs", slug: "explainers/third-party-uis", }, ], label: "Explainers", }, { label: "API", link: "https://mochajs.org/api", }, ], social: [ { icon: "discord", label: "Discord", href: "https://discord.gg/KeDn2uXhER", }, { icon: "github", label: "GitHub", href: "https://github.com/mochajs/mocha", }, ], title: "Mocha", }), ], }); ================================================ FILE: docs/netlify.toml ================================================ [build] command = "npm run docs" publish = "docs/dist/" [build.environment] DEBUG = "mocha:docs*" NODE_VERSION = "24" [context.deploy-preview] command = "npm run docs" publish = "docs/dist/" ================================================ FILE: docs/package.json ================================================ { "name": "docs", "type": "module", "version": "0.0.1", "scripts": { "astro": "astro", "build": "astro check && astro build", "dev": "astro dev", "docs": "cd .. && npm i && cd docs && npm i && npm run generate && npm run build && cp _redirects dist/_redirects", "generate": "node _data/supporters.cjs --write-supporters-json", "prelint:knip": "npm install", "lint:knip": "knip --cache", "preview": "astro preview", "start": "astro dev" }, "dependencies": { "@astrojs/check": "^0.9.6", "@astrojs/starlight": "^0.37.1", "astro": "^5.16.6", "starlight-package-managers": "^0.12.0", "typescript": "^5.9.3" }, "devDependencies": { "debug": "^4.4.3", "knip": "^5.83.1" } } ================================================ FILE: docs/public/example/Array.js ================================================ "use strict"; 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); }); }); }); ================================================ FILE: docs/public/example/tests.html ================================================ Mocha
================================================ FILE: docs/src/components/Badges.astro ================================================ --- import { Image } from "astro:assets"; import Discord from "./discord.svg"; const badges = [ { href: "http://npmjs.com/package/mocha", alt: "npm version", src: "https://img.shields.io/npm/v/mocha", }, { href: "https://discord.gg/KeDn2uXhER", alt: "Chat - Discord", src: Discord, }, { href: "#sponsors", alt: "OpenCollective sponsors", src: "https://opencollective.com/mochajs/tiers/sponsors/badge.svg", }, { href: "#backers", alt: "OpenCollective backers", src: "https://opencollective.com/mochajs/tiers/backers/badge.svg", }, ]; ---
{ badges.map((badge) => ( {typeof badge.src === "string" ? ( {badge.alt} ) : ( {badge.alt} )} )) }
================================================ FILE: docs/src/components/ClientRedirects.astro ================================================ ================================================ FILE: docs/src/components/FixtureWizard.astro ================================================
Mocha Fixture Wizard My tests need setup! Setup MUST run once and only once Setup MUST share state with tests YES Use Root Hooks and Avoid Parallel Mode Use Global Fixtures Should setup affect tests across ALL files? Use Root Hooks Use Plain Hooks YES NO NO YES NO
================================================ FILE: docs/src/components/Footer.astro ================================================ --- import { Image } from "astro:assets"; import openJsfLogo from "./openjsf-logo.svg"; --- ================================================ FILE: docs/src/components/Head.astro ================================================ --- import type { Props } from '@astrojs/starlight/props' import Default from '@astrojs/starlight/components/Head.astro' import thumbnail from "./mocha-thumbnail.svg"; --- ================================================ FILE: docs/src/components/HomepagePageTitle.astro ================================================ --- import { Image } from "astro:assets"; import logo from "./mocha-logo.svg"; ---

classic, reliable, trusted

================================================ FILE: docs/src/components/PageTitle.astro ================================================ --- import Default from "@astrojs/starlight/components/PageTitle.astro"; import type { ComponentProps } from "astro/types"; import HomepagePageTitle from "./HomepagePageTitle.astro"; type Props = ComponentProps; const isHomepage = Astro.props.slug === ""; --- {isHomepage ? : } ================================================ FILE: docs/src/components/Supporters.astro ================================================ --- interface Supporter { imgUrlMed: string; imgUrlSmall: string; name: string; website: string; } interface Props { data: Supporter[]; size: "small" | "medium"; } const { size, data } = Astro.props; ---
{ data.map((supporter) => ( {supporter.name} )) }
================================================ FILE: docs/src/content/config.ts ================================================ import { defineCollection } from "astro:content"; import { docsSchema } from "@astrojs/starlight/schema"; export const collections = { docs: defineCollection({ schema: docsSchema() }), }; ================================================ FILE: docs/src/content/data/sponsors.json ================================================ [ { "href": "https://localizejs.com", "image": "https://images.opencollective.com/localize/bb2cd4d/logo/256.png", "title": "Localize" }, { "href": "https://route4me.com", "image": "https://images.opencollective.com/route4me/71fb6fa/avatar/256.png", "title": "Route4Me Route Planner" } ] ================================================ FILE: docs/src/content/docs/declaring/dynamic-tests.mdx ================================================ --- description: Describing tests cases based on dynamic data. title: Dynamic Tests --- Given Mocha's use of function expressions to define suites and test cases, it's straightforward to generate your tests dynamically. No special syntax is required--plain old JavaScript can be used to achieve functionality similar to "parameterized" tests, which you may have seen in other frameworks. Take the following example: ```js const assert = require("assert"); function add(args) { return args.reduce((prev, curr) => prev + curr, 0); } describe("add()", function () { const tests = [ { args: [1, 2], expected: 3 }, { args: [1, 2, 3], expected: 6 }, { args: [1, 2, 3, 4], expected: 10 }, ]; tests.forEach(({ args, expected }) => { it(`correctly adds ${args.length} args`, function () { const res = add(args); assert.strictEqual(res, expected); }); }); }); ``` The above code will produce a suite with three specs: ```bash $ mocha add() ✓ correctly adds 2 args ✓ correctly adds 3 args ✓ correctly adds 4 args ``` Tests added inside a `.forEach` handler often don't play well with editor plugins, especially with "right-click run" features. Another way to parameterize tests is to generate them with a closure. This following example is equivalent to the one above: ```js describe("add()", function () { const testAdd = ({ args, expected }) => function () { const res = add(args); assert.strictEqual(res, expected); }; it("correctly adds 2 args", testAdd({ args: [1, 2], expected: 3 })); it("correctly adds 3 args", testAdd({ args: [1, 2, 3], expected: 6 })); it("correctly adds 4 args", testAdd({ args: [1, 2, 3, 4], expected: 10 })); }); ``` With `top-level await` you can collect your test data in a dynamic and asynchronous way while the test file is being loaded. See also [`--delay`](/features/hooks#delayed-root-suite) for CommonJS modules without `top-level await`. ```js // testfile.mjs import assert from "assert"; // top-level await: Node >= v14.8.0 with ESM test file const tests = await new Promise((resolve) => { setTimeout(resolve, 5000, [ { args: [1, 2], expected: 3 }, { args: [1, 2, 3], expected: 6 }, { args: [1, 2, 3, 4], expected: 10 }, ]); }); // in suites, async callbacks are **not** supported describe("add()", function () { tests.forEach(({ args, expected }) => { it(`correctly adds ${args.length} args`, function () { const res = args.reduce((sum, curr) => sum + curr, 0); assert.strictEqual(res, expected); }); }); }); ``` ================================================ FILE: docs/src/content/docs/declaring/exclusive-tests.mdx ================================================ --- description: Describing test cases that should be run to the exclusion of other tests. title: Exclusive Tests --- :::caution Exclusive tests are incompatible with [parallel mode](/features/parallel-mode). ::: 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. ::: :::tip 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). ::: ================================================ FILE: docs/src/content/docs/declaring/inclusive-tests.mdx ================================================ --- description: Describing test cases that should not be run yet. title: Inclusive Tests --- This feature is the inverse of `.only()`. By appending `.skip()`, you may tell Mocha to ignore test case(s). Anything skipped will be marked as [pending](/declaring/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. :::tip[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](/declaring/pending-tests). It's also important to note that calling `this.skip()` will effectively _abort_ the test. :::tip[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_. :::tip[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 }); }); }); ``` :::note[Updated in v7.0.0] Skipping a test within an "after all" hook is disallowed and will throw an exception. 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. ================================================ FILE: docs/src/content/docs/declaring/pending-tests.mdx ================================================ --- description: Describing test cases with names that don't yet have a callback. title: Pending Tests --- "Pending" — as in "someone should write these test cases eventually" — test-cases are 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. Read the [inclusive tests section](/declaring/inclusive-tests) for an example of conditionally marking a test as pending via `this.skip()`. ================================================ FILE: docs/src/content/docs/declaring/retrying-tests.mdx ================================================ --- description: Describing test cases that should retry on failure. title: 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 a failed test and its corresponding `beforeEach/afterEach` hooks, but not `before/after` hooks. `this.retries()` has no effect on failing hooks. :::note The example below was written using Selenium webdriver (which [overwrites global Mocha hooks](https://github.com/SeleniumHQ/selenium/blob/c10e8a955883f004452cdde18096d70738397788/javascript/node/selenium-webdriver/testing/index.js) 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 by the 3rd try", function () { // Specify this test to only retry up to 2 times this.retries(2); expect($(".foo").isDisplayed()).to.eventually.be.true; }); }); ``` ================================================ FILE: docs/src/content/docs/explainers/compilers-deprecation.mdx ================================================ --- description: Compilers deprecation notice. title: Compilers deprecation --- If you're here, you probably hit the deprecation notice. Sorry about that! ## Will it break? This is a _soft_ deprecation, which means you get nagged about it, but it won't break (yet). ## Make it go away To suppress this warning, execute `mocha` with the `--no-deprecation` flag (though you won't get notice of any _other_ deprecations you may encounter either). ## ... but why? `--compilers` is redundant; we've yet to encounter a real-world situation in which the solution couldn't be expressed using `--require`. ## What should I use instead then? Let's say you want to compile using CoffeeScript. Ensure that you have the coffeescript package installed as a dev dependency: `npm install coffeescript --save-dev` Then update your package.json with the relevant require statement: `--require coffeescript/register`. Here's a list of popular compilers/transpilers: - CoffeeScript: `--compilers coffee:coffee-script/register` becomes `--require coffeescript/register` - Babel 6: `--compilers js:babel-core/register` becomes `--require babel-core/register` - Babel 7: `--require babel-core/register` used if you are using Babel v6 becomes `--require @babel/register` with Babel v7. - TypeScript: `--compilers ts:ts-node/register` becomes `--require ts-node/register` - LiveScript: `--compilers ls:livescript` becomes `--require livescript` - (feel free to add more examples!) You'll have to handle file extensions as well. Mocha, by default, only loads `.js` files when given a directory (and the default directory is `test`). Therefore, to use a _different_ file extension (such as `.coffee` or `.ts`), you will need to supply a _glob_ instead of simply a directory. If this was how you ran Mocha pre-v4: ```bash $ mocha --compilers coffee:coffee-script/register --recursive ./test ``` Then this is how you'd accomplish the same thing (`**` roughly means "recursive") in v4: ```bash $ mocha --require coffeescript/register "test/**/*.js" ``` When you wrap a glob in quotes, file discovery is handed to the [glob](https://npm.im/glob) package. It's _recommended_ to wrap in double-quotes, because the result should be the same regardless of your shell or environment (Windows/Linux/macOS, etc.). [glob](https://npm.im/glob) is powerful. For instance, if your `test` dir has tests written in _both_ JS _and_ CoffeeScript, you could do this: ```bash $ mocha --require coffeescript/register "test/**/*.{js,coffee}" ``` ## How do I use this with `--watch`? When using `--watch`, you will also need to specify the extension(s) to watch via `--watch-extensions`, e.g.: ```js $ mocha --require coffeescript/register --watch --watch-extensions js,coffee "test/**/*.{js,coffee}" ``` ================================================ FILE: docs/src/content/docs/explainers/count-assertions.mdx ================================================ --- description: How to count assertions. title: Counting assertions --- While Mocha itself does not provide an assertion layer and cannot provide assertion counting, it's relatively easy to integrate this behavior using hooks. The following is a simplified version of an assertion counter: ```js var expected = 0; var actual = 0; function assert(expr, msg) { if (!expr) throw new Error(msg || "assertion failed"); actual++; } function expect(n) { expected = n; } function reset() { expected = 0; actual = 0; } function check() { if (!expected || expected == actual) return; var err = new Error("expected " + expected + " assertions, got " + actual); this.currentTest.emit("error", err); } beforeEach(reset); afterEach(check); describe("something", function () { it("should work", function (done) { expect(2); setTimeout(function () { assert("wahoo"); }, 50); setTimeout(function () { assert("hey"); }, 50); setTimeout(function () { done(); }, 100); }); }); ``` ================================================ FILE: docs/src/content/docs/explainers/detecting-multiple-calls-to-done.mdx ================================================ --- description: Why Mocha determines if the done() callback in a test was called multiple times. title: Detecting 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: ```bash $ ./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 ``` ================================================ FILE: docs/src/content/docs/explainers/environment-variables.mdx ================================================ --- description: Learn how to use environment variables in Mocha tests title: "Environment variables" --- Sometimes you might want your test to make use of variables set on an environment level. Common reasons for this include: - Flagging a run as CI - Setting the domain of an application - Pointing to a test database - Setting a key which you want to remain secure The best way to do this is to use NodeJS's native environment variables. ## Example In your `package.json` or directly in a terminal set your variable name and value. ```bash env CI=STAGE mocha ``` Then in your test or code reference it via `process.env.CI`. e.g. ```javascript if (process.env.CI === "STAGE") // do something ``` The value is available from anywhere in a spec file allowing you to set values from it before the tests run. e.g. ```javascript import { equal } from "assert"; import { loadPage } from "your-code"; const URL = `${process.env.APP_HOST}/${process.env.APP_URI}`; describe('Test the page loads', () { it('goes to URL', () => { const page = loadPage(URL); equal(page.url, URL); }); }); ``` ================================================ FILE: docs/src/content/docs/explainers/find-global-leaks.mdx ================================================ --- description: How to find a global leak. title: Find global leaks --- Detecting which module is causing a global leak can be tedious. Add these lines at the very beginning of your tests, or in a file which is included via `--require`: ```javascript Object.defineProperty(global, "name_of_leaking_property", { set: function (value) { throw new Error("Found the leak!"); }, }); ``` This will print a stacktrace that shows which module caused the leak. And if it's not yours--go open a pull request! :) ================================================ FILE: docs/src/content/docs/explainers/global-variables.mdx ================================================ --- description: How to work with global variables in Mocha tests title: "Global variables" --- Related issue [#1582](https://github.com/mochajs/mocha/issues/1582) If your test manipulates global variables, a reasonable expectation is that you will clean up after yourself. This includes commonly called methods such as `process.stdout.write()` or `console.log()`. ```js var expect = require("chai").expect; describe("my nice test", function () { var write, log, output = ""; // restore process.stdout.write() and console.log() to their previous glory var cleanup = function () { process.stdout.write = write; console.log = log; output = ""; }; beforeEach(function () { // store these functions to restore later because we are messing with them write = process.stdout.write; log = console.log; // our stub will concatenate any output to a string process.stdout.write = console.log = function (s) { output += s; }; }); // restore after each test afterEach(cleanup); it("should suppress all output if a non-AssertionError was thrown", function () { process.stdout.write("foo"); console.log("bar"); // uncomment below line to suppress output, which is bad // expect(output).to.equal(foobar); expect(output).to.equal("foobar"); }); it("should not suppress any output", function () { try { process.stdout.write("foo"); console.log("bar"); // uncomment below line to just throw an AssertionError // expect(output).to.equal('barfoo'); expect(output).to.equal(foobar); // ReferenceError } catch (e) { cleanup(); throw e; } }); }); ``` ================================================ FILE: docs/src/content/docs/explainers/nodejs-native-esm-support.mdx ================================================ --- description: A mid-level outline of Mocha's "flow of execution". title: Node.js Native ESM Support --- :::note[New in v7.1.0] ::: Mocha supports writing your tests as ES modules, and not just using CommonJS. For example: ```js // test.mjs import { add } from "./add.mjs"; import assert from "assert"; it("should add to numbers from an es module", () => { assert.equal(add(3, 5), 8); }); ``` To enable this you don't need to do anything special. Write your test file as an ES module. In Node.js this means either ending the file with a `.mjs` extension, or, if you want to use the regular `.js` extension, by adding `"type": "module"` to your `package.json`. More information can be found in the [Node.js documentation](https://nodejs.org/api/esm.html). ### Current Limitations - [Watch mode](/running/cli#--watch--w) does not support ES Module test files - [Custom reporters](/reporters/third-party) and [custom interfaces](/interfaces/third-party) can only be CommonJS files - [Configuration file](/running/configuring) can only be a CommonJS file (`.mocharc.js` or `.mocharc.cjs`) - Mocha in Node.js version 24.4.0 or older [silently ignored top level errors in ESM files](https://github.com/mochajs/mocha/issues/5396). If you cannot upgrade to a newer Node.js version, you can add `--no-experimental-require-module` to the `NODE_OPTIONS` environment variable. - When using module-level mocks via libs like `proxyquire`, `rewiremock` or `rewire`, hold off on using ES modules for your test files. You can switch to using `testdouble`, which does support ESM. ================================================ FILE: docs/src/content/docs/explainers/programmatic-usage.mdx ================================================ --- description: Using Mocha programmatically title: Programmatic usage --- There are a lot of reasons why you might want to automate running the tests using Mocha. Using the command-line can run into some problems if you want to load specific files, for example. Here is an example of using Mocha programmatically: ```javascript var Mocha = require("mocha"), fs = require("fs"), path = require("path"); // Instantiate a Mocha instance. var mocha = new Mocha(); var testDir = "some/dir/test"; // Add each .js file to the mocha instance fs.readdirSync(testDir) .filter(function (file) { // Only keep the .js files return file.substr(-3) === ".js"; }) .forEach(function (file) { mocha.addFile(path.join(testDir, file)); }); // Run the tests. mocha.run(function (failures) { process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures }); ``` `mocha.run()` returns a `Runner` instance which emits many [events](https://github.com/mochajs/mocha/blob/9a7053349589344236b20301de965030eaabfea9/lib/runner.js#L52) of interest. Note that `run` (via `loadFiles`, which it calls) relies on Node's `require` to execute the test interface functions. Thus, files loaded by Mocha will be stored in Node's `require` cache and therefore tests in these files will not be re-run if `mocha.run()` is called again. If you want to run tests multiple times, you may need to clear Node's `require` cache before subsequent calls in whichever manner best suits your needs. The upcoming Mocha-6.0 release will provide `Mocha#unloadFiles`, which will remove all files loaded by `Mocha#loadFiles`. Unfortunately, event listeners in multiple places are not yet configured for restartability; for now, we recommend recreating the `mocha` instance before rerunning to _ensure_ everything gets reset properly. Find a fully [working example here](https://github.com/mochajs/mocha-examples/tree/main/packages/programmatic-usage). ## Set options There are two ways to set the options to run the tests. Firstly, you can set these options in the constructor object: ```javascript var mocha = new Mocha({ ui: "tdd", reporter: "list", }); ``` Please check our [API documentation](https://mochajs.org/api/mocha) for a complete list of these options. Secondly, on the `mocha` object, there are some chainable methods allowing you to change some more options. Here is an example: ```javascript // Change the reporter to "list" before running the tests mocha.reporter("list").run(); // Change the UI to "tdd" before running the tests mocha.ui("tdd").run(); // Or do both changes before running the tests mocha.reporter("list").ui("tdd").run(); ``` Please check our [API documentation](https://mochajs.org/api/mocha) for more information. ================================================ FILE: docs/src/content/docs/explainers/related-tools.mdx ================================================ --- description: External tools and libraries that work well with Mocha title: Related tools --- # Related Tools ## Assertion Libraries - [chai](http://chaijs.com/) (recommended): expect(), assert(), and should style assertions - [earl](https://earl.fun/): ergonomic, modern and type-safe assertion library for TypeScript - [unexpected](https://unexpectedjs.github.io/): extensible BDD assertion toolkit ## Mocks, Stubs & Spies - [sinon.js](https://sinonjs.org/): Test spies, stubs and mocks for JavaScript. - [nock](https://github.com/nock/nock): HTTP mocking and expectations library. ================================================ FILE: docs/src/content/docs/explainers/run-cycle-overview.mdx ================================================ --- description: A mid-level outline of Mocha's "flow of execution". title: Run Cycle Overview --- The following is a mid-level outline of Mocha’s "flow of execution" when run in Node.js; the "less important" details have been omitted. In a browser, test files are loaded by ` ``` Mocha supports the latest major versions of evergreen browsers available when Mocha's oldest supported Node.js major version was released. As of Mocha v12.0.0, that includes the following browser versions that were stable as of [Node.js 20.0.0](https://nodejs.org/en/blog/release/v20.0.0)'s release on April 18, 2023: - [Chrome 112](https://developer.chrome.com/blog/new-in-chrome-112) - [Edge 112](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel#version-1120172248-april-14-2023) - [Firefox 112](https://www.mozilla.org/en-US/firefox/112.0/releasenotes) - [Safari 16.4](https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes) ## Grep The browser may use the `--grep` as functionality. Append a query-string to your URL: `?grep=api`. ## Browser Configuration Mocha options can be set via `mocha.setup()`. Examples: ```js // Use "tdd" interface. This is a shortcut to setting the interface; // any other options must be passed via an object. mocha.setup('tdd'); // This is equivalent to the above. mocha.setup({ ui: 'tdd' }); // Examples of options: mocha.setup({ allowUncaught: true, asyncOnly: true, bail: true, checkLeaks: true, dryRun: true, failZero: true, forbidOnly: true, forbidPending: true, global: ['MyLib'], retries: 3, rootHooks: { beforeEach(done) { ... done();} }, slow: '100', timeout: '2000', ui: 'bdd' }); ``` ## Browser-Specific Options Browser Mocha supports many, but not all [CLI options](/running/configuring). To use a CLI option that contains a "-", please convert the option to camelCase, (eg. `check-leaks` to `checkLeaks`). ### Options That Differ Slightly From [CLI Options](/running/configuring) > `reporter` _`string|constructor`_ You can pass a reporter's name or a custom reporter's constructor. You can find **recommended** reporters for the browser [here](#reporting). It is possible to use [built-in reporters](/reporters/spec) as well. Their employment in browsers is neither recommended nor supported, open the console to see the test results. ### Options That _Only_ Function In Browser Context > `noHighlighting` _`boolean`_ If set to `true`, do not attempt to use syntax highlighting on output test code. ## Reporting The HTML reporter is the default reporter when running Mocha in the browser. It looks like this: ![HTML test reporter](./reporter-html.png) [Mochawesome](https://npm.im/mochawesome) is a great alternative to the default HTML reporter. ================================================ FILE: docs/src/content/docs/running/cli.mdx ================================================ --- title: Command-Line Usage description: Running Mocha in your terminal. --- Running `npx mocha --help` will show the full list of available commands: {/* This output is defined in lib/cli/run.js */} ```plaintext 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] -A, --async-only Require all tests to use a callback (async) or return a Promise [boolean] -b, --bail Abort ("bail") after first test failure [boolean] --check-leaks Check for global variable leaks [boolean] --delay Delay initial execution of root suite [boolean] --dry-run Report tests without executing them[boolean] --exit Force Mocha to quit after tests complete [boolean] --pass-on-failing-test-suite Not fail test run if tests were failed [boolean] [default: false] --fail-zero Fail test run if no test(s) encountered [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] -j, --jobs Number of concurrent jobs for --parallel; use 1 to run in serial [number] [default: (number of CPU cores - 1)] -p, --parallel Run tests in parallel [boolean] --retries Retry failed tests this many times [number] -s, --slow Specify "slow" test threshold (in milliseconds) [string] [default: 75] -t, --timeout, --timeouts Specify test timeout threshold (in milliseconds) [string] [default: 2000] -u, --ui Specify user interface [string] [default: "bdd"] Reporting & Output -c, --color, --colors Force-enable color output [boolean] --diff Show diff on failure [boolean] [default: true] --full-trace Display full stack traces [boolean] --inline-diffs Display actual/expected differences inline within each string [boolean] -R, --reporter Specify reporter to use [string] [default: "spec"] -O, --reporter-option, Reporter-specific options --reporter-options () [array] Configuration --config Path to config file [string] [default: (nearest rc file)] -n, --node-option Node or V8 option (no leading "--") [array] --package Path to package.json for config [string] File Handling --extension File extension(s) to load [array] [default: ["js","cjs","mjs"]] --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] -r, --require Require module [array] [default: (none)] -S, --sort Sort test files [boolean] -w, --watch Watch files in the current working directory for changes [boolean] --watch-files List of paths or globs to watch [array] --watch-ignore List of paths or globs to exclude from watching [array] [default: ["node_modules",".git"]] Test Filters -f, --fgrep Only run tests containing this string [string] -g, --grep Only run tests matching this string or regexp [string] -i, --invert Inverts --grep and --fgrep matches [boolean] Positional Arguments spec One or more files, directories, or globs to test [array] [default: ["test"]] Other Options -h, --help Show usage information & exit [boolean] -V, --version 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://discord.gg/KeDn2uXhER GitHub: https://github.com/mochajs/mocha.git Docs: https://mochajs.org/ ``` ## Rules & Behavior ### `--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` :::note `--compilers` was removed in v6.0.0. See [further explanation and workarounds](https://github.com/mochajs/mocha/wiki/compilers-deprecation). ::: ### `--delay` Delay initial execution of root suite. See [Delayed Root Suite](/features/hooks#delayed-root-suite). ### `--dry-run` :::note[New in v9.0.0] ::: Report tests without executing any of them, neither tests nor hooks. ### `--exit` :::note[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 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](https://nodejs.org/en/docs/inspector) - Use the new [`async_hooks`](https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md) API ([example](https://gist.github.com/boneskull/7fe75b63d613fa940db7ec990a5f5843)) - Try something like [wtfnode](https://npm.im/wtfnode) - Use [`.only`](/declaring/exclusive-tests) until you find the test that causes Mocha to hang ### `--pass-on-failing-test-suite` :::note[New in v10.7.0] ::: If set to `true`, Mocha returns exit code `0` even if there are failed tests during the run. ### `--fail-zero` :::note[New in v9.1.0] ::: Fail test run with `exit-code: 1` if no tests are encountered. ### `--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 ` :::note[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 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 an allowlist of known global variables that you _expect_ to leak into global scope. ### `--jobs , -j ` :::note[New in v8.0.0] ::: Use `--jobs ` to specify the _maximum_ number of processes in the worker pool. The default value is the _number of CPU cores_ less 1. :::tip Use `--jobs 0` or `--jobs 1` to temporarily disable `--parallel`. ::: Has no effect unless used with [`--parallel`](#--parallel--p). ### `--parallel, -p` :::note[New in v8.0.0] ::: Use the `--parallel` flag to run tests in a worker pool. Each test file will be put into a queue and executed as workers become available. :::caution `--parallel` has certain implications for Mocha's behavior which you must be aware of. Read more about [running tests in parallel](/features/parallel-mode). ::: ### `--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 ` :::note[Updated in v6.0.0] `--timeout 0` is implied when invoking Mocha using inspect flags. `--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 `--timeout 0`. :::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`. ## Reporting & Output ### `--color, -c, --colors` :::note[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](https://npm.im/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. :::note[New in v9.2.1] ::: By default strings are truncated to 8192 characters before generating a diff. This is to prevent performance problems with large strings. It can however make the output harder to interpret when comparing large strings. Therefore it is possible to configure this value using `--reporter-option maxDiffSize=[number]`. A value of 0 indicates no limit, default is 8192 characters. ### `--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. ### `--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](https://npm.im/mocha-lcov-reporter) may be used with `--reporter mocha-lcov-reporter` after it has been installed. ### `--reporter-option