QUnit Test Output Parser

0.2.0 · abandoned · verified Sun Apr 19

The `qunit-parser` package is a JavaScript utility designed to parse the raw text output from the QUnit testing framework, aiming to provide a structured, programmatic representation of test results. Currently at version 0.2.0, this package was last published approximately seven years ago, indicating it is an abandoned project with no ongoing maintenance or updates. It is not affiliated with the core QUnit testing framework itself but rather serves a niche function for processing CLI or log output. Due to its age, users should be aware of potential incompatibilities with newer QUnit versions or modern JavaScript environments. Its release cadence is non-existent, and its primary utility lies in attempting to extract data from QUnit's console output where other programmatic interfaces might not be feasible.

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `qunit-parser` and use it to process a simulated QUnit console output string, showing the structured data that can be extracted.

const { parse } = require('qunit-parser');

// Simulate a simplified QUnit console output string
const qunitOutput = `
Running 2 tests
ok 1 - My Module > Test 1: should pass
# pass 1
# fail 0
not ok 2 - My Module > Test 2: should fail an assertion
# test timed out
# {
#   "name": "My Module > Test 2: should fail an assertion",
#   "passed": 0,
#   "failed": 1,
#   "total": 1,
#   "duration": 50,
#   "errors": ["Assertion failed: expected true, got false"],
#   "seed": "12345"
# }
1..2
# tests 2
# pass 1
# fail 1
`;

try {
    const parsedResults = parse(qunitOutput);
    console.log('Parsed QUnit Results:');
    console.log(JSON.stringify(parsedResults, null, 2));
    // Example of accessing parsed data
    console.log(`Total tests: ${parsedResults.total}`);
    console.log(`Passed tests: ${parsedResults.passed}`);
    console.log(`Failed tests: ${parsedResults.failed}`);
    if (parsedResults.failures && parsedResults.failures.length > 0) {
        console.log('Details of first failure:', parsedResults.failures[0]);
    }
} catch (error) {
    console.error('Error parsing QUnit output:', error.message);
}

view raw JSON →