Giter VIP home page Giter VIP logo

jest-stare's People

Contributors

caina-jumia avatar covertbert avatar dependabot[bot] avatar dkelosky avatar dogboydog avatar fijijavis avatar jameskip avatar josephpage avatar metammodern avatar mnikkane avatar renovate-bot avatar renovate[bot] avatar test-pilott avatar tom-dk avatar wickkidd avatar xapphire13 avatar you54f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jest-stare's Issues

Link to Raw JSON

Link to raw json distributed with report for a formatted view

jest-stare cli response error in node:11-alpine container by CRLF newlines

Hi,

I discover the problem (like this) about the newlines encoding in node:11-alpine container.

Since I can not issue PR immediately because I do not have knowledge of javascript and typescreipt, please only report on issues.

Also, this English is from GoogleTranslate, which may be offensive to you. I'm sorry.

~ # yarn jest-stare result.json .
yarn run v1.15.2
$ /root/node_modules/.bin/jest-stare result.json .
': No such file or directory
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~ # cat -e node_modules/.bin/jest-stare 
#!/usr/bin/env node^M$
"use strict";^M$
Object.defineProperty(exports, "__esModule", { value: true });^M$
const CLI_1 = require("./cli/CLI");^M$
const ignoredParmCount = 2;^M$
const args = process.argv.slice(ignoredParmCount);^M$
CLI_1.CLI.run(args);^M$
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiamVzdC1zdGFyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9qZXN0LXN0YXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG1DQUFnQztBQUVoQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsQ0FBQztBQUMzQixNQUFNLElBQUksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBQ2xELFNBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMifQ==~ # 
~ # 
~ # vi node_modules/.bin/jest-stare 
~ # cat -e node_modules/.bin/jest-stare 
#!/usr/bin/env node$
"use strict";$
Object.defineProperty(exports, "__esModule", { value: true });$
const CLI_1 = require("./cli/CLI");$
const ignoredParmCount = 2;$
const args = process.argv.slice(ignoredParmCount);$
CLI_1.CLI.run(args);$
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiamVzdC1zdGFyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9qZXN0LXN0YXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG1DQUFnQztBQUVoQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsQ0FBQztBQUMzQixNQUFNLElBQUksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBQ2xELFNBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMifQ==~ # yarn jest-stare result.json .
yarn run v1.15.2
$ /root/node_modules/.bin/jest-stare result.json .
jest-stare was called with programmatic config
**  jest-stare --testResultsProcessor: wrote output report to ./index.html      **
Done in 0.48s.
~ # 

Using the jest variable <rootDir> in configuration results in errors.

While configuring jest-stare, I attempted to configure my results directory like so:

"jest-stare": {
  "resultDir": "<rootDir>/__tests__/__results__/jest-stare",
  "coverageLink": "../unit/coverage/lcov-report/index.html"
}

This leads to the following error:

Error: ENOENT: no such file or directory, mkdir '<rootDir>/'

I believe that this should work in accordance with the jest variable: https://jestjs.io/docs/en/configuration#rootdir-string.

For example, the jest-junit plugin supports this config:

"jest-junit": {
  "output": "<rootDir>/__tests__/__results__/junit/junit.xml"
}

Snapshots column present when there were no snapshot tests

When I'm looking at a report and there are no snapshot tests, the results are rendered with no corresponding pie graph for the group. I would think if there were no snapshot tests, then there should be no ui placeholder displayed.

capture

i'm not able able to append the result

I have around 10 pack of scripts each having 5-8 scripts in it. I'm triggering through a batch file. so in that, I only able to get the result of the last pack, so it means it overriding the file not appending. so please help me in this so I can able to solve.

Missing trailing slash in resultDir.

Default resultDir results in broken file structure when generating the report:
I think this:

https://github.com/dkelosky/jest-stare/blob/v1.6.0/src/processor/Config.ts#L50
should add trailing slash also for default value:

if (config.resultDir == null) {
  config.resultDir = Constants.DEFAULT_RESULTS_DIR;
}

config.resultDir = config.resultDir + "/";

The other thing that would be useful is to allow to pass config options in jest config. The following doesn't seem to work:

reporters: [
  ['jest-stare', {
    resultDir: 'report'
  }]
];

Unable to run Jest stare

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

index.js is not loading details. Getting exception testResults is not iterable

I am generating html report programmatically. I am setting error when I am loading index.js. Here is the exception

Uncaught TypeError: testResult.testResults is not iterable
    at results.testResults.forEach (view.js:273)
    at Array.forEach (<anonymous>)
    at Function.create (view.js:270)
    at Function.show (view.js:67)
    at HTMLDocument.document.addEventListener (view.js:50)

