Registry / testing / d2l-test-reporting

d2l-test-reporting

JSON →
library5.0.1jsnpmunverified

This package provides helper utilities and custom reporters for integrating various JavaScript testing frameworks with the D2L test reporting framework. Currently at version 5.0.1, it receives frequent updates, often with bug fixes and occasional major version bumps primarily driven by Node.js engine support changes. Key differentiators include its specialized reporters for popular tools like Mocha, Playwright, `@web/test-runner`, and WebdriverIO, which streamline the process of generating test reports in a format compatible with D2L's internal reporting infrastructure. It is designed to work in conjunction with a companion D2L GitHub Action for uploading these reports to a centralized dashboard. The package is specifically targeted for Node.js environments and expects modern ES Module syntax.

npm install d2l-test-reporting
INSTALL
IMPORT
SIG · D2L-TEST-REPORTING
D
d2l-test-reporting
testingjavascriptv5.0.1
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.

reporter
import { reporter } from 'd2l-test-reporting/reporters/web-test-runner.js';
const { reporter } = require('d2l-test-reporting/reporters/web-test-runner.js');
Named import for the Web Test Runner reporter. This package primarily uses ES Module syntax and requires Node.js >=22.
Playwright Reporter Module
import 'd2l-test-reporting/reporters/playwright.js';
const PlaywrightReporter = require('d2l-test-reporting/reporters/playwright.js');
The Playwright reporter is commonly referenced as a string path within `playwright.config.js` for configuration, but can be imported as an ES Module directly if needed. Node.js >=22 is required.
Mocha Reporter Path
reporter: 'd2l-test-reporting/reporters/mocha.js'
import { MochaReporter } from 'd2l-test-reporting/reporters/mocha.js';
The Mocha reporter is typically configured by specifying its string path in a `.mocharc.js` configuration file, rather than being imported directly into a JavaScript file.

Configures Playwright to use the `d2l-test-reporting` reporter, specifying output paths for reports and a D2L-specific configuration file for mapping test metadata.

import { defineConfig, devices } from '@playwright/test'; import path from 'path'; const reportPath = path.resolve(process.cwd(), './d2l-test-report.json'); const reportConfigPath = path.resolve(process.cwd(), './d2l-test-reporting.config.json'); export default defineConfig({ // Configure projects for different browsers or environments projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] }, testMatch: 'test/*.test.ts' // Adjust based on your test file location }], // Look for test files in the 'test' directory, relative to this config file. testDir: './test', // Each test is given 30 seconds to complete. timeout: 30 * 1000, // Reporter to use, integrating the D2L reporter alongside the default 'list' reporter. reporter: [ [ 'd2l-test-reporting/reporters/playwright.js', { reportPath: reportPath, // Optional: Path to output the D2L report reportConfigurationPath: reportConfigPath // Optional: Path to D2L test mapping config } ], ['list'] // Also use the default 'list' reporter for console output ], // Output directory for Playwright's test results. outputDir: './test-results/', }); // Example content for d2l-test-reporting.config.json (create this file): /* { "testMapping": { "my-playwright-test-suite-id": { "type": "e2e", "experience": "WebApp", "tool": "Playwright" }, "another-test-group": { "type": "integration", "experience": "LMS", "tool": "Playwright" } } } */
Debug
Known issues
breakingVersion 5.0.0 of `d2l-test-reporting` initially dropped support for Node.js versions 20 and 22. While version 5.0.1 re-enabled support for Node.js 22, Node.js 20 remains unsupported.
fix
Ensure your Node.js environment is version 22 or higher when using `d2l-test-reporting@5.x.x`. Upgrade Node.js if necessary (e.g., using `nvm install 22 && nvm use 22`).
affects: >=5.0.0
gotchaThe Playwright `merge-reports` command is not fully supported with `d2l-test-reporting`'s Playwright reporter due to a lack of browser/launcher information preservation with Playwright's `blob` reporter. This can lead to partial data in the reporting dashboard, especially when using GitHub matrix runs.
fix
Be aware of this limitation; for comprehensive data across matrix runs, manual aggregation or alternative reporting strategies might be necessary, or consider using single-browser runs if complete data per run is critical.
affects: >=4.0.0
gotchaVersion 4.2.2 included a revert of a fix for 'negative duration issues,' which suggests that problems with incorrect or negative test duration calculations might occur or have recurred in certain scenarios.
fix
Monitor your generated reports for unusual or negative test duration values. If consistent issues arise, investigate the specific test conditions or consider using a version prior to 4.2.2 if the reverted fix was critical for your use case.
affects: >=4.2.2
Errors
Common errors & fixes
Error: This module requires Node.js version 22 or higher. Your current Node.js version is X.
The package is being run in a Node.js environment that does not meet the minimum version requirement (>=22) for `d2l-test-reporting@5.x.x`.
fix
Update your Node.js environment to version 22 or newer. You can use a tool like `nvm` (Node Version Manager) to manage multiple Node.js versions easily: `nvm install 22 && nvm use 22`.
Error: Cannot find module 'd2l-test-reporting/reporters/playwright.js' from 'path/to/your/playwright.config.js'
The module path for the reporter is incorrect, the `d2l-test-reporting` package is not installed, or there is an attempt to `require()` an ES Module in a CommonJS context without proper transpilation.
fix
First, ensure `d2l-test-reporting` is installed: `npm install d2l-test-reporting`. Verify that the reporter path in your configuration file (e.g., `playwright.config.js`) exactly matches the provided path. If using a CommonJS setup, consider switching your project to ES Modules or using dynamic `import()` for the reporter if supported by your test runner's configuration.
Upgrade
Version history
5.0.1latest on npm
Audit
Dependencies
webdriveriooptionalRuntime dependency for the optional WebdriverIO custom reporter functionality, introduced in v4.3.0.
Agent activity
6 hits · last 30 days
node
6
Resources
d2l-test-reporting — npm install d2l-test-reporting · libregistry