dkelosky / jest-stare

Jest HTML Reporter and Results Processor

Home Page:https://dkelosky.github.io/jest-stare/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run Jest stare

CoderCoco opened this issue · comments

Hello

I am having an issue while running jest-stare with no results directory present.

Error: ENOENT: no such file or directory, mkdir '__tests__\__results__\unit\html/'
    at Object.mkdirSync (fs.js:753:3)
    at Function.mkDirSync (C:\XXXXXX\node_modules\jest-stare\lib\utils\IO.js:26:16)
    at dirs.forEach (C:\XXXXXX\node_modules\jest-stare\lib\utils\IO.js:34:16)
    at Array.forEach (<anonymous>)
    at Function.mkdirsSync (C:\XXXXXX\node_modules\jest-stare\lib\utils\IO.js:32:14)
    at Processor.generateReport (C:\XXXXXX\node_modules\jest-stare\lib\processor\Processor.js:72:17)
    at Processor.generate (C:\XXXXXX\node_modules\jest-stare\lib\processor\Processor.js:44:14)
    at Function.run (C:\XXXXXX\node_modules\jest-stare\lib\processor\Processor.js:28:62)
    at Reporter.onRunStart (C:\XXXXXX\node_modules\jest-stare\lib\reporter\Reporter.js:16:31)
    at C:\XXXXXX\node_modules\@jest\core\build\ReporterDispatcher.js:165:50

Configuration for Jest is done with an env file:

const path = require("path");
const basePath = "./__tests__/__results__/unit";
const testType = "Unit";

module.exports = {
  "FORCE_COLOR": "1",
  "JEST_STARE_RESULT_DIR": path.join(basePath, "html"),
  "JEST_JUNIT_OUTPUT": path.join(basePath, "junit/junit.xml"),
  "JEST_JUNIT_ANCESTOR_SEPARATOR": " > ",
  "JEST_JUNIT_CLASSNAME": `${testType}.{classname}`,
  "JEST_JUNIT_TITLE": "{title}",
  "JEST_SUIT_NAME": `${testType} Tests`
}

If I create that directory prior to running jest, the library works.

jest-stare: 1.15.0
jest: 24.7.1
node: 10.15.1
npm: 6.9.0

This is fixed by #106

I noticed that this commit: 0a7cf86 fixes the problem but it seems to be missing from 1.16.0

Hmm I see the changes after doing npm pack jest-stare so it seems to have been published to me...

IO.js:

 static mkdirsSync(dir) {
        const dirs = path.resolve(dir).replace(/\\/g, "/").split("/");
        let createDir = "";
        for (const crDir of dirs) {
            createDir += (crDir + "/");
            IO.mkDirSync(createDir);
        }
    }