Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Conditionally export a function for testing
- *
- * Usage:
- * (src/file.js)
- * $test(privateHelper, module, [nameForExport])
- *
- * (src/file_test.js)
- * import { name } from './file'
- *
- */
- export const $test = (func, mod, name) => {
- if (process.env.NODE_ENV === 'test') {
- mod.exports[name || func.name] = func;
- }
- return func;
- };
Add Comment
Please, Sign In to add comment