File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[* .ts ]
22indent_style = space
3- indent_size = 4
3+ indent_size = 2
44
55[* .tsx ]
66indent_style = space
7- indent_size = 4
7+ indent_size = 2
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Ihor Chulinda <ichulinda@gmail.com>
2727J Cheyo Jimenez <cheyo@masters3d.com>
2828Jim Cummins <jimthedev@gmail.com>
2929Joscha Feth <joscha@feth.com>
30+ Junle Li <lijunle@gmail.com>
3031Justin Bay <jwbay@users.noreply.github.com>
3132Kulshekhar Kabra <kulshekhar@users.noreply.github.com>
3233Kyle Roach <kroach.work@gmail.com>
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import * as sourceMapSupport from 'source-map-support' ;
2- import { defaultRetrieveFileHandler } from './default-retrieve-file-handler' ;
32
4- export function install ( ) {
3+ export function install ( filePath : string , fileContent : string ) {
54 const options : sourceMapSupport . Options = { } ;
65
7- options . retrieveFile = defaultRetrieveFileHandler ;
6+ options . retrieveFile = path => ( path === filePath ? fileContent : undefined ) ;
87
98 /* tslint:disable */
109 // disabling tslint because the types for the source-map-support version
Original file line number Diff line number Diff line change @@ -58,17 +58,11 @@ export function process(
5858 transformOptions ,
5959 ) ;
6060
61- const modified = injectSourcemapHook ( outputText ) ;
62-
63- if ( tsJestConfig . enableInternalCache === true ) {
64- // This config is undocumented.
65- // This has been made configurable for now to ensure that
66- // if this breaks something for existing users, there's a quick fix
67- // in place.
68- // If this doesn't cause a problem, this if block will be removed
69- // in a future version
70- cacheFile ( jestConfig , filePath , modified ) ;
71- }
61+ const modified = injectSourcemapHook (
62+ filePath ,
63+ tsTranspiled . outputText ,
64+ outputText ,
65+ ) ;
7266
7367 return modified ;
7468}
Original file line number Diff line number Diff line change @@ -189,10 +189,16 @@ export function cacheFile(
189189 }
190190}
191191
192- export function injectSourcemapHook ( src : string ) : string {
192+ export function injectSourcemapHook (
193+ filePath : string ,
194+ typeScriptCode : string ,
195+ src : string ,
196+ ) : string {
193197 const start = src . length > 12 ? src . substr ( 1 , 10 ) : '' ;
194198
195- const sourceMapHook = `require('ts-jest').install()` ;
199+ const filePathParam = JSON . stringify ( filePath ) ;
200+ const codeParam = JSON . stringify ( typeScriptCode ) ;
201+ const sourceMapHook = `require('ts-jest').install(${ filePathParam } , ${ codeParam } )` ;
196202
197203 return start === 'use strict'
198204 ? `'use strict';${ sourceMapHook } ;${ src } `
You can’t perform that action at this time.
0 commit comments