Skip to content

Instantly share code, notes, and snippets.

View danny-andrews's full-sized avatar

Danny Andrews danny-andrews

View GitHub Profile
@ryyppy
ryyppy / hard-dependency.js
Last active July 8, 2022 14:01
Jest: Module Mocking vs. Simple Dependency Injection
// ###############################
// runPackager.js
// ###############################
// In this example, the IO function is tightly coupled with the implementation
import { execFileSync } from 'child_process';
type RunPackagerOptions = {
projectRoot: string, // CWD the react-native binary is being run from
targetDir: string, // Target directory absolute or relative to projectRoot (e.g. 'rna/')