Skip to content

Commit

Permalink
build(deps): update dependency typescript to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalexiei committed Mar 25, 2023
1 parent abfdb91 commit ae98b1f
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 60 deletions.
59 changes: 30 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@jest/types": "^29.0.0",
"babel-jest": "^29.0.0",
"jest": "^29.0.0",
"typescript": ">=4.3"
"typescript": ">=4.3 <6"
},
"peerDependenciesMeta": {
"@babel/core": {
Expand Down Expand Up @@ -102,7 +102,6 @@
"@types/lodash.set": "4.x",
"@types/micromatch": "4.x",
"@types/node": "18.15.5",
"@types/node-fetch": "^3.0.3",
"@types/react": "18.x",
"@types/rimraf": "^3.0.2",
"@types/semver": "latest",
Expand Down Expand Up @@ -135,7 +134,7 @@
"lodash.set": "^4.3.2",
"node-fetch": "^3.3.1",
"prettier": "^2.8.6",
"typescript": "~4.9.5"
"typescript": "~5.0.2"
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
Expand Down
28 changes: 16 additions & 12 deletions src/legacy/compiler/ts-compiler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { readFileSync } from 'fs'
import { basename, join, normalize } from 'path'

import {
type CompilerOptions,
DiagnosticCategory,
type EmitOutput,
type transpileModule,
type TranspileOutput,
} from 'typescript'
import type { CompilerOptions, EmitOutput, transpileModule, TranspileOutput } from 'typescript'
import * as ts from 'typescript'

import { createConfigSet, makeCompiler } from '../../__helpers__/fakers'
import type { DepGraphInfo } from '../../types'
Expand All @@ -16,6 +11,15 @@ import { Errors, interpolate } from '../../utils/messages'
import { updateOutput } from './compiler-utils'
import { TsCompiler } from './ts-compiler'

jest.mock('typescript', () => {
const actualModule = jest.requireActual('typescript') as typeof ts

return {
__esModule: true,
...actualModule,
}
})

const mockFolder = join(process.cwd(), 'src', '__mocks__')

const baseTsJestConfig = { tsconfig: join(process.cwd(), 'tsconfig.spec.json') }
Expand Down Expand Up @@ -147,7 +151,7 @@ describe('TsCompiler', () => {
outputText: 'var bar = 1',
diagnostics: [
{
category: DiagnosticCategory.Error,
category: ts.DiagnosticCategory.Error,
code: 123,
messageText: 'An error occurs',
file: undefined,
Expand Down Expand Up @@ -550,15 +554,15 @@ describe('TsCompiler', () => {
} as EmitOutput)
const diagnostics = [
{
category: DiagnosticCategory.Error,
category: ts.DiagnosticCategory.Error,
code: 123,
messageText: 'An error occurs',
file: undefined,
start: 0,
length: 1,
},
{
category: DiagnosticCategory.Error,
category: ts.DiagnosticCategory.Error,
code: 456,
messageText: 'An error occurs',
file: undefined,
Expand Down Expand Up @@ -611,15 +615,15 @@ describe('TsCompiler', () => {
})
const diagnostics = [
{
category: DiagnosticCategory.Error,
category: ts.DiagnosticCategory.Error,
code: 123,
messageText: 'An error occurs',
file: undefined,
start: 0,
length: 1,
},
{
category: DiagnosticCategory.Error,
category: ts.DiagnosticCategory.Error,
code: 456,
messageText: 'An error occurs',
file: undefined,
Expand Down
11 changes: 10 additions & 1 deletion src/legacy/config/config-set.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join, resolve } from 'path'

import type { Transformer } from '@jest/transform'
import { LogLevels, testing } from 'bs-logger'
import ts from 'typescript'
import * as ts from 'typescript'

import { createConfigSet } from '../../__helpers__/fakers'
import { logTargetMock } from '../../__helpers__/mocks'
Expand All @@ -19,6 +19,15 @@ jest.mock('../../utils/backports')
jest.mock('../index')
jest.mock('../../utils/get-package-version')

jest.mock('typescript', () => {
const actualModule = jest.requireActual('typescript') as typeof ts

return {
__esModule: true,
...actualModule,
}
})

const backports = jest.mocked(_backports)

backports.backportJestConfig.mockImplementation((_, config) => ({
Expand Down
6 changes: 4 additions & 2 deletions src/transformers/hoist-jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ export function factory({ configSet }: TsCompilerInstance) {
return visitor
}

type TransformerFunction = _ts.Transformer<_ts.SourceFile>

// returns the transformer factory
return (ctx: _ts.TransformationContext): _ts.Transformer<_ts.SourceFile> =>
return (ctx: _ts.TransformationContext): TransformerFunction =>
logger.wrap({ [LogContexts.logLevel]: LogLevels.debug, call: null }, 'visitSourceFileNode(): hoist jest', (sf) =>
ts.visitNode(sf, createVisitor(ctx, sf)),
)
) as TransformerFunction
}
2 changes: 1 addition & 1 deletion src/utils/version-checkers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pv = jest.mocked(_pv)
describeChecker(VersionCheckers.jest, 'jest', ['29.0.0'], [undefined, '23.6.0', '24.1.0', '30.0.0'])
describeChecker(VersionCheckers.babelJest, 'babel-jest', ['29.0.0'], [undefined, '23.6.0', '24.1.0', '30.0.0'])
describeChecker(VersionCheckers.babelCore, '@babel/core', ['7.0.0'], [undefined, '6.0.0', '8.0.0'])
describeChecker(VersionCheckers.typescript, 'typescript', ['4.3.0', '4.3.5'], [undefined, '4.2.0', '5.0.0'])
describeChecker(VersionCheckers.typescript, 'typescript', ['4.3.0', '4.3.5', '5.0.0'], [undefined, '4.2.0', '6.0.0'])

function describeChecker(
checker: VersionChecker,
Expand Down
4 changes: 1 addition & 3 deletions src/utils/version-checkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const logger = rootLogger.child({ namespace: 'versions' })
*/
const enum ExpectedVersions {
Jest = '>=29.0.0 <30',
TypeScript = '>=4.3 <5',
TypeScript = '>=4.3 <6',
BabelJest = '>=29.0.0 <30',
BabelCore = '>=7.0.0-beta.0 <8',
}
Expand Down Expand Up @@ -43,9 +43,7 @@ type CheckVersionAction = 'warn' | 'throw'
* @internal
*/
function checkVersion(name: string, expectedRange: string, action?: Exclude<CheckVersionAction, 'throw'>): boolean
// eslint-disable-next-line no-redeclare
function checkVersion(name: string, expectedRange: string, action: 'throw'): true | never
// eslint-disable-next-line no-redeclare
function checkVersion(
name: string,
expectedRange: string,
Expand Down
16 changes: 8 additions & 8 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@docusaurus/module-type-aliases": "^2.4.0",
"@tsconfig/docusaurus": "^1.0.7",
"@types/react": "^16.14.24",
"typescript": "~4.9.5"
"typescript": "~5.0.2"
},
"browserslist": {
"production": [
Expand Down

0 comments on commit ae98b1f

Please sign in to comment.