Skip to content

Instantly share code, notes, and snippets.

View kimus's full-sized avatar

Helder Rossa kimus

View GitHub Profile
@kimus
kimus / example.js
Last active February 23, 2022 23:50
Inject mock data or an module into Node require
require('./require-inject')
.inject('@mock/direct.json', { bla: 1 })
.inject('@mock/file.json', require('./mock/file.json'))
.inject('module-name', require('./some/module'));
const data1 = require('@mock/direct.json');
const data2 = require('@mock/file.json');
const mod1 = require('module-name');