Skip to content

Commit

Permalink
fix(compiler): initialize compiler with .ts/.tsx/.d.ts files on…
Browse files Browse the repository at this point in the history
…ly (#2457)

Closes #2445
  • Loading branch information
ahnpnl authored Mar 17, 2021
1 parent ee10b67 commit 1dc731a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/compiler/language-service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { LogContexts, Logger, LogLevels } from 'bs-logger'
import { existsSync, readFileSync, writeFile } from 'fs'
import { basename, normalize, join } from 'path'
import { basename, normalize, join, extname } from 'path'
import memoize = require('lodash/memoize')
import mkdirp = require('mkdirp')
import type * as _ts from 'typescript'

import { ConfigSet, TS_JEST_OUT_DIR } from '../config/config-set'
import { LINE_FEED } from '../constants'
import type { ConfigSet } from '../config/config-set'
import { LINE_FEED, TS_TSX_REGEX } from '../constants'
import type { CompilerInstance, SourceOutput } from '../types'
import { Errors, interpolate } from '../utils/messages'

Expand Down Expand Up @@ -75,10 +75,7 @@ export const initializeLanguageServiceInstance = (configs: ConfigSet, logger: Lo
}
// Initialize memory cache for typescript compiler
configs.parsedTsConfig.fileNames
.filter(
(fileName: string) =>
!configs.isTestFile(fileName) && !fileName.includes(configs.parsedTsConfig.options.outDir ?? TS_JEST_OUT_DIR),
)
.filter((fileName: string) => TS_TSX_REGEX.test(extname(fileName)) && !configs.isTestFile(fileName))
.forEach((fileName: string) => {
memoryCache.files.set(fileName, {
version: 0,
Expand Down

0 comments on commit 1dc731a

Please sign in to comment.