Skip to content

Commit

Permalink
refactor!: drop support of 'growl' notification (#4866)
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba authored Apr 15, 2022
1 parent 3946453 commit ac81cc5
Show file tree
Hide file tree
Showing 13 changed files with 1,015 additions and 1,352 deletions.
74 changes: 11 additions & 63 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- '**'
- '!mochajs.org'
tags-ignore:
- '**'
pull_request:
Expand All @@ -12,16 +13,16 @@ on:
- reopened

jobs:
prevent-run-twice:
name: Prevent to run twice
prevent-double-run:
name: Prevent double run
runs-on: ubuntu-latest
# 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:
- run: 'echo run Tests'
smoke:
name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]'
needs: prevent-run-twice
needs: prevent-double-run
runs-on: '${{ matrix.os }}'
strategy:
matrix:
Expand Down Expand Up @@ -82,72 +83,19 @@ jobs:
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@v2
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v2
- name: 'Cache node_modules (Linux)'
if: "${{ matrix.os != 'windows-2019' }}"
- name: Get npm cache directory in Windows
id: npm-cache
if: "${{ matrix.os == 'windows-2019' }}"
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }}
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-
Expand Down
Binary file removed assets/growl/error.png
Binary file not shown.
Binary file removed assets/growl/ok.png
Binary file not shown.
79 changes: 1 addition & 78 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in
- [async test timeout support](#delayed-root-suite)
- [test retry support](#retry-tests)
- [test-specific timeouts](#test-level)
- [Growl support](#desktop-notification-support)
- [reports test durations](#test-duration)
- [highlights slow tests](#dot-matrix)
- [file watcher support](#min)
Expand Down Expand Up @@ -999,12 +998,6 @@ Enable "full" stack traces. By default, Mocha attempts to distill stack traces i

This flag is helpful when debugging a suspected issue within Mocha or Node.js itself.

### `--growl, -G`

Enable [Growl][] (or OS-level notifications where available).

Requires extra software to be installed; see the [growl module's docs][npm-growl] for more information.

### `--inline-diffs`

Enable "inline" diffs, an alternative output for diffing strings.
Expand Down Expand Up @@ -2191,71 +2184,6 @@ The HTML reporter is the default reporter when running Mocha in the browser. It

[Mochawesome][npm-mochawesome] is a great alternative to the default HTML reporter.

## Desktop Notification Support

Desktop notifications allow asynchronous communication of events without
forcing you to react to a notification immediately. Their appearance
and specific functionality vary across platforms. They typically disappear
automatically after a short delay, but their content is often stored in some
manner that allows you to access past notifications.

[Growl][] was an early notification system implementation for OS X and Windows,
hence, the name of Mocha's `--growl` option.

Once enabled, when your root suite completes test execution, a desktop
notification should appear informing you whether your tests passed or failed.

### Node-based notifications

In order to use desktop notifications with the command-line interface (CLI),
you **must** first install some platform-specific prerequisite software.
Instructions for doing so can be found [here][mocha-wiki-growl].

Enable Mocha's desktop notifications as follows:

```bash
$ mocha --growl
```

### Browser-based notifications

Web notification support is being made available for current versions of
modern browsers. Ensure your browser version supports both
[promises][caniuse-promises] and [web notifications][caniuse-notifications].
As the Notification API evolved over time, **do not expect** the minimum
possible browser version to necessarily work.

Enable Mocha's web notifications with a slight modification to your
client-side mocha HTML. Add a call to `mocha.growl()` prior to running your
tests as shown below:

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mocha Tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>

<script src="https://unpkg.com/chai/chai.js"></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>

<script class="mocha-init">
mocha.setup('bdd');
mocha.growl(); // <-- Enables web notifications
</script>
<script src="test.spec.js"></script>
<script class="mocha-exec">
mocha.run();
</script>
</body>
</html>
```

## Configuring Mocha (Node.js)

> _New in v6.0.0_
Expand Down Expand Up @@ -2422,8 +2350,7 @@ $ npm test

In addition to chatting with us on [Gitter][gitter-mocha], for additional information such as using
spies, mocking, and shared behaviours be sure to check out the [Mocha Wiki][mocha-wiki] on GitHub.
For discussions join the [Google Group][google-mocha]. For a running example of Mocha, view
[example/tests.html](example/tests.html). For the JavaScript API, view the [API documentation](api/)
For a running example of Mocha, view [example/tests.html](example/tests.html). For the JavaScript API, view the [API documentation](api/)
or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).

[//]: # 'Cross reference section'
Expand Down Expand Up @@ -2452,8 +2379,6 @@ or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).
[gist-async-hooks]: https://git.io/vdlNM
[gist-globbing-tutorial]: https://gist.github.com/reggi/475793ea1846affbcfe8
[gitter-mocha]: https://gitter.im/mochajs/mocha
[google-mocha]: https://groups.google.com/group/mochajs
[growl]: http://growl.info/
[jetbrains]: https://www.jetbrains.com/
[jetbrains-plugin]: https://www.jetbrains.com/idea/features/nodejs.html
[mdn-array-sort]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
Expand All @@ -2467,7 +2392,6 @@ or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).
[mocha-website]: https://mochajs.org/
[mocha-wiki]: https://github.com/mochajs/mocha/wiki
[mocha-wiki-compilers]: https://github.com/mochajs/mocha/wiki/compilers-deprecation
[mocha-wiki-growl]: https://github.com/mochajs/mocha/wiki/Growl-Notifications
[mocha-wiki-more-reporters]: https://github.com/mochajs/mocha/wiki/Third-party-reporters
[node.js]: https://nodejs.org/
[node-assert]: https://nodejs.org/api/assert.html
Expand All @@ -2477,7 +2401,6 @@ or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).
[npm-babel-register]: https://npm.im/@babel/register
[npm-chai-as-promised]: https://www.npmjs.com/package/chai-as-promised
[npm-glob]: https://www.npmjs.com/package/glob
[npm-growl]: https://npm.im/growl
[npm-mocha-lcov-reporter]: https://npm.im/mocha-lcov-reporter
[npm-mochawesome]: https://npm.im/mochawesome
[npm-should.js]: https://npm.im/should
Expand Down
Loading

0 comments on commit ac81cc5

Please sign in to comment.