There is where I am seeing issue

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Constants_1 = require("../Constants");
const Test_1 = require("../tests/Test");
class TestSuite {
    static create(results) {
        const elements = [];
        const describeLevels = [];
        results.testResults.forEach((testResult) => {
            let testStatusClass = Constants_1.Constants.PASSED_TEST;
            const testSectionStatus = new Map();
            for (const result of testResult.testResults) { ------- Exception 

XML file output

Can we have option to output the test results in xml file format, which would be very similar to the output generated in https://github.com/michaelleeallen/jest-junit-reporter.

Some CI/CD tools expects a xml file instead of a json. By having this feature, we could have one single npm module(this one) instead of adding 2 npm dependencies.

Allow defaulting "Pass" filter to disabled/unchecked when there are failing tests?

When there are failing tests the passing test output is simply noise as I need to get to the failing test output so I can see what I need to correct. I took a look at the code for the "Switch" but I'm not sure what approach you would take given the way this is coded so I was hesitant to create a PR. If this enhancement is something you're open to, I'd be willing to create a PR, but I'd need to know what kind of approach you would want.

At a minimum I would think that this could be a config setting. Also, query params come to mind which would allow the burden of deciding when to set a Switch state to off to rest with the consumer. Thoughts?

Collapsible boxes in HTML report

While doing research for unit test HTML reporters I stumbled across jest-stare and I think it looks just fantastic. I'm thinking about introducing jest-stare to my team and including it in our angular/typescript project.

Our project's code coverage is 100%. To achieve this, we have a lot of tests per test suite. This of course makes every report very long.

Here is an example screenshot of a report generated by jest-stare:
jest-stare

As you can see, the scroll bar is very long. I assume it is rather hard to really read through this report and identify the relevant information in this condition.

Request

I'm wondering if it would be possible to enable collapsing/expanding for the various boxes that group the test suites. Maybe together with an collapse all / expand all option.

Image snapshots do not match "Expected image to be the same size as the snapshot.."

First of all, thanks for this awesome html reporter!

I get this issue when the image snapshot fails for a different error and this doesn't get picked up by the matcher in jest-stare so the snapshot diff is not copied and rendered.
Error: Expected image to be the same size as the snapshot (2370x6290), but was different (2370x6330).

Relevant code line:

public static DIFF_INDICATOR: string = "different from snapshot";

It just needs to additionally match against Expected image to be the same size as the snapshot.

Thanks.

[Suggestion] Custom page title and titlebar headline

Instead of the page title being "jest-stare!" and the titlebar reading "jest-stare", it'd be ideal to pass variables in from CI, e.g. the repository and branch name.

e.g.

REPORT_TITLE="${REPO} - Unit Test Report"
REPORT_HEADLINE="${REPO}/${BRANCH}"

Ensure All Describes Are in Order

For describes and tests written in format of multiple levels of describe where tests exists in both levels like:

describe("outer...", ()=> {
  it("should be first", () => {
  });
  describe("inner...", ()=> {
    it("should be second", () => {
    });
  });
});

The jest-stare report will present the should be second test before the should be first test.

Zip File Output

A nice feature would be to allow the output to be a zip file. For example, if you need to zip and upload your test results somewhere. Happy to contribute a PR if that fits your road map for this lib.

Large Diff Collapse

It would be nice to collapse large inline diffs (>100 lines) by default and allow the use to expand if desired.

Support assertionResults

#45 noted that --json creates a different json object to parse. This issue is to track support for that format.

Include Console output?

Other reporters such as jest-html-reporter have an option to include the console output captured by Jest. This is a great feature because you can include important debugging info in the report without cluttering your terminal.

Can we have an option to include that info in a collapsable box at the end of each suite?

Display pendong message in report

The pending function takes in an optional reason string parameter. Would be nice if when the argument passed, it is displayed in the HTML report

Disabling pie charts on report

Is there a way to disable pie charts from generated report using environment variables or any configuration?

image

Thanks,
Chirag Pandit

Specifying a resultDir suppresses report link message in logs

I'm on "jest-stare": "^1.25.0",

I would expect to see the following after running my tests:

**  jest-stare --reporters: wrote output report to ./jest-stare/index.html	**
jest-html-reporter >> Report generated (./jest/reports/jest-html-reporter.html)

This just lets me click the link in the terminal to go to the report rather than dig for it in my file explorer.

However, the jest-stare message is suppressed when I do the following:

const reporters = [
  'default',
  ['jest-stare', { resultDir: ... }],
  ['jest-html-reporter', {...}]
]

If it's just

const reporters = [
  'default',
  'jest-stare',
  ['jest-html-reporter', {...}]
]

seems to be ok.

Skipping all tests results in error display.

When all tests and test suits are skipped, the corresponding output looks like the tests failed:

capture

Adding 1 passing test with the rest skipped seems to have solved the problem.

capture2

MixedTests.example.ts Doesn't Show Failed Tests

  1. npm run example
  2. turn off failed filter
  3. turn off passed filter
  4. reenable failed filter and see MixedTests.example.ts block doesn't show any tests (although it should display failed tests)

issue with resultDir

When in watch mode, jest seems to look for a file in resultDir, first time it works, then, it keeps adding resultDir to the path and gives errors.

Issue:
src/modules/users/e2e/users.e2e-spec.ts
PASS src/modules/users/users.controller.spec.ts
PASS src/modules/users/users.component.spec.ts

Test Suites: 3 passed, 3 total
Tests: 16 passed, 16 total
Snapshots: 0 total
Time: 0.752s, estimated 1s
Ran all test suites.
----------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------------------|----------|----------|----------|----------|----------------|
All files | 81.31 | 56.25 | 90 | 92.31 | |
src | 80 | 36.36 | 100 | 90.91 | |
app.module.ts | 80 | 36.36 | 100 | 90.91 | 5 |
src/modules/users | 81.52 | 60.38 | 89.66 | 92.54 | |
users.component.ts | 72.97 | 57.89 | 76.92 | 88.89 | 5,13,14 |
users.controller.ts | 89.74 | 73.91 | 100 | 96.43 | 5 |
users.module.ts | 81.25 | 36.36 | 100 | 91.67 | 5 |
----------------------|----------|----------|----------|----------|----------------|

Watch Usage: Press w to show more.(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/js/bootstrap.min.js'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 33)
(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/js/diff2html.min.js'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 34)
(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/js/jquery.min.js'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 35)
(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/js/holder.js'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 36)
(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/css/bootstrap.min.css'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 37)
(node:6531) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'reports/reports/reports/reports/css/diff2html.min.css'
(node:6531) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 38)

package.json:

"jest": {
"transform": {
"^.+\.tsx?$": "ts-jest"
},
"testRegex": "(/src/.*|(\.|/)(e2e-spec|spec))\.(ts)$",
"testResultsProcessor": "jest-stare",
"moduleFileExtensions": [
"ts",
"js"
],
"collectCoverage": true,
"testDirectoryName": "src",
"testFileExtensions": [
"ts"
],
"modulePathIgnorePatterns": [
"/.idea/",
"/coverage/",
"/reports/"
],
"watchPathIgnorePatterns": [
"/.idea/",
"/coverage/",
"/reports/"
]
},
"jest-stare": {
"resultDir": "reports",
"log": false
}

Performance degradation with large amounts of tests.

When opening a report with a large amount of tests, the report takes some time to load and the graphs animations are choppy during the load.

This is a profile of an environment with 157 Test Suites / 746 Tests / 323 Snapshots:

capture

As shown, it took 12 seconds to load the report.

Unrecognized Diff

This data causes a snapshot difference but is not recognized as a "diff" and so does not generate side-by-side report.

Generate via node lib/jest-stare __tests__/data/failSnapshotDiff.json and see Status.test.ts

Cannot find module './doc/IJestStareConfig'

Hi guys.
I'm hitting this error: Cannot find module './doc/IJestStareConfig'
Any help would be greatly appreciated.
Error: Cannot find module './doc/IJestStareConfig' at Function.Module._resolveFilename (module.js:543:15) at Function.Module._load (module.js:470:25) at Module.require (module.js:593:17) at require (internal/module.js:11:18) at Object.<anonymous> (/node_modules/jest-stare/lib/processor/Config.js:5:28) at Module._compile (module.js:649:30) at Object.Module._extensions..js (module.js:660:10) at Module.load (module.js:561:32) at tryModuleLoad (module.js:501:12) at Function.Module._load (module.js:493:3) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Output test names relative to project root

It would be nice if in the html output, the test file names were relative to the project root. This would remove some clutter in the ui when running from a CI/CD environment.

For Example:

In my jenkins pipeline, jest-stare reports that tests are named like: /home/jenkins/workspace/ce_create-performance-class-QQJA254Q6QB2QLHTANX2367QN4XUUAEKPDFVBIZLHLOLVMI2VHHA/src/performance/manager/__tests__/PerformanceApiManager.unit.test.ts

This string could be shortened to: src/performance/manager/__tests__/PerformanceApiManager.unit.test.ts

For reference, here's how the former path looks in the UI:

capture

and what it could look like with the changes:

capture2

Report generates in default location

Hey,

one of last updates allowed to config via. jest config file. For this config:

reporters: [
    "default",
    [
      "jest-stare",
      {
        resultDir: "tests/unit/results",
        reportTitle: "...Test results",
        reportHeadline: "...",
        coverageLink: "../../coverage/index.html"
      }
    ],

I am getting two reports: one in under /tests/unit/results and second /jest-stare

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.