Registry / testing / qunit-notifications

qunit-notifications

JSON →
library1.0.0jsnpmunverified

qunit-notifications is a QUnit plugin that integrates Web Notification API support directly into your QUnit test suite, providing immediate desktop notifications for test results. When enabled, it adds a 'Notifications' checkbox to the QUnit toolbar and displays a system notification upon test completion, detailing whether the tests passed or failed. This feature is particularly useful for developers who prefer to stay in their IDE without constantly switching back to the browser to check test outcomes. The package currently stands at version 1.0.0, released in 2014, and does not appear to have an active release cadence, suggesting it is no longer actively maintained. Its primary differentiator is its direct, simple integration with the global QUnit object to augment its UI and provide system-level feedback, contrasting with more modern, CLI-based test runners or browser automation tools.

npm install qunit-notifications
INSTALL
IMPORT
SIG · QUNIT-NOTIFICATION
Q
qunit-notifications
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

notifications
QUnit.notifications();
import { notifications } from 'qunit-notifications';
This package augments the global `QUnit` object, not through standard ES module or CommonJS imports. Ensure `qunit.js` is loaded before this script.
NotificationsOptions
QUnit.notifications({ timeout: 5000, titles: { passed: 'It worked!', failed: 'Fix your code!' } });
Configuration is passed as an options object directly to the `QUnit.notifications()` function call.

This quickstart demonstrates how to include QUnit and the qunit-notifications plugin in an HTML page, then initialize notifications with custom titles and body messages, followed by example QUnit tests.

<!-- Include QUnit in your HTML test runner --> <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.20.0.css"> <script src="https://code.jquery.com/qunit/qunit-2.20.0.js"></script> <!-- Include qunit-notifications after QUnit --> <script src="path/to/qunit-notifications.js"></script> <div id="qunit"></div> <div id="qunit-fixture"></div> <script> // Initialize QUnit Notifications with custom options QUnit.notifications({ timeout: 6000, titles: { passed: 'Tests All Good!', failed: 'Uh oh, tests failed!' }, bodies: { passed: '{{passed}} of {{total}} assertions passed in {{runtime}}ms.', failed: '{{failed}} assertions failed out of {{total}}.' } }); // Example QUnit tests QUnit.module('My Awesome Module'); QUnit.test('a basic test example', function(assert) { assert.expect(1); assert.ok(true, 'This test should pass.'); }); QUnit.test('another test that might fail', function(assert) { assert.expect(2); let value = 'test'; assert.equal(value, 'test', 'Value should be "test".'); assert.equal(1, 2, 'This assertion will fail.'); // Intentional failure }); </script>
Debug
Known issues
breakingThis package predates modern JavaScript module systems (ESM, CJS) and expects QUnit to be a global object. It will not work with `import` or `require` statements directly without a global QUnit instance.
fix
Ensure `qunit.js` is loaded as a script tag before `qunit-notifications.js` in a browser environment to expose the global `QUnit` object.
affects: >=1.0.0
gotchaWeb Notifications require user permission. The notification will not appear if the browser denies permission or if the user has not granted it previously. Modern browsers may also block notifications from non-secure (HTTP) origins.
fix
Ensure your testing environment is served over HTTPS to avoid browser restrictions on Web Notifications. Users must explicitly grant notification permissions when prompted by the browser.
affects: >=1.0.0
gotchaThe package is effectively unmaintained since its last release in 2014. It may have compatibility issues with very recent browser versions or newer QUnit releases, and will not receive security patches or new features.
fix
Consider migrating to more actively maintained testing tools or notification solutions if encountering compatibility issues or requiring modern features/security updates. If remaining with this package, thorough testing across target browsers and QUnit versions is recommended.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: QUnit.notifications is not a function
`qunit-notifications.js` was loaded before `qunit.js`, or `QUnit` global object is not available.
fix
Ensure `qunit.js` script tag is placed in your HTML before the `qunit-notifications.js` script tag.
Notification permission denied.
The browser or user explicitly denied permission for Web Notifications, or the test page is served over an insecure HTTP connection.
fix
Ensure your test runner is served over HTTPS. The user must manually grant notification permissions when prompted by the browser. Check browser settings for notification permissions.
ReferenceError: QUnit is not defined
The QUnit library has not been loaded in the browser environment.
fix
Add a script tag to include the QUnit library (e.g., `https://code.jquery.com/qunit/qunit-2.20.0.js`) in your HTML before attempting to use `QUnit.notifications()`.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
qunitrequiredThis package is a QUnit plugin and directly extends the QUnit global object, requiring QUnit to be loaded in the environment.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
qunit-notifications — npm install qunit-notifications · libregistry