Code Monkey home page Code Monkey logo

Comments (6)

kwonoj avatar kwonoj commented on September 13, 2024 1

Also output in console is seems to be wrong - probably we have to investigate and fix it.

: I've investigated this and currently it's not possible.

Jest writes coverage by delivering result to coverage reporter while collecting all test results. Console output for coverage happens at this time, before testresultprocessor being invoked. So its output is before-mapping, then coverage processor takes over try to remap its results.

It is because design of test result processor limitation, details at here : jestjs/jest#1907 (comment) unless there's upstream changes to have specific hooks invoked to return mutated results back to jest or change behavior of current hooks, there isn't way to achieve this.

from ts-jest.

beckend avatar beckend commented on September 13, 2024

If you want to give it a spin:

  • clone repo
  • npm i
  • jest --coverage --no-cache
    Coverage will be in coverage folder found in project root.

from ts-jest.

Igmat avatar Igmat commented on September 13, 2024

Ok, I've found out what is wrong. Our coverage is in ./coverage/remapped folder, not in ./coverage and it could be confusing. Also output in console is seems to be wrong - probably we have to investigate and fix it.

from ts-jest.

beckend avatar beckend commented on September 13, 2024

By using reporters in package.json :
"coverageReporters": [ "html", "text", "lcov", "lcovonly", "json" ],

Differences:

  • html goes into ./coverage/remapped/html , original is ./coverage . The file structure is also not the same: remapped contains an additional src folder.
  • lcov is missing completely, original is ./coverage/lcov-report .
  • json goes into ./coverage/remapped/coverage.json , original is ./coverage/coverage-final.json . Filename differs.

lconvonly seems to have right filename: ./coverage/remapped/lcov.info , original is ./coverage/lcov.info .

from ts-jest.

kwonoj avatar kwonoj commented on September 13, 2024

Please note coverage processor do not exactly follow configurations of jest.

html: it's generated by remap-istanbul via remapped source mapping. It is expected to have different structure. coverage processor does not touch folder structure other than output location.
lcov: for some reason remap to lcov from jest's output simply doesn't work, so remapping is skipped.

Filename differs

: it is expected. Jest does not exposes which configuration they're using (for example, file name) so coverage processor does not have way to know what was original file name saved and match with it. Instead, it tries best effort to create possible coverage report with own naming https://github.com/kulshekhar/ts-jest/blob/master/src/coverageprocessor.ts#L41

from ts-jest.

kulshekhar avatar kulshekhar commented on September 13, 2024

Closing in favor of #101

from ts-jest.

Related Issues (20)

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.