diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 93aef1d0cf..d4d5a7ab06 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -100,4 +100,4 @@ This is a foundation-wide team established to manage escalation when a reporter 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/blob/master/FOUNDATION_CODE_OF_CONDUCT_REQUIREMENTS.md). +[Code of Conduct governance document](https://github.com/openjs-foundation/cross-project-council/tree/main/proposals/approved/CODE_OF_CONDUCT). diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8a9fa714b9..f311ca4768 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,7 +4,7 @@ ## โ“ Got a Question? -If you have a question about using Mocha, please use the [mailing list](https://groups.google.com/group/mochajs), [StackOverflow](https://stackoverflow.com), or ask the friendly people in [our Discord](https://discord.gg/KeDn2uXhER). +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 @@ -88,7 +88,7 @@ Then: - **Do not modify** the root `mocha.js` file directly; it is automatically generated. - Keep your PR focused. Don't fix two things at once; don't upgrade dependencies unless necessary. -1. Before committing, run `npm start test`. +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. @@ -99,11 +99,11 @@ Then: - Add detail in subsequent lines. - A pre-commit hook will run which automatically formats your staged changes (and fixes any problems it can) with ESLint and Prettier. If ESLint fails to fix an issue, your commit will fail and you will need to manually correct the problem. -1. (Optional) Ensure you are up-to-date with Mocha's `master` branch: +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 `master` branch using `git checkout master`. - - Pull changes from `upstream` using `git pull upstream master`. - - If any changes were pulled in, update your branch from `master` by switching back to your branch (`git checkout `) then merging using `git merge master`. + - 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. @@ -126,7 +126,7 @@ Now that the pull request exists, some tasks will be run on it: 1. Be patient while your PR is reviewed. This can take a while. We may request changes, but don't be afraid to question them. -1. Your PR might become conflicted with the code in `master`. +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. diff --git a/.github/DEVELOPMENT.md b/.github/DEVELOPMENT.md index 5e4bf73496..6969670779 100644 --- a/.github/DEVELOPMENT.md +++ b/.github/DEVELOPMENT.md @@ -16,5 +16,3 @@ If you are having trouble, don't be afraid to [ask for help](./CONTRIBUTING.md# - 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`. - -> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start ` (powered by [nps](https://npm.im/nps)). diff --git a/.github/ISSUE_TEMPLATE/01-bug.yml b/.github/ISSUE_TEMPLATE/01-bug.yml index fc43efff3f..b46ae9d9b3 100644 --- a/.github/ISSUE_TEMPLATE/01-bug.yml +++ b/.github/ISSUE_TEMPLATE/01-bug.yml @@ -3,7 +3,7 @@ body: 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: I have read and agree to Mocha's [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) + - 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 diff --git a/.github/ISSUE_TEMPLATE/02-documentation.yml b/.github/ISSUE_TEMPLATE/02-documentation.yml index 09517048ac..0a98e59f35 100644 --- a/.github/ISSUE_TEMPLATE/02-documentation.yml +++ b/.github/ISSUE_TEMPLATE/02-documentation.yml @@ -3,7 +3,7 @@ body: 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/master/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) + - 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 diff --git a/.github/ISSUE_TEMPLATE/03-feature-request.yml b/.github/ISSUE_TEMPLATE/03-feature-request.yml index 00778f454a..c37843969e 100644 --- a/.github/ISSUE_TEMPLATE/03-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/03-feature-request.yml @@ -3,7 +3,7 @@ body: 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/master/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) + - 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 diff --git a/.github/ISSUE_TEMPLATE/04-repository-tooling.yml b/.github/ISSUE_TEMPLATE/04-repository-tooling.yml index 3d3908fa31..7e6c6a57f1 100644 --- a/.github/ISSUE_TEMPLATE/04-repository-tooling.yml +++ b/.github/ISSUE_TEMPLATE/04-repository-tooling.yml @@ -5,9 +5,9 @@ body: options: - label: I have tried restarting my IDE and the issue persists. required: true - - label: I have pulled the latest `master` branch of the repository. + - 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/master/.github/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) + - 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 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index dbdd514b0c..14346bf54f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,4 @@ -blank_issues_enabled: false +blank_issues_enabled: true contact_links: - name: Documentation Website about: Please read our documentation website before filing new issues. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 20df860769..9f8ff8ca6a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ Otherwise we may not be able to review your PR. --> - [ ] 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/master/.github/CONTRIBUTING.md) were taken +- [ ] Steps in [CONTRIBUTING.md](https://github.com/mochajs/mocha/blob/main/.github/CONTRIBUTING.md) were taken ## Overview diff --git a/.github/release-please/config.json b/.github/release-please/config.json new file mode 100644 index 0000000000..336265d436 --- /dev/null +++ b/.github/release-please/config.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/v16.12.0/schemas/config.json", + "release-type": "node", + "include-component-in-tag": false, + "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": { + ".": {} + } +} diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json new file mode 100644 index 0000000000..711e182521 --- /dev/null +++ b/.github/release-please/manifest.json @@ -0,0 +1 @@ +{".":"10.8.2"} diff --git a/.github/workflows/browser-test.yml b/.github/workflows/browser-test.yml index 890769437f..9e7db64ee7 100644 --- a/.github/workflows/browser-test.yml +++ b/.github/workflows/browser-test.yml @@ -1,39 +1,30 @@ name: Browser Tests for forked PRs -'on': - pull_request_target: + +on: + pull_request: types: - labeled +permissions: + contents: read + pull-requests: write + jobs: test-browser: - # TODO: configure to retain build artifacts in `.karma/` dir name: 'Browser Tests' - timeout-minutes: 20 - runs-on: ubuntu-latest if: contains(github.event.pull_request.labels.*.name, 'run-browser-test') + uses: ./.github/workflows/npm-script.yml + secrets: inherit + with: + npm-script: test.browser + + remove-label: + needs: test-browser + if: always() + runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - persist-credentials: false - - name: 'Cache node_modules' - uses: actions/cache@v4 - with: - path: '~/.npm' - key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}" - - name: Install Dependencies - run: npm ci - - name: Run Browser Tests - run: npm start test.browser - env: - SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}' - SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}' - name: remove 'run-browser-test' label - uses: buildsville/add-remove-label@v2.0.1 - if: ${{ always() }} + uses: buildsville/add-remove-label@ac59c9f0aeb66eb12d6366eb1d69ec1906e9ef9a with: token: ${{secrets.GITHUB_TOKEN}} label: run-browser-test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 31e3b3d9f9..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,16 +0,0 @@ -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - run: npm install --ignore-scripts - - run: npm run lint - -name: CI - -on: - pull_request: ~ - push: - branches: - - main diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 70d9714e5f..cf346a3898 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -2,7 +2,7 @@ jobs: compliance: runs-on: ubuntu-latest steps: - - uses: mtfoley/pr-compliance-action@main + - uses: mtfoley/pr-compliance-action@11b664f0fcf2c4ce954f05ccfcaab6e52b529f86 with: body-auto-close: false ignore-team-members: false @@ -12,7 +12,7 @@ name: Compliance on: pull_request: branches: - - master + - main types: - edited - opened diff --git a/.github/workflows/delete-runs.yml b/.github/workflows/delete-runs.yml deleted file mode 100644 index 326f8424b7..0000000000 --- a/.github/workflows/delete-runs.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Delete workflow runs -on: - workflow_dispatch: - inputs: - days: - description: 'Number of days' - type: number - required: true - default: 180 - -jobs: - del_runs: - runs-on: ubuntu-latest - steps: - - name: Delete workflow runs - uses: Mattraks/delete-workflow-runs@main - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - retain_days: ${{ github.event.inputs.days }} - keep_minimum_runs: 10 diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.yml index 33e357fd9a..04dfa5c706 100644 --- a/.github/workflows/mocha.yml +++ b/.github/workflows/mocha.yml @@ -1,205 +1,98 @@ name: Tests + on: push: branches: - - '**' - - '!mochajs.org' + - main paths-ignore: ['*.md', 'docs/**'] - tags-ignore: - - '**' pull_request: - types: [opened, synchronize, reopened] + branches: + - main paths-ignore: ['*.md', 'docs/**'] +permissions: + contents: read + jobs: - prevent-double-run: - # skip 'push' event when an open PR exists - name: Prevent double run - runs-on: ubuntu-latest - outputs: - pr-id: ${{ steps.findPr.outputs.number }} - steps: - - name: Check event pull_request - if: github.event_name == 'pull_request' - run: 'echo pull_request: run workflow' - - uses: actions/checkout@v4 - if: github.event_name == 'push' - with: - persist-credentials: false - - name: Check event push - id: findPr - if: github.event_name == 'push' - uses: jwalton/gh-find-current-pr@v1 - with: - state: open + lint: + uses: ./.github/workflows/npm-script.yml + with: + npm-script: lint smoke: - name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]' - needs: prevent-double-run - if: needs.prevent-double-run.outputs.pr-id == '' - runs-on: '${{ matrix.os }}' - strategy: - matrix: - os: - - ubuntu-latest - - windows-2019 - node: - - 14 - - 16 - - 18 - - 20 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: actions/setup-node@v4 - with: - node-version: '${{ matrix.node }}' - - run: npm install --production - - run: npm run test:smoke + uses: ./.github/workflows/npm-script.yml + with: + node-versions: '14,22,lts/*' + npm-script: test-smoke - lint: - name: Linting code and markdown - runs-on: ubuntu-latest + test-node-lts: + # TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module + uses: ./.github/workflows/npm-script.yml needs: smoke - steps: - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: 'Cache node_modules' - uses: actions/cache@v4 - with: - path: '~/.npm' - key: "ubuntu-latest-node-lts-${{ hashFiles('**/package-lock.json') }}" - - name: Install Dependencies - run: npm ci --ignore-scripts - - name: 'Check lint' - run: npm start lint + strategy: + fail-fast: false + matrix: + test-part: + - interfaces + - unit + - integration + - jsapi + - requires + - reporters + - only + with: + npm-script: test-node:${{ matrix.test-part }} - test-node: - name: 'Node.js [v${{ matrix.node }} / ${{ matrix.os }}]' - needs: smoke - runs-on: '${{ matrix.os }}' - env: - NODE_OPTIONS: '--trace-warnings' + test-node-all: + name: Test ${{ matrix.test-part }} in all environments + # TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module + uses: ./.github/workflows/npm-script.yml + needs: test-node-lts strategy: + fail-fast: false matrix: - os: - - ubuntu-latest - - windows-2019 - node: - - 14 - - 16 - - 18 - - 20 + coverage: [true] + test-part: + - interfaces + - unit + - integration + - requires + - reporters + - only include: - - os: ubuntu-latest - node: 16 - env: - COVERAGE: 1 - steps: - - uses: actions/setup-node@v4 - with: - node-version: '${{ matrix.node }}' - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Get npm cache directory in Windows - id: npm-cache - if: ${{ matrix.os == 'windows-2019' }} - run: | - echo "dir=$(npm config get cache)" >> $env:GITHUB_OUTPUT - - name: 'Cache node_modules' - uses: actions/cache@v4 - with: - path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }} - key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}" - - name: Install Dependencies - run: npm ci --ignore-scripts - - name: Install Annotation Support - run: npm install mocha-github-actions-reporter - - name: Run All Node.js Tests - run: npm start test.node - env: - COVERAGE: '${{ matrix.env.COVERAGE }}' - MOCHA_REPORTER: mocha-github-actions-reporter - # this is so mocha-github-actions-reporter can find mocha - NODE_PATH: lib - - name: Generate Coverage Report (Linux + Node.js latest) - if: ${{ matrix.env.COVERAGE }} - run: npm start coverage-report-lcov - - name: Upload Coverage to Coveralls (Linux + Node.js latest) - if: ${{ matrix.env.COVERAGE }} - uses: coverallsapp/github-action@master - with: - github-token: '${{ secrets.GITHUB_TOKEN }}' + - test-part: jsapi + coverage: false + with: + os: 'ubuntu-latest,windows-latest' + node-versions: '14,16,18,20,22' + npm-script: test-node:${{ matrix.test-part }} + coverage: ${{ matrix.coverage }} - test-browser-local: - name: Browser Test [ChromeHeadless] - needs: smoke + test-node-upload-coverage: + needs: test-node-all + if: always() runs-on: ubuntu-latest - timeout-minutes: 20 - # Don't run forked 'pull_request' without saucelabs token - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork steps: - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: 'Cache node_modules' - uses: actions/cache@v4 - with: - path: '~/.npm' - # this key is different than above, since we are running scripts - # (builds, postinstall lifecycle hooks, etc.) - key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}" - - name: Install Dependencies - run: npm ci - - name: Run Browser Tests - run: npm start test.browser - env: - BROWSER: ChromeHeadless + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true - test-browser-saucelabs: - name: Browser Tests on SauceLabs [${{ matrix.browser }}] - needs: - - smoke - - test-browser-local - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - browser: - - firefox@latest - - chrome@latest - - MicrosoftEdge@latest - - safari@latest - # Don't run forked 'pull_request' without saucelabs token - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork - steps: - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: 'Cache node_modules' - uses: actions/cache@v4 - with: - path: '~/.npm' - # this key is different than above, since we are running scripts - # (builds, postinstall lifecycle hooks, etc.) - key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}" - - name: Install Dependencies - run: npm ci - - name: Run Browser Tests - run: npm start test.browser - env: - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - BROWSER: ${{ matrix.browser }} + test-browser-local: + uses: ./.github/workflows/npm-script.yml + with: + browsers: ChromeHeadless + npm-script: test-browser + + # test-browser-saucelabs: + # # Don't run forked 'pull_request' without saucelabs token + # if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork + # needs: + # - lint + # - smoke + # - test-browser-local + # uses: ./.github/workflows/npm-script.yml + # secrets: inherit + # with: + # browsers: 'firefox@latest,chrome@latest,MicrosoftEdge@latest,safari@latest' + # npm-script: test-browser diff --git a/.github/workflows/nightly-site-deploy.yml b/.github/workflows/nightly-site-deploy.yml index bd1ac0e3af..80f1118d01 100644 --- a/.github/workflows/nightly-site-deploy.yml +++ b/.github/workflows/nightly-site-deploy.yml @@ -2,15 +2,20 @@ # This updates the list of supporters name: Nightly mochajs.org Deploy + on: schedule: - cron: '0 0 * * *' + +permissions: + contents: read + jobs: deploy: runs-on: ubuntu-latest steps: - name: Webhook Action - uses: joelwmale/webhook-action@2.3.2 + uses: joelwmale/webhook-action@cc1a66f987e1591785273fd6f9d2f7a9d8d7c9cd env: data: '' WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }} diff --git a/.github/workflows/npm-script.yml b/.github/workflows/npm-script.yml new file mode 100644 index 0000000000..2fe2bc8f5b --- /dev/null +++ b/.github/workflows/npm-script.yml @@ -0,0 +1,84 @@ +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 + +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 || '["lts/*"]') }} + os: ${{ fromJson(needs.resolve-inputs.outputs.os || '["ubuntu-latest"]') }} + browser: ${{ fromJson(needs.resolve-inputs.outputs.browsers || '[""]') }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + 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' + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} + - name: Generate coverage report + if: always() && inputs.coverage + run: npm run test-coverage-generate + - name: Coveralls Parallel + if: always() && inputs.coverage + uses: coverallsapp/github-action@v2 + with: + flag-name: run-${{ inputs.npm-script }}-${{ join(matrix.*, '-') }} + parallel: true diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000000..f4ab2854c9 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,49 @@ +name: Release Please + +on: + push: + branches: + - main + +permissions: + contents: read + +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 + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + with: + show-progress: false + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci --ignore-scripts --force --no-fund --no-audit + + - run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index adce588d9e..467827414e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Mocha-specific docs/_site -docs/_dist docs/images/supporters docs/api mocha.js diff --git a/.knip.jsonc b/.knip.jsonc new file mode 100644 index 0000000000..3b19b3e651 --- /dev/null +++ b/.knip.jsonc @@ -0,0 +1,40 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema-jsonc.json", + "entry": [ + "bin/mocha.js!", + "bin/_mocha!", + "browser-entry.js!", + "index.js!", + "lib/cli/index.js!", + ".eleventy.js", + "karma.conf.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": [ + "@mocha/docdash", + "coffeescript", + "fake", + "jsdoc-ts-utils", + "karma-chrome-launcher", + "karma-mocha-reporter", + "karma-mocha", + "karma-sauce-launcher", + "non-existent-package", + "prettier" + ], + "mocha": { + "entry": ["test/**/*.{js,ts,mjs,cjs}"] + }, + "webpack": { + "config": "test/browser-specific/fixtures/webpack/webpack.config.js" + }, + "rules": { + "exports": "off" + } +} diff --git a/.mocharc.yml b/.mocharc.yml index dfb82e07f6..5f788099d3 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -7,7 +7,6 @@ global: timeout: 1000 watch-ignore: - '.*' - - 'docs/_dist/**' - 'docs/_site/**' - 'node_modules' - 'coverage' diff --git a/AUTHORS b/AUTHORS index 17d79bd2be..0cf883596a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -554,5 +554,14 @@ 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 # Generated by scripts/update-authors.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 62a37eb7a8..66d00fbc83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,148 @@ # Changelog +## [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 @@ -11,7 +154,7 @@ - [#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 +### :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)) @@ -36,7 +179,7 @@ This is a stable release equivalent to [10.30.0-prerelease](#1030-prerelease--20 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 +### :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)) @@ -76,7 +219,7 @@ Other than removing or updating dependencies, it contains no intended user-facin - [#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 +### :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)) @@ -101,7 +244,7 @@ Other than removing or updating dependencies, it contains no intended user-facin - [#4861](https://github.com/mochajs/mocha/issues/4861): Remove deprecated `Runner` signature ([**@juergba**](https://github.com/juergba)) -### :nut_and_bolt: Other +### :nut\_and\_bolt: Other - [#4878](https://github.com/mochajs/mocha/issues/4878): Update production dependencies ([**@juergba**](https://github.com/juergba)) @@ -119,7 +262,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#4839](https://github.com/mochajs/mocha/issues/4839): `dry-run`: prevent potential call-stack crash ([**@juergba**](https://github.com/juergba)) -### :nut_and_bolt: Other +### :nut\_and\_bolt: Other - [#4843](https://github.com/mochajs/mocha/issues/4843): Update production dependencies ([**@juergba**](https://github.com/juergba)) @@ -137,7 +280,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#4813](https://github.com/mochajs/mocha/issues/4813): Parallel: assign each worker a worker-id ([**@forty**](https://github.com/forty)) -### :nut_and_bolt: Other +### :nut\_and\_bolt: Other - [#4818](https://github.com/mochajs/mocha/issues/4818): Update production dependencies ([**@juergba**](https://github.com/juergba)) @@ -147,7 +290,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#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 +### :nut\_and\_bolt: Other - [#4777](https://github.com/mochajs/mocha/issues/4777): Add Node v17 to CI test matrix ([**@outsideris**](https://github.com/outsideris)) @@ -157,7 +300,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#4769](https://github.com/mochajs/mocha/issues/4769): Browser: re-enable `bdd` ES6 style import ([**@juergba**](https://github.com/juergba)) -### :nut_and_bolt: Other +### :nut\_and\_bolt: Other - [#4764](https://github.com/mochajs/mocha/issues/4764): Revert deprecation of `EVENT_SUITE_ADD_*` events ([**@beatfactor**](https://github.com/beatfactor)) @@ -167,7 +310,7 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#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 +### :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)) @@ -202,13 +345,13 @@ Also thanks to [**@ea2305**](https://github.com/ea2305) and [**@SukkaW**](https: - [#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 +### :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 +### :nut\_and\_bolt: Other - [#4657](https://github.com/mochajs/mocha/issues/4657): Browser: add separate bundle for modern browsers ([**@juergba**](https://github.com/juergba)) @@ -240,7 +383,7 @@ We added a separate browser bundle `mocha-es2018.js` in javascript ES2018, as we - [#4128](https://github.com/mochajs/mocha/issues/4128): Fix: control stringification of error message ([**@syeutyu**](https://github.com/syeutyu)) -### :nut_and_bolt: Other +### :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)) @@ -300,7 +443,7 @@ Also thanks to [**@outsideris**](https://github.com/outsideris) for various impr - [#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 +### :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)) @@ -320,11 +463,11 @@ Also thanks to [**@akeating**](https://github.com/akeating) for a documentation ## 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). +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. +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). +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: @@ -359,7 +502,7 @@ For detailed information, please see the [documentation](https://mochajs.org/#gl - [#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:_ +*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` @@ -405,11 +548,11 @@ Thanks to [**@AviVahl**](https://github.com/AviVahl), [**@donghoon-song**](https 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=). +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! +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). @@ -436,7 +579,7 @@ Other community contributions came from [**@Devjeel**](https://github.com/Devjee - [#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 +### :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)) @@ -450,7 +593,7 @@ The obligatory patch after a major. ## 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. +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! @@ -487,17 +630,17 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt - [#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_ + :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)) +- [#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 +### :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)) @@ -529,7 +672,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt - [#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 +### :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)) @@ -538,7 +681,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt ## 7.1.2 / 2020-04-26 -### :nut_and_bolt: Other +### :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)) @@ -585,7 +728,7 @@ Mocha supports writing your test files as ES modules: - [#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 +### :nut\_and\_bolt: Other - [#4138](https://github.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@kaicataldo**](https://github.com/kaicataldo)) @@ -603,7 +746,7 @@ Mocha supports writing your test files as ES modules: - [#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 +### :nut\_and\_bolt: Other - [#4133](https://github.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@Zirak**](https://github.com/Zirak)) @@ -633,7 +776,7 @@ Mocha supports writing your test files as ES modules: ### :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: +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)) @@ -659,7 +802,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r - [#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 +### :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)) @@ -691,7 +834,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r ### :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)) +- [#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)) @@ -730,7 +873,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r - [#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 +### :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)) @@ -782,7 +925,7 @@ These are _soft_-deprecated, and will emit a warning upon use. Support will be r ### :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: +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)) @@ -808,7 +951,7 @@ and some regressions: - [#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 +### :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)) @@ -833,7 +976,7 @@ 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)) +- [#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 @@ -869,7 +1012,7 @@ These issues were regressions. - [#3652](https://github.com/mochajs/mocha/issues/3652): Switch from Jekyll to Eleventy ([**@Munter**](https://github.com/Munter)) -### :nut_and_bolt: Other +### :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)) @@ -899,7 +1042,7 @@ Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https:/ - `-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)) +- [#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)) @@ -908,7 +1051,7 @@ Welcome [**@plroebuck**](https://github.com/plroebuck), [**@craigtaub**](https:/ ### :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: +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 @@ -945,7 +1088,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - 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` + - 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 @@ -954,7 +1097,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - `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`. +- `--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)) @@ -992,7 +1135,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - [#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 +### :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) @@ -1012,7 +1155,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - [#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 +### :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)) @@ -1039,7 +1182,7 @@ Enhancements introduced in [#3556](https://github.com/mochajs/mocha/issues/3556) - [#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 +### :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)) @@ -1058,7 +1201,7 @@ Welcome [@outsideris](https://github.com/outsideris) to the team! - [#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 +### :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)) @@ -1078,13 +1221,13 @@ This patch features a fix to address a potential "low severity" [ReDoS vulnerabi - [#3266](https://github.com/mochajs/mocha/pull/3266): Bump `diff` to v3.5.0 ([@anishkny](https://github.com/anishkny)) -### :nut_and_bolt: Other +### :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! +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 @@ -1105,13 +1248,13 @@ This release fixes a class of tests which report as _false positives_. **Certain }); \`\`\` - 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. + 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')`. + **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 +### :nut\_and\_bolt: Other - [#3248](https://github.com/mochajs/mocha/issues/3248): Update `browser-stdout` to v1.3.1 ([@honzajavorek](https://github.com/honzajavorek)) @@ -1132,14 +1275,14 @@ Special thanks to [Wallaby.js](https://wallabyjs.com) for their continued suppor - [#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 +### :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_. +Mocha starts off 2018 right by again dropping support for *unmaintained rubbish*. Welcome [@vkarpov15](https://github.com/vkarpov15) to the team! @@ -1170,7 +1313,7 @@ Welcome [@vkarpov15](https://github.com/vkarpov15) to the team! - [#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 +### :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)) diff --git a/FUNDING.md b/FUNDING.md new file mode 100644 index 0000000000..470224090a --- /dev/null +++ b/FUNDING.md @@ -0,0 +1,16 @@ +# Fund Usage Guidelines + +This project follows [Collective Funds Guidelines 0.1](https://github.com/collective-funds/guidelines) with the below customizations. + +## Rates + +* TSC Members: $50.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. diff --git a/LICENSE b/LICENSE index 5c62253205..b114d5f113 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2011-2022 OpenJS Foundation and contributors, https://openjsf.org +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 diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 16b4463dd8..308ba603f1 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -25,7 +25,7 @@ A "user" for the purpose of this document is any _individual developer_ who cons A user interacts with contributors. A user interacts with the software, web site, documentation, etc., which these contributors provide. -As a user, you're expected to follow the [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) when interacting in Mocha's "official" social spaces. +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 @@ -54,7 +54,7 @@ Contributions include (but are not limited to): 1. Researching the user base, getting feedback, etc. Don't spam. A contributor is _usually_ a user as well, but this isn't a hard-and-fast rule. -A contributor is also expected to adhere to the [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) as a user would. +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. @@ -123,7 +123,7 @@ You may choose to do zero or more of these _at their discretion_: - Add new maintainers to the team - Tag releases and publish Mocha to npm -> While maintainers have the ability to commit directly to the `master` branch, _this is to be avoided_ if any other maintainer could reasonably take issue with the change, or the change affects Mocha's API or output. +> 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. @@ -347,8 +347,8 @@ Here are some suggestions: ## Branches -`master` is the only maintained branch in `mochajs/mocha` or any of the other repos. -**`master` is the only branch to which force-pushing is disallowed.** +`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). @@ -371,7 +371,7 @@ Likewise, if the PR is `semver-minor`, create or use a new milestone correlating If it's unclear what the next milestone will be, use or create a milestone named `next`. This milestone will be renamed to the new version at release time. -By using milestones, we can cherry-pick non-breaking changes into minor or patch releases, and keep `master` as the latest version. +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.** @@ -380,7 +380,7 @@ By using milestones, we can cherry-pick non-breaking changes into minor or patch _It's easier to release often._ 1. Decide whether this is a `patch`, `minor`, or `major` release. -1. Checkout `master` in your working copy & pull. +1. Checkout `main` in your working copy & pull. 1. Modify `CHANGELOG.md`; follow the existing conventions in that file. Use the "pull request" number, unless there isn't one. _You do not need to add Markdown links; this is done automatically._ @@ -391,15 +391,15 @@ _It's easier to release often._ (Hint--use `-m`: e.g., `npm version patch -m 'Release v%s'`) 1. This command will update the list of authors (from the Git history) in `AUTHORS`, and add GitHub links to `CHANGELOG.md`. 1. These changes are then added to the Git "stage" and will be added to the commit. -1. Push `master` to `origin` with your new tag; e.g. `git push origin master --tags` +1. Push `main` to `origin` with your new tag; e.g. `git push origin main --tags` 1. Copy & paste the `CHANGELOG.md` lines to a new GitHub "release". Save release as draft. 1. Meanwhile, you can check [the build](https://travis-ci.org/mochajs/mocha) on Travis-CI and [GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Windows+CI%22). 1. Once the build is green, you'll want to trigger an update of `mochajs.org`: - 1. _If you're doing a prerelease_, fast-forward the `next` branch to `master`, and push it. + 1. _If you're doing a prerelease_, fast-forward the `next` branch to `main`, and push it. This updates [https://next.mochajs.org](https://next.mochajs.org). That's all. - 1. _If this is NOT a prerelease_, fast-forward the `mochajs.org` branch to `master` and push it. + 1. _If this is NOT a prerelease_, fast-forward the `mochajs.org` branch to `main` and push it. This updates [https://mochajs.org](https://mochajs.org). 1. _If this is a "final" release_ (the first release of a major _after_ one or more prereleases) then remove the `next` tag from npm via `npm dist-tag rm next`. 1. Finally, you're satisfied with the release notes, open your draft release on GitHub, then click "publish." diff --git a/PROJECT_CHARTER.md b/PROJECT_CHARTER.md index 1f3e92e943..3505acb8e4 100644 --- a/PROJECT_CHARTER.md +++ b/PROJECT_CHARTER.md @@ -32,7 +32,7 @@ The **Mocha** project is part of the [OpenJS Foundation], which operates transpa - 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/master/.github/CONTRIBUTING.md) + - [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 @@ -72,7 +72,7 @@ Changes to the following **cannot** unilaterally be applied by project leadershi - Mocha's Project Charter (this document) - Mocha's [Code of Conduct] -- Mocha's licenses: [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE) (for code) and [CC-BY-4.0](https://github.com/mochajs/mocha/blob/master/docs/LICENSE-CC-BY-4.0) (for documentation/website) +- 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 @@ -103,5 +103,5 @@ Section Intentionally Left Blank Section Intentionally Left Blank [openjs foundation]: https://openjsf.org -[maintainers.md]: https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md -[code of conduct]: https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md +[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 diff --git a/README.md b/README.md index 3545f7a721..c82fc76bd9 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,34 @@

- Mocha test framework logo + Mocha test framework logo

โ˜•๏ธ Simple, flexible, fun JavaScript test framework for Node.js & The Browser โ˜•๏ธ

-

-GitHub Actions Build Status -Coverage Status -FOSSA Status -Chat - Discord -OpenCollective Sponsors -OpenCollective Backers -

+
-

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) +Coverage Status + +
-


