Skip to content
Permalink

Comparing changes

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

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mochajs/mocha
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7c09e634267ddc18d1ec08a4bfd999efa317d684
Choose a base ref
...
head repository: mochajs/mocha
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: afe8daac603d398743dd5572f497ba088193bf53
Choose a head ref
Loading
Showing with 36,468 additions and 20,687 deletions.
  1. +12 −0 .browserslistrc
  2. +17 −3 .eleventy.js
  3. +5 −1 .eslintignore
  4. +20 −16 .eslintrc.yml
  5. +1 −1 .github/CODE_OF_CONDUCT.md
  6. +3 −3 .github/CONTRIBUTING.md
  7. +202 −0 .github/workflows/mocha.yml
  8. +16 −0 .github/workflows/nightly-site-deploy.yml
  9. +9 −0 .gitignore
  10. +3 −8 .lintstagedrc.json
  11. +2 −1 .markdownlint.json
  12. +13 −6 .mocharc.yml
  13. +1 −0 .npmrc
  14. +13 −2 .nycrc
  15. +7 −61 .travis.yml
  16. +5 −15 .wallaby.js
  17. +27 −0 AUTHORS
  18. +251 −2 CHANGELOG.md
  19. +6 −8 MAINTAINERS.md
  20. +2 −0 README.md
  21. +0 −77 appveyor.yml
  22. BIN assets/mocha-fixture-wizard.sketch
  23. +24 −4 bin/mocha
  24. +35 −7 browser-entry.js
  25. +4 −0 docs/.eleventyignore
  26. +2 −3 docs/API.md
  27. +2 −2 docs/README.md
  28. +19 −0 docs/_data/blocklist.json
  29. +48 −0 docs/_data/files.js
  30. +291 −0 docs/_data/supporters.js
  31. +21 −0 docs/_data/toc.js
  32. +21 −0 docs/_data/usage.js
  33. +0 −7 docs/_includes/backers.md
  34. +23 −13 docs/_includes/{default.html → default.liquid}
  35. +436 −0 docs/_includes/fixture-wizard.html
  36. +0 −10 docs/_includes/sponsors.md
  37. +35 −0 docs/_includes/supporters.md
  38. +3 −63 docs/api-tutorials/custom-reporter.md
  39. +7 −0 docs/changelogs/README.md
  40. +75 −20 docs/css/style.css
  41. +13 −0 docs/css/supporters.css
  42. +0 −12 docs/images/backer-background.svg
  43. BIN docs/images/wallaby-logo.png
  44. +656 −266 docs/index.md
  45. +0 −32 docs/js/avatars.js
  46. +0 −1 example/config/.mocharc.js
  47. +0 −1 example/config/.mocharc.json
  48. +0 −1 example/config/.mocharc.jsonc
  49. +11 −12 example/config/.mocharc.yml
  50. +1 −1 jsdoc.conf.json
  51. +294 −140 karma.conf.js
  52. +2 −1 lib/browser/growl.js
  53. +39 −0 lib/browser/highlight-tags.js
  54. +24 −0 lib/browser/parse-query.js
  55. +4 −0 lib/browser/progress.js
  56. +7 −5 lib/browser/template.html
  57. +0 −13 lib/browser/tty.js
  58. +25 −11 lib/cli/cli.js
  59. +17 −10 lib/cli/collect-files.js
  60. +6 −6 lib/cli/config.js
  61. +0 −6 lib/cli/index.js
  62. +1 −2 lib/cli/init.js
  63. +151 −0 lib/cli/lookup-files.js
  64. +7 −8 lib/cli/node-flags.js
  65. +19 −94 lib/cli/options.js
  66. +98 −36 lib/cli/run-helpers.js
  67. +29 −4 lib/cli/run-option-metadata.js
  68. +68 −12 lib/cli/run.js
  69. +234 −55 lib/cli/watch-run.js
  70. +0 −15 lib/context.js
  71. +319 −17 lib/errors.js
  72. +11 −6 lib/esm-utils.js
  73. +38 −1 lib/hook.js
  74. +21 −10 lib/interfaces/common.js
  75. +516 −141 lib/mocha.js
  76. +0 −1 lib/mocharc.json
  77. +172 −0 lib/nodejs/buffered-worker-pool.js
  78. +15 −0 lib/nodejs/file-unloader.js
  79. +3 −2 lib/{ → nodejs}/growl.js
  80. +433 −0 lib/nodejs/parallel-buffered-runner.js
  81. +165 −0 lib/nodejs/reporters/parallel-buffered.js
  82. +412 −0 lib/nodejs/serializer.js
  83. +151 −0 lib/nodejs/worker.js
  84. +4 −0 lib/pending.js
  85. +286 −0 lib/plugin-loader.js
  86. +25 −12 lib/reporters/base.js
  87. +6 −0 lib/reporters/doc.js
  88. +3 −1 lib/reporters/json-stream.js
  89. +2 −0 lib/reporters/json.js
  90. +11 −3 lib/reporters/landing.js
  91. +1 −2 lib/reporters/tap.js
  92. +3 −2 lib/reporters/xunit.js
  93. +45 −72 lib/runnable.js
  94. +374 −173 lib/runner.js
  95. +93 −40 lib/suite.js
  96. +52 −3 lib/test.js
  97. +184 −307 lib/utils.js
  98. +9 −0 netlify.toml
  99. +19,493 −14,498 package-lock.json
  100. +51 −64 package-scripts.js
  101. +115 −84 package.json
  102. +64 −0 rollup.config.js
  103. +0 −24 scripts/dedefine.js
  104. +156 −0 scripts/karma-rollup-plugin.js
  105. +1 −1 scripts/linkify-changelog.js
  106. +0 −105 scripts/markdown-magic.config.js
  107. +10 −3 scripts/netlify-headers.js
  108. +0 −17 scripts/package-json-cullify.js
  109. +28 −0 scripts/pick-from-package-json.js
  110. +331 −311 test/assertions.js
  111. +4 −0 test/browser-specific/esm.spec.mjs
  112. +1 −0 test/browser-specific/fixtures/esm.fixture.mjs
  113. +3 −0 test/browser-specific/fixtures/requirejs/lib.fixture.js
  114. +9 −0 test/browser-specific/fixtures/requirejs/main.fixture.js
  115. +22 −0 test/browser-specific/fixtures/webpack/webpack.config.js
  116. +2 −0 test/browser-specific/fixtures/webpack/webpack.fixture.mjs
  117. +0 −6 test/browser-specific/mocha.opts
  118. +17 −0 test/browser-specific/requirejs-setup.js
  119. +5 −3 test/browser-specific/setup.js
  120. +0 −16 test/bundle/amd.spec.js
  121. +1 −1 test/integration/diffs.spec.js
  122. +3 −1 test/integration/esm.spec.js
  123. +234 −83 test/integration/file-utils.spec.js
  124. +4 −4 test/integration/fixtures/deprecate.fixture.js
  125. +20 −0 test/integration/fixtures/multiple-done-async.fixture.js
  126. +1 −1 ...integration/fixtures/{multiple-done-beforeEach.fixture.js → multiple-done-before-each.fixture.js}
  127. +1 −1 test/integration/fixtures/multiple-done-before.fixture.js
  128. +6 −0 test/integration/fixtures/multiple-runs/clean-references.fixture.js
  129. +6 −0 test/integration/fixtures/multiple-runs/dispose.fixture.js
  130. +19 −0 test/integration/fixtures/multiple-runs/multiple-runs-with-different-output-suite.fixture.js
  131. +18 −0 test/integration/fixtures/multiple-runs/multiple-runs-with-flaky-before-each-suite.fixture.js
  132. +13 −0 test/integration/fixtures/multiple-runs/multiple-runs-with-flaky-before-each.fixture.js
  133. +24 −0 test/integration/fixtures/multiple-runs/run-thrice-helper.js
  134. +6 −0 test/integration/fixtures/multiple-runs/run-thrice.fixture.js
  135. +5 −0 ...integration/fixtures/multiple-runs/start-second-run-if-previous-is-still-running-suite.fixture.js
  136. +12 −0 test/integration/fixtures/multiple-runs/start-second-run-if-previous-is-still-running.fixture.js
  137. +8 −0 test/integration/fixtures/options/forbid-only/only-before-each.fixture.js
  138. +8 −0 test/integration/fixtures/options/forbid-only/only-before.fixture.js
  139. +0 −1 test/integration/fixtures/options/help/test/mocha.opts
  140. +7 −0 test/integration/fixtures/options/jobs/fail-in-parallel.fixture.js
  141. +0 −5 test/integration/fixtures/options/opts.fixture.js
  142. +9 −0 test/integration/fixtures/options/parallel/bail.fixture.js
  143. +3 −0 test/integration/fixtures/options/parallel/exclusive-test-a.fixture.js
  144. +3 −0 test/integration/fixtures/options/parallel/exclusive-test-b.fixture.js
  145. +5 −0 test/integration/fixtures/options/parallel/retries-a.fixture.js
  146. +8 −0 test/integration/fixtures/options/parallel/retries-b.fixture.js
  147. +1 −0 test/integration/fixtures/options/parallel/syntax-err.fixture.js
  148. +3 −0 test/integration/fixtures/options/parallel/test-a.fixture.js
  149. +3 −0 test/integration/fixtures/options/parallel/test-b.fixture.js
  150. +5 −0 test/integration/fixtures/options/parallel/test-c.fixture.js
  151. +7 −0 test/integration/fixtures/options/parallel/test-d.fixture.js
  152. +7 −0 test/integration/fixtures/options/parallel/uncaught.fixture.js
  153. +7 −0 test/integration/fixtures/options/watch/hook.fixture.js
  154. +42 −29 test/integration/fixtures/pending/skip-async-before-hooks.fixture.js
  155. +39 −27 test/integration/fixtures/pending/skip-sync-before-hooks.fixture.js
  156. +38 −0 test/integration/fixtures/pending/skip-sync-before-inner.fixture.js
  157. +20 −0 test/integration/fixtures/plugins/global-fixtures/global-setup-teardown-multiple.fixture.js
  158. +10 −0 test/integration/fixtures/plugins/global-fixtures/global-setup-teardown.fixture.js
  159. +6 −0 test/integration/fixtures/plugins/global-fixtures/global-setup.fixture.js
  160. +5 −0 test/integration/fixtures/plugins/global-fixtures/global-teardown.fixture.js
  161. +1 −0 test/integration/fixtures/plugins/root-hooks/esm/package.json
  162. +8 −0 test/integration/fixtures/plugins/root-hooks/esm/root-hook-defs-esm.fixture.js
  163. +16 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-a.fixture.js
  164. +36 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-b.fixture.js
  165. +16 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-c.fixture.js
  166. +36 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-d.fixture.js
  167. +8 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js
  168. +8 −0 test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm.fixture.mjs
  169. +6 −0 test/integration/fixtures/plugins/root-hooks/root-hook-test-2.fixture.js
  170. +6 −0 test/integration/fixtures/plugins/root-hooks/root-hook-test.fixture.js
  171. +9 −0 test/integration/fixtures/timeout-override.fixture.js
  172. +5 −4 test/integration/fixtures/uncaught/listeners.fixture.js
  173. +519 −206 test/integration/helpers.js
  174. +2 −2 test/integration/hook-err.spec.js
  175. +2 −2 test/integration/hooks.spec.js
  176. +33 −13 test/integration/init.spec.js
  177. +86 −59 test/integration/multiple-done.spec.js
  178. +104 −0 test/integration/multiple-runs.spec.js
  179. +21 −9 test/integration/options/exit.spec.js
  180. +26 −2 test/integration/options/extension.spec.js
  181. +70 −35 test/integration/options/forbidOnly.spec.js
  182. +0 −26 test/integration/options/help.spec.js
  183. +34 −0 test/integration/options/jobs.spec.js
  184. +8 −49 test/integration/options/opts.spec.js
  185. +562 −0 test/integration/options/parallel.spec.js
  186. +146 −148 test/integration/options/watch.spec.js
  187. +47 −76 test/integration/pending.spec.js
  188. +293 −0 test/integration/plugins/global-fixtures.spec.js
  189. +298 −0 test/integration/plugins/root-hooks.spec.js
  190. +2 −2 test/integration/retries.spec.js
  191. +11 −0 test/integration/timeout.spec.js
  192. +0 −1 test/jsapi/index.js
  193. +184 −0 test/node-unit/buffered-worker-pool.spec.js
  194. +46 −32 test/node-unit/cli/config.spec.js
  195. +1 −0 test/node-unit/cli/fixtures/bad-module.fixture.js
  196. +19 −21 test/node-unit/cli/node-flags.spec.js
  197. +115 −304 test/node-unit/cli/options.spec.js
  198. +82 −35 test/node-unit/cli/run-helpers.spec.js
  199. 0 test/node-unit/fixtures/dumb-module.fixture.js
  200. 0 test/node-unit/fixtures/dumber-module.fixture.js
  201. +1 −0 test/node-unit/fixtures/wonky-reporter.fixture.js
  202. +347 −49 test/node-unit/mocha.spec.js
  203. +710 −0 test/node-unit/parallel-buffered-runner.spec.js
  204. +228 −0 test/node-unit/reporters/parallel-buffered.spec.js
  205. +543 −0 test/node-unit/serializer.spec.js
  206. +49 −0 test/node-unit/utils.spec.js
  207. +235 −0 test/node-unit/worker.spec.js
  208. +0 −127 test/only/bdd.spec.js
  209. +0 −75 test/only/qunit.spec.js
  210. +0 −127 test/only/tdd.spec.js
  211. +0 −10 test/opts/mocha.opts
  212. +0 −11 test/opts/opts.spec.js
  213. +12 −16 test/reporters/base.spec.js
  214. +16 −0 test/reporters/doc.spec.js
  215. +14 −16 test/reporters/dot.spec.js
  216. +2 −0 test/reporters/helpers.js
  217. +17 −1 test/reporters/json-stream.spec.js
  218. +48 −19 test/reporters/json.spec.js
  219. +11 −13 test/reporters/landing.spec.js
  220. +13 −15 test/reporters/list.spec.js
  221. +21 −26 test/reporters/nyan.spec.js
  222. +13 −18 test/reporters/progress.spec.js
  223. +7 −9 test/reporters/spec.spec.js
  224. +6 −42 test/reporters/tap.spec.js
  225. +41 −35 test/reporters/xunit.spec.js
  226. +0 −9 test/sanity/sanity.spec.js
  227. +9 −7 test/setup.js
  228. +15 −0 test/smoke/smoke.spec.js
  229. +0 −6 test/unit/context.spec.js
  230. +135 −17 test/unit/errors.spec.js
  231. +7 −6 test/unit/hook-timeout.spec.js
  232. +44 −0 test/unit/hook.spec.js
  233. +1,084 −402 test/unit/mocha.spec.js
  234. +23 −0 test/unit/parse-query.spec.js
  235. +514 −0 test/unit/plugin-loader.spec.js
  236. +44 −69 test/unit/runnable.spec.js
  237. +992 −754 test/unit/runner.spec.js
  238. +521 −487 test/unit/suite.spec.js
  239. +43 −5 test/unit/test.spec.js
  240. +1 −0 test/unit/throw.spec.js
  241. +3 −9 test/unit/timeout.spec.js
  242. +183 −126 test/unit/utils.spec.js
