
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
gulp-mock-module
Advanced tools
A module replacement plugin for gulp. It serves mock files by changing the require/import target from the target module onto the mock for that module.
First, install gulp-mock-module
as a development dependency:
npm install --save-dev gulp-mock-module
# or
yarn add --dev gulp-mock-module
Then, add it to your gulpfile.js
:
const mock = require("gulp-mock-module");
const path = require("path");
const { src, dest } = require("gulp");
function replaceTemplate() {
return src(["file.js"])
.pipe(
mock(
["module1", "module2"],
path.resolve(process.cwd(), "folder-that-contains-the-mocks")
)
)
.pipe(dest("build/"));
}
exports.replaceTemplate = replaceTemplate;
Where file.js is a file containing import references to module1 and module2
// file.js
const module1 = require("path-to-module1/module1");
// or
import module2 from "path-to-module2/module2";
/**
*
* DOING SOMETHING AMAZING, I GUESS
*
*/
gulp-mock-module
only takes in two parameters
mock(targetModules, mockDirectory);
Type: String[]
The names for the modules to replace with a mock.
The names can either be the name of the file itself (module1.js)
, or the name of the folder containing the index.js
that you're importing (module2/index.js)
Note: file extensions are not used in the process so do not include them - the format should be the same as the name you use during the import syntax.
As for the supported file types or the languages of the files - Currently, this is only being used for typescript and javascript files.
["module1", "module2"];
Type: String
The location of the folder that contains the mocks.
Note: This has not been tested for relative paths, so use path.resolve()
path.resolve(process.cwd(), "src", "mocks");
FAQs
A file replacement plugin for grunt
We found that gulp-mock-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.