Mocha Browser Support h/t SauceLabs

+
+ +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/master/CHANGELOG.md)** -- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) -- [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) -- [Development](https://github.com/mochajs/mocha/blob/master/.github/DEVELOPMENT.md) +- **[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) @@ -59,7 +61,7 @@ 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/master/MAINTAINERS.md) explains how things get done +- 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: @@ -69,6 +71,4 @@ Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXh ## License -Copyright 2011-2022 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE). - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large) +Copyright 2011-2024 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/main/LICENSE). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..f9dc270129 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# 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. diff --git a/browser-entry.js b/browser-entry.js index 67517db357..4e6f9e939a 100644 --- a/browser-entry.js +++ b/browser-entry.js @@ -71,8 +71,8 @@ process.listenerCount = function (name) { process.on = function (e, fn) { if (e === 'uncaughtException') { - global.onerror = function (err, url, line) { - fn(new Error(err + ' (' + url + ':' + line + ')')); + global.onerror = function (msg, url, line, col, err) { + fn(err || new Error(msg + ' (' + url + ':' + line + ':' + col + ')')); return !mocha.options.allowUncaught; }; uncaughtExceptionHandlers.push(fn); diff --git a/docs/API.md b/docs/API.md index 7b63a6b433..a6e17bf284 100644 --- a/docs/API.md +++ b/docs/API.md @@ -13,7 +13,7 @@ Otherwise, **you probably want the [main documentation](https://mochajs.org)**. ## Other Links - **[Main Documentation](https://mochajs.org)** -- **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)** -- [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) +- **[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) - [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!) - [Issue Tracker](https://github.com/mochajs/mocha/issues) diff --git a/docs/README.md b/docs/README.md index f85b53adec..09f5e5857b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,42 +4,14 @@ _So you wanna build the site?_ [mochajs.org](https://mochajs.org) is built using [Eleventy](https://www.11ty.io/), a simple static site generator. -## Prerequisites - -- Node.js v10.12.0 or greater - ## Development -1. Run `npm install` from working copy root to get Node.js deps. -1. To serve the site and rebuild as changes are made, execute `npm start docs.watch`. -1. To rebuild the site _once_, execute `npm start docs`. +1. Run `npm install` / `npm ci` from working copy root to get Node.js deps. +1. To serve the site and rebuild as changes are made, execute `npm run docs-watch`. +1. To rebuild the site _once_, execute `npm run docs`. ### Notes - The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc. - This file (`docs/README.md`) should _not_ be included in the build. -- `docs/_dist` is where the deployed site lives. `docs/_site` is essentially a build step. These directories are _not_ under version control. -- If you get the error message below when running `npm start docs`, follow [this guide](https://www.npmjs.com/package/gm) to install GraphicsMagick or ImageMagick. - -```console -โš  WARN: docs/_site/images/matomo-logo.png: Error executing Stream: The gm stream ended without emitting any data -(node:45255) UnhandledPromiseRejectionWarning: Error: docs/_site/images/matomo-logo.png: Error executing Stream: The gm stream ended without emitting any data - at Socket.stdout.on.once (/Users/username/mocha/node_modules/express-processimage/lib/getFilterInfosAndTargetContentTypeFromQueryString.js:821:31) - at Object.onceWrapper (events.js:286:20) - at Socket.emit (events.js:203:15) - at endReadableNT (_stream_readable.js:1145:12) - at process._tickCallback (internal/process/next_tick.js:63:19) -(node:45255) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) -(node:45255) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. -cp: docs/_dist/_headers: No such file or directory -``` - -- See `package-scripts.js` for details on what the builds are actually doing. - -## License - -:copyright: 2016-2018 [JS Foundation](https://js.foundation) and contributors. - -Content licensed [CC-BY-4.0](https://raw.githubusercontent.com/mochajs/mocha/master/docs/LICENSE-CC-BY-4.0). - -Code licensed [MIT](https://raw.githubusercontent.com/mochajs/mocha/master/LICENSE-MIT). +- `docs/_site_` is where the deployed site lives. This directories are _not_ under version control. diff --git a/docs/_data/supporters.js b/docs/_data/supporters.js index d31bebd524..21d950d1d3 100755 --- a/docs/_data/supporters.js +++ b/docs/_data/supporters.js @@ -17,7 +17,6 @@ 'use strict'; -const {loadImage} = require('canvas'); const {writeFile, mkdir, rm} = require('fs').promises; const {resolve} = require('path'); const debug = require('debug')('mocha:docs:data:supporters'); @@ -28,7 +27,7 @@ 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|slots|gambl(?:e|ing)|crypto)/i; +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)/i; /** * Add a few Categories exposed by Open Collective to help moderation @@ -39,7 +38,8 @@ const BLOCKED_CATEGORIES = [ 'credit', 'gambling', 'seo', - 'writer' + 'writer', + 'review' ]; /** @@ -115,13 +115,6 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD ); } debug('fetched %s', url); - const canvasImage = await loadImage(imageBuf); - debug('ok %s', url); - supporter.dimensions = { - width: canvasImage.width, - height: canvasImage.height - }; - // debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height); const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png'); await writeFile(filePath, imageBuf); debug('wrote %s', filePath); @@ -168,10 +161,21 @@ const getAllOrders = async (slug = 'mochajs') => { } }; -const isAllowed = ({slug, categories}) => - !blocklist.has(slug) && - !BLOCKED_STRINGS.test(slug) && - !categories.some(category => BLOCKED_CATEGORIES.includes(category)); +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(); diff --git a/docs/_includes/supporters.md b/docs/_includes/supporters.md index 96d13eb5d9..3ef3e050ba 100644 --- a/docs/_includes/supporters.md +++ b/docs/_includes/supporters.md @@ -2,13 +2,13 @@ Use Mocha at Work? Ask your manager or marketing team if they'd help [support](https://opencollective.com/mochajs#support) our project. Your company's logo will also be displayed on [npmjs.com](http://npmjs.com/package/mocha) and our [GitHub repository](https://github.com/mochajs/mocha#sponsors). -