12 changes: 12 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node >= 10
last 2 Chrome versions
last 2 Edge versions
last 2 Firefox versions
last 2 Safari versions
last 2 Opera versions
unreleased Chrome versions
unreleased Edge versions
unreleased Firefox versions
unreleased Safari versions
unreleased Opera versions
IE 11
20 changes: 17 additions & 3 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
'use strict';

module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(
require('@11ty/eleventy-plugin-inclusive-language'),
{
words:
'simply,obviously,basically,of course,clearly,everyone knows,however,easy'
}
);

eleventyConfig.addPassthroughCopy('docs/css');
eleventyConfig.addPassthroughCopy('docs/js');
eleventyConfig.addPassthroughCopy('docs/images');
eleventyConfig.addPassthroughCopy('docs/CNAME');
eleventyConfig.addPassthroughCopy('docs/_headers');
eleventyConfig.addPassthroughCopy('docs/favicon.ico');

eleventyConfig.addPassthroughCopy('docs/example');
eleventyConfig.addPassthroughCopy('docs/api/images');
eleventyConfig.addPassthroughCopy('docs/api/scripts');
eleventyConfig.addPassthroughCopy('docs/api/styles');

/* Markdown Plugins */
const markdown = require('markdown-it')({
html: true,
linkify: true
linkify: true,
typographer: true
});

