@@ -2,6 +2,7 @@ import { testing } from 'bs-logger'
22import { resolve } from 'path'
33import ts , { Diagnostic , ModuleKind , ScriptTarget } from 'typescript'
44
5+ import { version as currentVersion } from '../../package.json'
56import * as fakers from '../__helpers__/fakers'
67import { mocked } from '../__helpers__/mocks'
78import { TsJestGlobalOptions } from '../types'
@@ -20,6 +21,7 @@ backports.backportJestConfig.mockImplementation((_, config) => ({
2021} ) )
2122
2223const defaultResolve = ( path : string ) => `resolved:${ path } `
24+ const pkgVersion = ( pkgName : string ) => require ( `${ pkgName } /package.json` ) . version || '????'
2325
2426function createConfigSet ( {
2527 jestConfig,
@@ -314,29 +316,23 @@ describe('readTsConfig', () => {
314316describe ( 'versions' , ( ) => {
315317 describe ( 'without babel' , ( ) => {
316318 it ( 'should return correct version map' , ( ) => {
317- expect ( createConfigSet ( ) . versions ) . toMatchInlineSnapshot ( `
318- Object {
319- "jest": "23.6.0",
320- "ts-jest": "23.10.0-beta.6",
321- "tslib": "1.9.3",
322- "typescript": "3.0.3",
323- }
324- ` )
319+ expect ( createConfigSet ( ) . versions ) . toEqual ( {
320+ jest : pkgVersion ( 'jest' ) ,
321+ 'ts-jest' : currentVersion ,
322+ typescript : pkgVersion ( 'typescript' ) ,
323+ } )
325324 } )
326325 } )
327326 describe ( 'with babel' , ( ) => {
328327 it ( 'should return correct version map' , ( ) => {
329- expect ( createConfigSet ( { tsJestConfig : { babelConfig : { } } } ) . versions ) . toMatchInlineSnapshot ( `
330- Object {
331- "@babel/core": "-",
332- "babel-core": "6.26.3",
333- "babel-jest": "23.6.0",
334- "jest": "23.6.0",
335- "ts-jest": "23.10.0-beta.6",
336- "tslib": "1.9.3",
337- "typescript": "3.0.3",
338- }
339- ` )
328+ expect ( createConfigSet ( { tsJestConfig : { babelConfig : { } } } ) . versions ) . toEqual ( {
329+ '@babel/core' : '-' ,
330+ 'babel-core' : pkgVersion ( 'babel-core' ) ,
331+ 'babel-jest' : pkgVersion ( 'babel-jest' ) ,
332+ jest : pkgVersion ( 'jest' ) ,
333+ 'ts-jest' : currentVersion ,
334+ typescript : pkgVersion ( 'typescript' ) ,
335+ } )
340336 } )
341337 } )
342338} ) // versions
0 commit comments