diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.yml index 94a457350a..745cb4b13c 100644 --- a/.github/workflows/mocha.yml +++ b/.github/workflows/mocha.yml @@ -5,42 +5,19 @@ name: Tests types: - opened - synchronize - - closed - reopened - # see https://github.com/bradennapier/eslint-plus-action#handle-forked-prs - schedule: - - cron: '*/15 * * * *' jobs: - prepare-commit-msg: - name: Retrive head commit message + prevent-run-twice: + name: Prevent to run twice runs-on: ubuntu-latest - outputs: - HEAD_COMMIT_MSG: '${{ steps.commitMsg.outputs.HEAD_COMMIT_MSG }}' + # Run 'pull-request' event only on external PRs from forked repos. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository steps: - - uses: actions/checkout@v2 - if: github.event_name == 'pull_request' - - name: find commit msg for PR - id: commitMsg - if: github.event_name == 'pull_request' - run: >- - echo "::set-output name=HEAD_COMMIT_MSG::$(git log --no-merges -1 - --oneline)" - - check-skip: - name: Check to skip CI - needs: prepare-commit-msg - runs-on: ubuntu-latest - if: >- - ${{ !contains(github.event.head_commit.message, '[ci skip]') && - !contains(needs.prepare-commit-msg.outputs.HEAD_COMMIT_MSG, '[ci skip]') - }} - steps: - - run: 'echo "${{ github.event.head_commit.message }}"' - + - run: 'echo run Tests' smoke: name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]' - needs: check-skip + needs: prevent-run-twice runs-on: '${{ matrix.os }}' strategy: matrix: @@ -51,6 +28,7 @@ jobs: - 10 - 12 - 14 + - 15 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 @@ -106,66 +84,67 @@ jobs: - 10 - 12 - 14 + - 15 include: - os: ubuntu-latest node: 14 env: COVERAGE: 1 steps: - - name: Cache Growl Installer (Windows) - if: "${{ matrix.os == 'windows-2019' }}" - id: cache-growl - uses: actions/cache@v2 - with: - path: GrowlInstaller - key: '${{ runner.os }}-growl-installer' - restore-keys: | - ${{ runner.os }}-growl-installer - - name: Download Growl Installer (Windows) - if: "${{ matrix.os == 'windows-2019' && steps.cache-growl.outputs.cache-hit != 'true'}}" - run: > - echo "Downloading Growl installer..." + # - name: Cache Growl Installer (Windows) + # if: "${{ matrix.os == 'windows-2019' }}" + # id: cache-growl + # uses: actions/cache@v2 + # with: + # path: GrowlInstaller + # key: '${{ runner.os }}-growl-installer' + # restore-keys: | + # ${{ runner.os }}-growl-installer + # - name: Download Growl Installer (Windows) + # if: "${{ matrix.os == 'windows-2019' && steps.cache-growl.outputs.cache-hit != 'true'}}" + # run: > + # echo "Downloading Growl installer..." - mkdir GrowlInstaller | out-null + # mkdir GrowlInstaller | out-null - $seaURL = - "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe" + # $seaURL = + # "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe" - $seaPath = "GrowlInstaller\GrowlInstaller.exe" + # $seaPath = "GrowlInstaller\GrowlInstaller.exe" - $webclient = New-Object Net.WebClient + # $webclient = New-Object Net.WebClient - $webclient.DownloadFile($seaURL, $seaPath) + # $webclient.DownloadFile($seaURL, $seaPath) - 7z x $seaPath -oGrowlInstaller | out-null + # 7z x $seaPath -oGrowlInstaller | out-null - echo "Done." - - name: Retrieve Growl Installer (Windows) - if: "${{ matrix.os == 'windows-2019' }}" - uses: actions/cache@v2 - with: - path: GrowlInstaller - key: '${{ runner.os }}-growl-installer' - restore-keys: | - ${{ runner.os }}-growl-installer - - name: Add Growl Installer to Path (Windows) - if: "${{ matrix.os == 'windows-2019' }}" - run: 'echo "C:\Program Files (x86)\Growl for Windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8' - - name: Install Growl - if: "${{ matrix.os == 'windows-2019' }}" - run: | - echo "Installing Growl..." - cmd /c start /wait msiexec /i GrowlInstaller\Growl_v2.0.msi /quiet - echo "Done." - - name: Start Growl Service (Windows) - if: "${{ matrix.os == 'windows-2019' }}" - run: | - echo "Starting Growl service..." - Start-Process -NoNewWindow Growl - ## Growl requires some time before it's ready to handle notifications - echo "Verifying Growl responding" - Start-Sleep -s 10 - growlnotify test + # echo "Done." + # - name: Retrieve Growl Installer (Windows) + # if: "${{ matrix.os == 'windows-2019' }}" + # uses: actions/cache@v2 + # with: + # path: GrowlInstaller + # key: '${{ runner.os }}-growl-installer' + # restore-keys: | + # ${{ runner.os }}-growl-installer + # - name: Add Growl Installer to Path (Windows) + # if: "${{ matrix.os == 'windows-2019' }}" + # run: 'echo "C:\Program Files (x86)\Growl for Windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8' + # - name: Install Growl + # if: "${{ matrix.os == 'windows-2019' }}" + # run: | + # echo "Installing Growl..." + # cmd /c start /wait msiexec /i GrowlInstaller\Growl_v2.0.msi /quiet + # echo "Done." + # - name: Start Growl Service (Windows) + # if: "${{ matrix.os == 'windows-2019' }}" + # run: | + # echo "Starting Growl service..." + # Start-Process -NoNewWindow Growl + # ## Growl requires some time before it's ready to handle notifications + # echo "Verifying Growl responding" + # Start-Sleep -s 10 + # growlnotify test - name: Install libnotify-bin (Linux) if: "${{ matrix.os == 'ubuntu-latest' }}" run: sudo apt-get install libnotify-bin @@ -200,3 +179,30 @@ jobs: uses: coverallsapp/github-action@master with: github-token: '${{ secrets.GITHUB_TOKEN }}' + test-browser: + # TODO: configure to retain build artifacts in `.karma/` dir + name: 'Browser Tests' + needs: smoke + timeout-minutes: 20 + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: 14 + - uses: actions/checkout@v2 + - name: 'Cache node_modules' + uses: actions/cache@v2 + with: + path: '~/.npm' + # this key is different than above, since we are running scripts + # (builds, postinstall lifecycle hooks, etc.) + key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}" + restore-keys: | + ubuntu-latest-node-full-v14- + - 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}}' diff --git a/.github/workflows/purge-expired-artifacts.yml b/.github/workflows/purge-expired-artifacts.yml new file mode 100644 index 0000000000..44692d7da9 --- /dev/null +++ b/.github/workflows/purge-expired-artifacts.yml @@ -0,0 +1,20 @@ +# Deletes expired artifacts, which are not removed automatically by github. + +name: 'Purge expired artifacts' + +on: + schedule: + - cron: '0 1 * * *' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + purge-artifacts: + runs-on: ubuntu-latest + steps: + - uses: LKP-RnD/purge-expired-artifacts-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo_to_purge: "mochajs/mocha" + dry_run: "false" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e89a15a306..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -### -### .travis.yml -### - -# these are executed in order. each must pass for the next to be run -stages: - - test # all tests - -# defaults -language: node_js -node_js: '12' -# `nvm install` happens before the cache is restored, which means -# we must install our own npm elsewhere (`~/npm`) -before_install: | - [[ ! -x ~/npm/node_modules/.bin/npm ]] && { - # caching feature creates `~/npm` for us - cd ~/npm && npm install npm - cd - - } || true - # avoids bugs around https://github.com/travis-ci/travis-ci/issues/5092 - export PATH=~/npm/node_modules/.bin:$PATH -# this avoids compilation in most cases (where we don't need it) -install: npm ci -cache: - directories: - - ~/.npm # cache npm's cache - - ~/npm # cache latest npm - -jobs: - include: - - script: npm start test.browser - name: 'Browser' - node_js: 12 - addons: - artifacts: - paths: - - .karma/ - - ./mocha.js - chrome: stable - sauce_connect: true - -env: - - 'NODE_OPTIONS="--trace-warnings"' - -notifications: - email: false diff --git a/AUTHORS b/AUTHORS index 4548062d3b..926478512f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -515,5 +515,10 @@ 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 # Generated by scripts/update-authors.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f36a9a86..3e8f2555cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,47 @@ -# 8.2.0 / 2020-10-15 +# 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). diff --git a/LICENSE b/LICENSE index 90f3bfd849..c4dc0c0b44 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2011-2020 OpenJS Foundation and contributors, https://openjsf.org +Copyright (c) 2011-2021 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/README.md b/README.md index 80abe31a51..50f315a746 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,19 @@

☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️

-

Build Status Coverage Status FOSSA Status Gitter OpenCollective OpenCollective +

+GitHub Actions Build Status +Coverage Status +FOSSA Status +Gitter +OpenCollective +OpenCollective

-

NPM Version Node Version

+

+NPM Version +Node Version +


Mocha Browser Support h/t SauceLabs

@@ -102,6 +111,6 @@ Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors ## License -Copyright 2011-2020 OpenJS Foundation and contributors. Licensed [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE). +Copyright 2011-2021 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) diff --git a/bin/mocha b/bin/mocha index d19d71ffcc..79d35562d4 100755 --- a/bin/mocha +++ b/bin/mocha @@ -36,8 +36,6 @@ const disableTimeouts = value => { if (impliesNoTimeouts(value)) { debug('option %s disabled timeouts', value); mochaArgs.timeout = 0; - delete mochaArgs.timeouts; - delete mochaArgs.t; } }; @@ -93,7 +91,6 @@ if (mochaArgs.require && mochaArgs.require.includes('esm')) { if (!mochaArgs.require.length) { delete mochaArgs.require; } - delete mochaArgs.r; } if (Object.keys(nodeArgs).length) { diff --git a/docs/_includes/supporters.md b/docs/_includes/supporters.md index 9ee2b520fe..59c57306c5 100644 --- a/docs/_includes/supporters.md +++ b/docs/_includes/supporters.md @@ -3,7 +3,7 @@ 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).