markdown.use(require('markdown-it-anchor'), {
@@ -31,13 +42,16 @@ module.exports = function(eleventyConfig) {

markdown.use(require('markdown-it-prism'));

markdown.use(require('markdown-it-emoji'));

eleventyConfig.setLibrary('md', markdown);

eleventyConfig.setUseGitIgnore(false);

return {
passthroughFileCopy: true,
dir: {
input: 'docs',
includes: '_includes',
output: 'docs/_site'
}
};
6 changes: 5 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
coverage/
mocha.js
*.fixture.js
docs/
docs/_site
docs/api
docs/_dist
docs/example
out/
!lib/mocha.js
test/integration/fixtures
!.*.js
*.min.js
36 changes: 20 additions & 16 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -5,8 +5,9 @@ extends:
env:
node: true
browser: true
es6: true
parserOptions:
ecmaVersion: 5
ecmaVersion: 2018
ecmaFeatures:
jsx: false
sourceType: script
@@ -16,23 +17,27 @@ rules:
- safe
overrides:
- files:
- scripts/**/*.js
- package-scripts.js
- karma.conf.js
- .wallaby.js
- .eleventy.js
- bin/*
- lib/cli/**/*.js
- test/node-unit/**/*.js
- test/integration/options/watch.spec.js
- test/integration/helpers.js
- lib/growl.js
parserOptions:
ecmaVersion: 2017
- 'docs/js/**/*.js'
env:
node: false
- files:
- '.eleventy.js'
- '.wallaby.js'
- 'package-scripts.js'
- 'karma.conf.js'
- 'bin/*'
- 'docs/_data/**/*.js'
- 'lib/cli/**/*.js'
- 'lib/nodejs/**/*.js'
- 'scripts/**/*.js'
- 'test/**/*.js'
- 'test/node-unit/**/*.js'
env:
browser: false
- files:
- esm-utils.js
- rollup.config.js
- scripts/pick-from-package-json.js
parserOptions:
ecmaVersion: 2018
sourceType: module
@@ -79,11 +84,10 @@ overrides:
# disallow property access of `global.<timer>.*`
- selector: '*[object.object.name=global][object.property.name=/(Date|(set|clear)(Timeout|Immediate|Interval))/]:expression'
message: *GH-237

- files:
- test/**/*.mjs
parserOptions:
ecmaVersion: 2017
ecmaVersion: 2018
sourceType: module

- files:
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -91,4 +91,4 @@ For reporting issues in spaces managed by the OpenJS Foundation, for example, re
The OpenJS Foundation maintains a Code of Conduct Panel (CoCP). This is a foundation-wide team established to manage escalation when a reporter believes that a report to a member project or the CPC has not been properly handled. In order to escalate to the CoCP send an email to `"coc-escalation@lists.openjsf.org`.

For more information, refer to the full
[Code of Conduct governance document](https://github.com/openjs-foundation/bootstrap/blob/master/proposals/stage-1/CODE_OF_CONDUCT/FOUNDATION_CODE_OF_CONDUCT_REQUIREMENTS.md).
[Code of Conduct governance document](https://github.com/openjs-foundation/cross-project-council/blob/master/FOUNDATION_CODE_OF_CONDUCT_REQUIREMENTS.md).
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [

> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start <command>` (powered by [nps](https://npm.im/nps)).
1. [Install Node.js 8.x or newer](https://nodejs.org/en/download/).
1. [Install Node.js 10.12.0 or newer](https://nodejs.org/en/download/).
- If you're new to installing Node, a tool like [nvm](https://github.com/creationix/nvm#install-script) can help you manage multiple version installations.
- You will need [Google Chrome](https://www.google.com/chrome/) to run browser-based tests locally.
1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo/) on setting up Git, forking and cloning.
@@ -58,7 +58,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [
- Keep your PR focused. Don't fix two things at once; don't upgrade dependencies unless necessary.
1. Before committing, run `npm start test`.
- This will run both Node.js-based and browser-based tests.
- Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha)). The first step to ensuring these checks pass is to test on your own machine.
- Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Windows+CI%22)). The first step to ensuring these checks pass is to test on your own machine.
- A coverage check will be sent to [Coveralls](https://coveralls.io/github/mochajs/mocha). **A drop in code coverage % is considered a failed check**.
1. Commit your changes.
- Use a brief message on the first line, referencing a relevant issue (e.g. `closes #12345`).
@@ -91,7 +91,7 @@ _Excellent._ Here's how:
- **Can you write ~~good~~ well?** The [documentation](https://mochajs.org) almost always needs some love. See the [doc-related issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3Adocumentation).
- **Design your thing?** [Our site](https://mochajs.org) needs your magic touch.
- **Familiar with Mocha's codebase?** We could use your help triaging issues and/or reviewing pull requests. Please contact an [org member](https://github.com/orgs/mochajs/people), and we'll chat.
- **Want to build our community?** Mocha has a _lot_ of users. We could use your help bringing everyone together in peace and harmony. Please contact an [org member](https://github.com/mochajs/people).
- **Want to build our community?** Mocha has a _lot_ of users. We could use your help bringing everyone together in peace and harmony. Please contact an [org member](https://github.com/orgs/mochajs/people).
- **You can sell dirt to worms?** Let's raise Mocha's profile in the JavaScript and OSS communities. Please contact an [org member](https://github.com/orgs/mochajs/people)!
- **Wait--you write unit tests for _fun_?** A PR which increases coverage is unlikely to be turned down.
- **Are you experienced?** :guitar: If you're a seasoned Mocha user, why not help answer some questions in the [main chat room](https://gitter.im/mochajs/mocha)?
202 changes: 202 additions & 0 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
name: Tests
'on':
push:
pull_request:
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
runs-on: ubuntu-latest
outputs:
HEAD_COMMIT_MSG: '${{ steps.commitMsg.outputs.HEAD_COMMIT_MSG }}'
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 }}"'

smoke:
name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]'
needs: check-skip
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
- run: npm install --production
- run: npm run test:smoke

eslint:
name: ESLint Check
runs-on: ubuntu-latest
needs: smoke
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.2
with:
issueSummary: false
npmInstall: false

markdown:
name: Markdown Check
runs-on: ubuntu-latest
needs: smoke
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'
key: "ubuntu-latest-node-v14-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-v14-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: 'Check Markdown'
run: npm start lint.markdown

test-node:
name: 'Node.js [v${{ matrix.node }} / ${{ matrix.os }}]'
needs: smoke
runs-on: '${{ matrix.os }}'
env:
NODE_OPTIONS: '--trace-warnings'
strategy:
matrix:
os:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
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..."
mkdir GrowlInstaller | out-null
$seaURL =
"https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe"
$seaPath = "GrowlInstaller\GrowlInstaller.exe"
$webclient = New-Object Net.WebClient
$webclient.DownloadFile($seaURL, $seaPath)
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
- name: Install libnotify-bin (Linux)
if: "${{ matrix.os == 'ubuntu-latest' }}"
run: sudo apt-get install libnotify-bin
- uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v2
- name: 'Cache node_modules (Linux)'
if: "${{ matrix.os != 'windows-2019' }}"
uses: actions/cache@v2
with:
path: '~/.npm'
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-
- 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 }}'
16 changes: 16 additions & 0 deletions .github/workflows/nightly-site-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Deploy `mochajs.org` branch nightly by hitting a netlify build URL.
# This updates the list of supporters

name: Nightly mochajs.org Deploy
on:
schedule:
- cron: '0 0 * * *'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Webhook Action
uses: joelwmale/webhook-action@1.0.0
env:
data: ''
WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }}
Loading