Ts-jest: Understanding how ts-jest works

Created on 6 Mar 2018  路  2Comments  路  Source: kulshekhar/ts-jest

  • Issue
    An open topic to get to understand how ts-jest works

  • Expected behavior
    N.A.

  • Output from your debug log
    N.A.

  • Link to a minimal repo that reproduces this issue
    N.A.

  • Optional (but highly recommended) - Configure Travis (or your favorite system) with the minimal repo
    N.A.

I have some following questions regarding to how ts-jest works:

  • How does it work ?
  • Why do we need babel ?
  • What is the relationship between babel and tsc ?
  • How can I check the transpiled codes ? The transpiled codes are the codes passing to Jest ?
  • Debugging process for ts-jest: Where should I start ? How can I enable logging to debug ts-jest ?

If anyone else has other questions, we can discuss it here.

Most helpful comment

How does it work ?

In a nutshell,

  • jest calls the process function in ts-jest with the source code (once for each matched file) and configuration
  • ts-jest returns the transpiled source code + sourcemaps back to jest

Why do we need babel ?

to support hoisting

What is the relationship between babel and tsc ?

There is no direct relationship between babel and tsc

How can I check the transpiled codes ? The transpiled codes are the codes passing to Jest ?

The transpiled code is returned to jest. To check the transpiled code, you'll have to put a log statement in node_modules/ts-jest/dist/preprocessor.js in the correct location

Debugging process for ts-jest: Where should I start ? How can I enable logging to debug ts-jest ?

by setting the TS_JEST_DEBUG env variable to true

All 2 comments

How does it work ?

In a nutshell,

  • jest calls the process function in ts-jest with the source code (once for each matched file) and configuration
  • ts-jest returns the transpiled source code + sourcemaps back to jest

Why do we need babel ?

to support hoisting

What is the relationship between babel and tsc ?

There is no direct relationship between babel and tsc

How can I check the transpiled codes ? The transpiled codes are the codes passing to Jest ?

The transpiled code is returned to jest. To check the transpiled code, you'll have to put a log statement in node_modules/ts-jest/dist/preprocessor.js in the correct location

Debugging process for ts-jest: Where should I start ? How can I enable logging to debug ts-jest ?

by setting the TS_JEST_DEBUG env variable to true

I'm closing this issue but this discussion can continue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikeyakymenko picture mikeyakymenko  路  3Comments

masters3d picture masters3d  路  4Comments

Slessi picture Slessi  路  3Comments

japhar81 picture japhar81  路  3Comments

GeeWee picture GeeWee  路  4Comments