@@ -203,17 +203,16 @@ export function register (opts: Options = {}): Register {
203
203
204
204
// Require the TypeScript compiler and configuration.
205
205
const cwd = process . cwd ( )
206
- const { compilerOptions, project, skipProject } = options
206
+ const { compilerOptions, project, skipProject, files } = options
207
207
const typeCheck = options . typeCheck === true || options . transpileOnly !== true
208
208
const compiler = require . resolve ( options . compiler || 'typescript' , { paths : [ cwd ] } )
209
209
const ts : typeof _ts = require ( compiler )
210
210
const transformers = options . transformers || undefined
211
211
const readFile = options . readFile || ts . sys . readFile
212
212
const fileExists = options . fileExists || ts . sys . fileExists
213
- const config = readConfig ( cwd , ts , fileExists , readFile , compilerOptions , project , skipProject )
213
+ const config = readConfig ( cwd , ts , fileExists , readFile , compilerOptions , project , skipProject , files )
214
214
const configDiagnosticList = filterDiagnostics ( config . errors , ignoreDiagnostics )
215
215
const extensions = [ '.ts' , '.tsx' ]
216
- const fileNames = options . files ? config . fileNames : [ ]
217
216
218
217
const diagnosticHost : _ts . FormatDiagnosticsHost = {
219
218
getNewLine : ( ) => EOL ,
@@ -241,7 +240,7 @@ export function register (opts: Options = {}): Register {
241
240
}
242
241
243
242
// Initialize files from TypeScript into project.
244
- for ( const path of fileNames ) memoryCache . versions [ path ] = 1
243
+ for ( const path of config . fileNames ) memoryCache . versions [ path ] = 1
245
244
246
245
/**
247
246
* Get the extension for a transpiled file.
@@ -454,15 +453,16 @@ function readConfig (
454
453
fileExists : ( path : string ) => boolean ,
455
454
readFile : ( path : string ) => string | undefined ,
456
455
compilerOptions ?: object ,
457
- project ?: string | null ,
458
- noProject ?: boolean | null
456
+ project ?: string ,
457
+ skipProject ?: boolean | null ,
458
+ includeFiles ?: boolean | null
459
459
) : _ts . ParsedCommandLine {
460
460
let config : any = { compilerOptions : { } }
461
461
let basePath = normalizeSlashes ( cwd )
462
462
let configFileName : string | undefined = undefined
463
463
464
464
// Read project configuration when available.
465
- if ( ! noProject ) {
465
+ if ( ! skipProject ) {
466
466
configFileName = project
467
467
? normalizeSlashes ( resolve ( cwd , project ) )
468
468
: ts . findConfigFile ( normalizeSlashes ( cwd ) , fileExists )
@@ -481,8 +481,10 @@ function readConfig (
481
481
}
482
482
483
483
// Remove resolution of "files".
484
- config . files = [ ]
485
- config . includes = [ ]
484
+ if ( ! includeFiles ) {
485
+ config . files = [ ]
486
+ config . includes = [ ]
487
+ }
486
488
487
489
// Override default configuration options `ts-node` requires.
488
490
config . compilerOptions = Object . assign ( { } , config . compilerOptions , compilerOptions , TS_NODE_COMPILER_OPTIONS )
0 commit comments