The `mocks` package (npm: `mocks`), version 0.0.15, is an abandoned Node.js library initially created to provide basic mock implementations for the built-in `fs` (file system) and `http` modules for unit testing. Last published in August 2013, this package targets extremely old Node.js versions (specifically `>= 0.6.5`), which corresponds to Node.js releases from 2011-2012. The API provided is a very limited subset of the actual Node.js `fs` and `http` functionalities, having been developed primarily to support the testing needs of `Testacular` (now known as Karma). Given its lack of updates for over a decade, it does not support modern JavaScript features like ESM, contemporary Node.js APIs, or TypeScript type definitions. Developers should consider modern, actively maintained alternatives such as `mock-fs` for file system mocking, `node-mocks-http` or `nock` for HTTP requests, and general-purpose testing frameworks with robust mocking capabilities.
npm install mocksVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `mocks` package to set up a mock file system (using `_set` and `readFileSync`) and create mock HTTP request/response objects for basic unit testing scenarios in a legacy Node.js environment.
Migrate to actively maintained mocking libraries like `mock-fs` (for file system), `nock` or `node-mocks-http` (for HTTP), or general testing frameworks (e.g., Jest, Sinon.js) for robust and current testing solutions.
Review the source code or limited documentation on the GitHub page to understand exactly which methods are supported. For broader API coverage, consider alternative libraries.
Use CommonJS `require()` syntax (`const mocks = require('mocks');`) to import the package. If your project is ESM-only, you will need to use a different mocking library.Either create custom declaration files (`.d.ts`) or, preferably, migrate to a modern mocking library that offers built-in TypeScript support.
Change `import mocks from 'mocks';` to `const mocks = require('mocks');` and ensure your environment supports CommonJS.Consult the `mocks` package's GitHub repository for the limited list of supported methods. For broader API support, consider modern alternatives like `mock-fs` or `nock`.
Ensure the package is installed via `npm install mocks` or `yarn add mocks` and that your Node.js resolution paths are correctly configured. Verify that `node_modules` is accessible.
No dependency data recorded yet.