Skip to content

Commit e009d79

Browse files
committed
Correct fixConfig include files
1 parent 7213c0f commit e009d79

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/index.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,13 @@ export function register (opts: Options = {}): Register {
202202

203203
// Require the TypeScript compiler and configuration.
204204
const cwd = process.cwd()
205-
const { compilerOptions, project, skipProject, files } = options
206205
const typeCheck = options.typeCheck === true || options.transpileOnly !== true
207206
const compiler = require.resolve(options.compiler || 'typescript', { paths: [cwd] })
208207
const ts: typeof _ts = require(compiler)
209208
const transformers = options.transformers || undefined
210209
const readFile = options.readFile || ts.sys.readFile
211210
const fileExists = options.fileExists || ts.sys.fileExists
212-
const config = readConfig(cwd, ts, fileExists, readFile, compilerOptions, project, skipProject, files)
211+
const config = readConfig(cwd, ts, fileExists, readFile, options)
213212
const configDiagnosticList = filterDiagnostics(config.errors, ignoreDiagnostics)
214213
const extensions = ['.ts', '.tsx']
215214

@@ -451,19 +450,16 @@ function readConfig (
451450
ts: TSCommon,
452451
fileExists: (path: string) => boolean,
453452
readFile: (path: string) => string | undefined,
454-
compilerOptions?: object,
455-
project?: string,
456-
skipProject?: boolean | null,
457-
includeFiles?: boolean | null
453+
options: Options
458454
): _ts.ParsedCommandLine {
459455
let config: any = { compilerOptions: {} }
460456
let basePath = normalizeSlashes(cwd)
461457
let configFileName: string | undefined = undefined
462458

463459
// Read project configuration when available.
464-
if (!skipProject) {
465-
configFileName = project
466-
? normalizeSlashes(resolve(cwd, project))
460+
if (!options.skipProject) {
461+
configFileName = options.project
462+
? normalizeSlashes(resolve(cwd, options.project))
467463
: ts.findConfigFile(normalizeSlashes(cwd), fileExists)
468464

469465
if (configFileName) {
@@ -480,13 +476,13 @@ function readConfig (
480476
}
481477

482478
// Remove resolution of "files".
483-
if (!includeFiles) {
479+
if (!options.files) {
484480
config.files = []
485-
config.includes = []
481+
config.include = []
486482
}
487483

488484
// Override default configuration options `ts-node` requires.
489-
config.compilerOptions = Object.assign({}, config.compilerOptions, compilerOptions, TS_NODE_COMPILER_OPTIONS)
485+
config.compilerOptions = Object.assign({}, config.compilerOptions, options.compilerOptions, TS_NODE_COMPILER_OPTIONS)
490486

491487
return fixConfig(ts, ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName))
492488
}

0 commit comments

Comments
 (0)