{"id":14970,"library":"test-report","title":"Basic Test Report Generator","description":"The `test-report` package is a minimalist utility designed to generate test reports, originally published over a decade ago in 2011. Currently at version 1.1.2, it has not received updates for 15 years, strongly indicating it is an abandoned project. Its primary function, inferred from its name and typical utilities from its era, is likely to consume raw test outcome data and format it into a readable string report, possibly for console output or simple file storage. Due to its age and lack of maintenance, it is exclusively CommonJS-based and does not provide native ESM support. While its simplicity might appeal for highly specific, legacy Node.js environments, its unmaintained status and the publisher's past involvement in a significant supply-chain attack (the `event-stream` incident) raise considerable concerns about security and ongoing compatibility. There is no official README, so its exact API and intended use cases must be inferred.","status":"abandoned","version":"1.1.2","language":"javascript","source_language":"en","source_url":"git://github.com/dominictarr/test-report","tags":["javascript"],"install":[{"cmd":"npm install test-report","lang":"bash","label":"npm"},{"cmd":"yarn add test-report","lang":"bash","label":"yarn"},{"cmd":"pnpm add test-report","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only. Use `require()` for module loading.","wrong":"import testReport from 'test-report';","symbol":"testReport","correct":"const testReport = require('test-report');"},{"note":"If the package exports specific methods, they would also be accessed via `require()` destructuring in CommonJS.","wrong":"import { generateReport } from 'test-report';","symbol":"generateReport","correct":"const { generateReport } = require('test-report');"},{"note":"If the package exports a constructor function, it would be instantiated after `require()`.","wrong":"import TestReport from 'test-report';\nconst reporter = new TestReport();","symbol":"TestReport","correct":"const TestReport = require('test-report');\nconst reporter = new TestReport();"}],"quickstart":{"code":"const testReport = require('test-report');\n\n// Simulate test results data\nconst results = [\n  { name: 'User authentication', status: 'pass', duration: 120 },\n  { name: 'Product search functionality', status: 'fail', error: 'Expected 5 products, got 3', duration: 300 },\n  { name: 'Shopping cart update', status: 'pass', duration: 80 }\n];\n\n// Imagine an options object for simple customization\nconst options = {\n  format: 'summary',\n  includeDurations: true\n};\n\n// The actual API is inferred, this assumes a function that takes results and options\n// and returns a formatted string.\ntry {\n  const report = testReport.generate(results, options);\n  console.log('--- Test Report ---\\n');\n  console.log(report);\n  console.log('\\n--- End Report ---');\n} catch (error) {\n  console.error('Failed to generate report:', error.message);\n  console.log('This package is very old and its exact API is unknown without a README.');\n  console.log('You might need to inspect the source code or use it differently.');\n}\n\n/* Example of what `testReport.generate` might output:\n\n--- Test Report ---\n\nTest Run Summary:\n\nPASS: User authentication (120ms)\nFAIL: Product search functionality (300ms) - Error: Expected 5 products, got 3\nPASS: Shopping cart update (80ms)\n\nTotal: 3 tests, 2 passed, 1 failed\n\n--- End Report ---\n*/","lang":"javascript","description":"This quickstart demonstrates how to theoretically use `test-report` by requiring it and passing simulated test results to an assumed `generate` method to produce a formatted string output. The API is inferred due to lack of documentation."},"warnings":[{"fix":"For ESM projects, use dynamic `import()` within an `async` function (`const testReport = await import('test-report');`) or configure your build system to transpile CommonJS modules.","message":"The `test-report` package is a CommonJS-only module. Attempting to import it directly using ES Module `import` syntax in an ESM project will result in a runtime error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Thoroughly review the package's source code (`node_modules/test-report`) to understand its exports and expected input/output. Consider alternatives that are actively maintained and documented.","message":"This package has not been updated in 15 years (since 2011) and lacks any official README or documentation. Its API is entirely undocumented, requiring users to infer its usage from its name or inspect its source code directly. Compatibility with modern Node.js versions or testing frameworks is not guaranteed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Exercise extreme caution. Audit the package's source code for any unusual or potentially malicious patterns. Given its abandonment, consider migrating to a actively maintained and trusted test reporting library to mitigate security vulnerabilities and ensure long-term stability.","message":"The publisher, dominictarr, was involved in the 'event-stream' supply chain attack in 2018, where a malicious dependency was introduced into a widely used package. While `test-report` itself was not implicated, relying on unmaintained packages from publishers with past security incidents carries inherent risks.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If using modern test runners, explore their native reporter options or use a purpose-built reporter for your framework. If attempting to integrate `test-report`, you will likely need to write an adapter to transform your test results into the format `test-report` expects.","message":"Given its age, `test-report` likely predates and does not integrate with modern testing frameworks (e.g., Jest, Mocha, Vitest) or their reporter interfaces. It probably expects a specific, simple input format for test results, which may not align with current standards.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your project is configured for CommonJS if using `require()`. If in an ESM project, use dynamic `import()` or find an ESM-compatible alternative. This package is CommonJS-only; `import testReport from 'test-report';` will also fail.","cause":"Attempting to `require()` an ES Module or using `import` for a CommonJS-only module.","error":"ERR_REQUIRE_ESM: require() of ES Module .../node_modules/test-report/index.js from ... not supported."},{"fix":"Without a README, the exact API is unknown. Inspect the `node_modules/test-report/index.js` file to determine what the package actually exports. It might export a single function directly (`module.exports = function(...)`) or a different object structure.","cause":"The assumed `generate` method does not exist, or `testReport` is not an object exporting multiple functions.","error":"TypeError: testReport.generate is not a function"}],"ecosystem":"npm"}