node-mocks
node-mocks copied to clipboard
Suite of mocks for node.js (fs, http) + some testing utils...
Hi, this project hasn't been updated for years? Is it working with recent versions of NodeJS?
The code I was testing relies on Node's built in `require.resolve()` function, running it before the module is imported. Unfortunately, since this library replaces `require()` and calls the module immediately...
I've been comparing using rewire and mocks to see which best suits my needs. Using node 5.6.0, I've noticed two things when using loadFile on a module: 1. private const's...
The `writeHead` method didn't take the arguments for status text and headers, so I added those. Also changed the header names to be lower-case since that's how node core does...
I customized loadFile so that CoffeeScript is loaded directly.
Module under test may need `require.extensions` but currently it is not exposed.
Please see [readme of master](https://github.com/agsha/node-mocks#why-this-fork) for details of what this pull request is
A very small fix to make the encoding option work in fs.readFile and fs.readFileSync. These calls will all now return a string: ``` fs.readFile(path, 'utf8', callback); fs.readFile(path, {encoding: 'utf8'}, callback);...