import { join } from 'path' ; param { string } cwd param { string } fakeVersion returns { string } export function getVersion ( cwd ? , fakeVersion = '0.0.0' ) { if ( process . env . JEST_WORKER_ID !== undefined ) { return fakeVersion ; } let packagePath = join ( cwd ?? '../..' , 'package.json' ) ; return require ( packagePath ) . version ; }