Skip to content

Commit b3c55d6

Browse files
authored
chore: upgrade dependencies, correct typings (#1524)
1 parent 19c32a2 commit b3c55d6

File tree

10 files changed

+51
-104
lines changed

10 files changed

+51
-104
lines changed

package-lock.json

Lines changed: 36 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
"devDependencies": {
8787
"@commitlint/cli": "8.x",
88-
"@commitlint/config-conventional": "7.x",
88+
"@commitlint/config-conventional": "8.x",
8989
"@jest/transform": "25.x",
9090
"@jest/types": "25.x",
9191
"@types/babel__core": "7.x",

src/__helpers__/fakers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function makeCompiler({
7373
jestConfig = {
7474
...jestConfig,
7575
testMatch: ['^.+\\.tsx?$'],
76-
testRegex: jestConfig?.testRegex ? testRegex.concat(jestConfig.testRegex) : testRegex,
76+
testRegex: jestConfig?.testRegex ? [...testRegex, ...jestConfig.testRegex] : testRegex,
7777
}
7878
const cs = new ConfigSet(getJestConfig(jestConfig, tsJestConfig), parentConfig)
7979

src/cli/config/migrate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Config } from '@jest/types'
22
import { createLogger } from 'bs-logger'
3-
import * as stringifyJson from 'fast-json-stable-stringify'
3+
import stableStringify = require('fast-json-stable-stringify')
44
import { existsSync } from 'fs'
55
import { stringify as stringifyJson5 } from 'json5'
66
import { basename, resolve } from 'path'
@@ -119,16 +119,16 @@ Visit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more inf
119119
if (
120120
preset &&
121121
migratedConfig.transform &&
122-
stringifyJson(migratedConfig.transform) === stringifyJson(preset.value.transform)
122+
stableStringify(migratedConfig.transform) === stableStringify(preset.value.transform)
123123
) {
124124
delete migratedConfig.transform
125125
}
126126

127127
// cleanup
128128
cleanupConfig(actualConfig)
129129
cleanupConfig(migratedConfig)
130-
const before = stringifyJson(actualConfig)
131-
const after = stringifyJson(migratedConfig)
130+
const before = stableStringify(actualConfig)
131+
const after = stableStringify(migratedConfig)
132132
if (after === before) {
133133
process.stderr.write(`
134134
No migration needed for given Jest configuration

src/compiler/compiler-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function cacheResolvedModules(
5353
}
5454
}
5555

56-
export function isTestFile(testMatchPatterns: [string, RegExp], fileName: string) {
56+
export function isTestFile(testMatchPatterns: (string | RegExp)[], fileName: string) {
5757
return testMatchPatterns.some(pattern =>
5858
typeof pattern === 'string' ? micromatch.isMatch(fileName, pattern) : pattern.test(fileName),
5959
)

src/config/config-set.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Transformer } from '@jest/transform/build/types'
1+
import { Transformer } from '@jest/transform'
22
import { Config } from '@jest/types'
33
import { testing } from 'bs-logger'
44
import { readFileSync } from 'fs'

src/config/config-set.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ export class ConfigSet {
196196
* @internal
197197
*/
198198
@Memoize()
199-
get testMatchPatterns(): [string, RegExp] {
200-
return this.jest.testMatch.concat(this.jest.testRegex) as [string, RegExp]
199+
get testMatchPatterns(): (string | RegExp)[] {
200+
return [...this.jest.testMatch, ...this.jest.testRegex]
201201
}
202202

203203
/**

src/shims.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/ts-jest-transformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CacheKeyOptions, TransformOptions, TransformedSource, Transformer } from '@jest/transform/build/types'
1+
import { CacheKeyOptions, TransformOptions, TransformedSource, Transformer } from '@jest/transform'
22
import { Config } from '@jest/types'
33
import { Logger } from 'bs-logger'
44
import { inspect } from 'util'

src/types.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { TransformedSource, Transformer } from '@jest/transform/build/types'
1+
import { TransformedSource, Transformer } from '@jest/transform'
22
import * as _babel from 'babel__core'
3-
import { CompilerOptions, SourceFile, TransformerFactory } from 'typescript'
4-
// tslint:disable-next-line:no-duplicate-imports
53
import * as _ts from 'typescript'
64

75
import { ConfigSet } from './config/config-set'
@@ -37,7 +35,7 @@ export interface TsJestGlobalOptions {
3735
* - `path/to/tsconfig.json`: path to a specific tsconfig file (<rootDir> can be used)
3836
* - `{...}`: an object with inline compiler options
3937
*/
40-
tsConfig?: boolean | string | CompilerOptions
38+
tsConfig?: boolean | string | _ts.CompilerOptions
4139

4240
/**
4341
* packageJson. It can be:
@@ -122,7 +120,7 @@ interface TsJestConfig$tsConfig$file {
122120
}
123121
interface TsJestConfig$tsConfig$inline {
124122
kind: 'inline'
125-
value: CompilerOptions
123+
value: _ts.CompilerOptions
126124
}
127125
type TsJestConfig$tsConfig = TsJestConfig$tsConfig$file | TsJestConfig$tsConfig$inline | undefined
128126
interface TsJestConfig$diagnostics {
@@ -227,5 +225,5 @@ export interface CompilerInstance {
227225
export interface AstTransformerDesc {
228226
name: string
229227
version: number
230-
factory(cs: ConfigSet): TransformerFactory<SourceFile>
228+
factory(cs: ConfigSet): _ts.TransformerFactory<_ts.SourceFile>
231229
}

0 commit comments

Comments
 (0)