Jest code coverage with tests written in CoffeeScript

Is there a way to run the Jest module testing tool, which is written in CoffeeScript? The coverage report always tells me about 100% coverage.

jest --coverage

----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

I am already rewriting CoffeeScript in JavaScript with the following Jest preprocessor

var coffee = require('coffee-script');

module.exports = {
  // CoffeeScript files can be .coffee or .litcoffee
  process: function(src, path) {
    if (coffee.helpers.isCoffee(path)) {
      return coffee.compile(src, {
        bare: true,
        literate: coffee.helpers.isLiterate(path)
      });
    }
    return src;
  }
};
+4
source share

Source: https://habr.com/ru/post/1599532/


All Articles