{"id":28383,"library":"test-helpr","title":"test-helpr","description":"A collection of miscellaneous test helper functions for Node.js, version 0.3.2. Provides lightweight utilities to simplify common testing patterns. The package is minimal and has no dependencies, making it easy to integrate. It is released sporadically, with no active development since 2020. Differentiators include simplicity and zero external dependencies compared to larger testing libraries like Jest or Mocha.","status":"maintenance","version":"0.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/tony-kerz/node-test-helpr","tags":["javascript"],"install":[{"cmd":"npm install test-helpr","lang":"bash","label":"npm"},{"cmd":"yarn add test-helpr","lang":"bash","label":"yarn"},{"cmd":"pnpm add test-helpr","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v0.3.0","wrong":"const createMockContext = require('test-helpr')","symbol":"createMockContext","correct":"import { createMockContext } from 'test-helpr'"},{"note":"Not a default export; must use named import.","wrong":"import mockFn from 'test-helpr'","symbol":"mockFn","correct":"import { mockFn } from 'test-helpr'"},{"note":"Use ESM import in modern Node.js (>=12).","wrong":"const { stubConsole } = require('test-helpr')","symbol":"stubConsole","correct":"import { stubConsole } from 'test-helpr'"}],"quickstart":{"code":"import { createMockContext, mockFn, stubConsole } from 'test-helpr';\n\n// Create a mock context\nconst ctx = createMockContext();\n\n// Create a mock function\nconst mock = mockFn();\nmock('arg');\nconsole.log(mock.calls); // [['arg']]\n\n// Stub console.log\nconst restore = stubConsole();\nconsole.log('test');\nconsole.log(console.output); // ['test']\nrestore();","lang":"javascript","description":"Demonstrates importing and using three main helpers: createMockContext, mockFn, and stubConsole."},"warnings":[{"fix":"Use import syntax: import { ... } from 'test-helpr'","message":"ESM-only since version 0.3.0; CommonJS require() no longer supported.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Consider migrating to a more actively maintained library like sinon.","message":"Functions may have undocumented side effects; no active maintenance.","severity":"deprecated","affected_versions":"<=0.3.2"},{"fix":"Reset mock.calls = [] in beforeEach or afterEach.","message":"mockFn does not reset calls between test cases; manual reset needed.","severity":"gotcha","affected_versions":"<=0.3.2"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run npm install test-helpr and use import syntax.","cause":"Package not installed or ESM-only require attempt.","error":"Cannot find module 'test-helpr'"},{"fix":"Use import { ... } from 'test-helpr' instead of import testHelpr from 'test-helpr'.","cause":"Trying to default import from a package that only has named exports.","error":"The requested module 'test-helpr' does not provide an export named 'default'"},{"fix":"Replace require() with import, or use dynamic import() if necessary.","cause":"Using require() with an ESM-only package.","error":"Error: Cannot find module 'test-helpr' require() of ES Module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}