Skip to content

Commit

Permalink
Small refinement.
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunle committed Jan 5, 2018
1 parent 0f48246 commit 0775a3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function readCompilerOptions(configPath: string) {
// First step: Let tsc pick up the config.
const loaded = tsc.readConfigFile(configPath, file => {
const read = tsc.sys.readFile(file);
// tslint:disable-next-line:max-line-length
// See https://github.com/Microsoft/TypeScript/blob/a757e8428410c2196886776785c16f8f0c2a62d9/src/compiler/sys.ts#L203 :
// See
// https://github.com/Microsoft/TypeScript/blob/a757e8428410c2196886776785c16f8f0c2a62d9/src/compiler/sys.ts#L203 :
// `readFile` returns `undefined` in case the file does not exist!
if (!read) {
throw new Error(
Expand Down Expand Up @@ -196,9 +196,9 @@ export function injectSourcemapHook(
): string {
const start = src.length > 12 ? src.substr(1, 10) : '';

const sourceMapHook = `require('ts-jest').install(${JSON.stringify(
filePath,
)}, ${JSON.stringify(typeScriptCode)})`;
const filePathParam = JSON.stringify(filePath);
const codeParam = JSON.stringify(typeScriptCode);
const sourceMapHook = `require('ts-jest').install(${filePathParam}, ${codeParam})`;

return start === 'use strict'
? `'use strict';${sourceMapHook};${src}`
Expand Down

0 comments on commit 0775a3b

Please sign in to comment.