From 31434654358d931cc5680f83a6e11441782d889c Mon Sep 17 00:00:00 2001 From: kulshekhar Date: Thu, 11 May 2017 00:08:56 +0530 Subject: [PATCH] Use 'instrument' as proxy for 'collectCoverage' --- package.json | 2 +- src/preprocessor.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b8c7fe38e4..6a13c1128e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-jest", - "version": "20.0.2", + "version": "20.0.3", "main": "index.js", "types": "./dist/index.d.ts", "description": "A preprocessor with sourcemap support to help use Typescript with Jest", diff --git a/src/preprocessor.ts b/src/preprocessor.ts index 358a9c4397..77935413c6 100644 --- a/src/preprocessor.ts +++ b/src/preprocessor.ts @@ -1,6 +1,6 @@ import * as fs from 'fs-extra'; import * as tsc from 'typescript'; -import { getTSConfig, getJestConfig } from './utils'; +import { getTSConfig } from './utils'; // TODO: rework next to ES6 style imports const glob = require('glob-all'); const nodepath = require('path'); @@ -12,8 +12,9 @@ const babelJest = require('babel-jest') export function process(src, path, config, transformOptions) { const root = require('pkg-dir').sync(); - const jestConfig = getJestConfig(root); - const compilerOptions = getTSConfig(config.globals, jestConfig.collectCoverage); + // transformOptions.instrument is a proxy for collectCoverage + // https://github.com/kulshekhar/ts-jest/issues/201#issuecomment-300572902 + const compilerOptions = getTSConfig(config.globals, transformOptions.instrument); const isTsFile = path.endsWith('.ts') || path.endsWith('.tsx'); const isJsFile = path.endsWith('.js') || path.endsWith('.jsx');