UNPKG

jest-standard-reporter

Version:

Jest reporter that uses stdout for messages and stderr for errors

15 lines (11 loc) 543 B
const path = require('path'); const relativePath = (config, testPath) => { // this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs // do not have config.cwd, only config.rootDir. Try using config.cwd, fallback // to config.rootDir. (Also, some unit just use config.rootDir, which is ok) testPath = path.relative(config.cwd || config.rootDir, testPath); const dirname = path.dirname(testPath); const basename = path.basename(testPath); return { basename, dirname }; }; module.exports = relativePath;