{"id":12960,"library":"cleaner-spec-reporter","title":"Cleaner Spec Reporter for Node.js","description":"cleaner-spec-reporter is a test reporter for Node.js's native test runner, providing a more refined and visually clean output compared to the default 'spec' reporter. It is designed to integrate seamlessly with the `node --test` command-line interface. The package is currently stable at version 1.0.3, with recent releases focusing on type import sanitization and minor fixes. A significant breaking change occurred in version 1.0.0, which dropped support for Node.js 20, now requiring Node.js 22.21.0 or higher. This library is ESM-only for direct programmatic imports. Its primary differentiator is its focus on enhancing the readability of test results in the terminal through improved formatting and coloring, aiming to streamline the developer experience during testing and CI workflows.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/ShogunPanda/cleaner-spec-reporter","tags":["javascript","test","spec","typescript"],"install":[{"cmd":"npm install cleaner-spec-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add cleaner-spec-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add cleaner-spec-reporter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is ESM-only. The main reporter class is a named export. Direct programmatic import is typically for custom test runner integrations or extensions, as the primary use is via the `node --test` CLI flag.","wrong":"const CleanerSpecReporter = require('cleaner-spec-reporter');","symbol":"CleanerSpecReporter","correct":"import { CleanerSpecReporter } from 'cleaner-spec-reporter';"},{"note":"Type-only import for defining reporter options, useful when creating custom reporter wrappers or adhering to the reporter interface programmatically.","symbol":"ReporterOptions","correct":"import type { ReporterOptions } from 'cleaner-spec-reporter';"}],"quickstart":{"code":"{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"test\": \"node --test --test-reporter=cleaner-spec-reporter\"\n  }\n}\n\n// Add a simple test file (e.g., test/example.test.js)\n// import { test, mock } from 'node:test';\n// import assert from 'node:assert';\n//\n// test('synchronous passing test', () => {\n//   assert.strictEqual(1, 1);\n// });\n//\n// test('passing test with async/await', async () => {\n//   await new Promise(resolve => setTimeout(resolve, 10));\n//   assert.ok(true);\n// });\n//\n// test('failing test', () => {\n//   assert.deepStrictEqual({ a: 1 }, { a: 2 });\n// });\n\nconsole.log('To run tests, make sure you have a package.json with the above script and test files in a \"test\" directory.');\nconsole.log('Then run: npm test');","lang":"typescript","description":"Demonstrates setting up cleaner-spec-reporter as the default test reporter in your `package.json` for Node.js's native test runner."},"warnings":[{"fix":"Upgrade your Node.js runtime to version 22.21.0 or newer. Consider using a Node.js version manager like `nvm` or `volta` to manage multiple Node.js versions.","message":"Version 1.0.0 dropped support for Node.js 20. Users must upgrade their Node.js environment to version 22.21.0 or higher to use this package.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your project is configured for ESM (e.g., `\"type\": \"module\"` in `package.json`) if you plan to import it programmatically. For CLI usage, simply ensure Node.js is configured to run your tests in an ESM context if your test files are ESM.","message":"This package is explicitly designed as an ESM-only module. Attempting to `require()` it in a CommonJS context will result in an error.","severity":"gotcha","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Convert your consuming module to ES Module format (e.g., add `\"type\": \"module\"` to `package.json` and use `import`) or ensure you are only using the package via the Node.js CLI `--test-reporter` flag in an ESM-compatible test setup.","cause":"Attempting to import cleaner-spec-reporter using `require()` in a CommonJS module.","error":"ERR_REQUIRE_ESM: Must use import to load ES Module:"},{"fix":"Verify your Node.js version is 22.21.0 or newer. Reinstall the package (`npm install cleaner-spec-reporter`) to ensure integrity. Check your project's `package.json` for `\"type\": \"module\"` if your test files are ESM.","cause":"This error often indicates that the Node.js version being used is older than the minimum required version (v22.21.0) or there's an issue with module resolution or package installation.","error":"Test reporter \"cleaner-spec-reporter\" is not a valid module."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}