diff --git a/e2e/__helpers__/test-case/__hooks-source__.js.hbs b/e2e/__helpers__/test-case/__hooks-source__.js.hbs index e019ee930d..286ef5fc94 100644 --- a/e2e/__helpers__/test-case/__hooks-source__.js.hbs +++ b/e2e/__helpers__/test-case/__hooks-source__.js.hbs @@ -1,27 +1,27 @@ // this is a template! -const fs = require('fs'); -const path = require('path'); -const root = __dirname; -const writeProcessIoTo = {{writeProcessIoTo}}; +const fs = require('fs') +const path = require('path') +const root = __dirname +const writeProcessIoTo = {{writeProcessIoTo}} exports.afterProcess = function (args, result) { - // const source = args[0]; - const filePath = args[1]; - const relPath = path.relative(root, filePath); + // const source = args[0] + const filePath = args[1] + const relPath = path.relative(root, filePath) if (writeProcessIoTo && filePath.startsWith(`${root}${path.sep}`)) { - const dest = `${path.join(writeProcessIoTo, relPath)}.json`; - const segments = relPath.split(path.sep); - segments.pop(); - const madeSegments = []; + const dest = `${path.join(writeProcessIoTo, relPath)}.json` + const segments = relPath.split(path.sep) + segments.pop() + const madeSegments = [] segments.forEach(segment => { - madeSegments.push(segment); - const p = join(writeProcessIoTo, madeSegments.join(sep)); - if (!fs.existsSync(p)) fs.mkdirSync(p); - }); + madeSegments.push(segment) + const p = path.join(writeProcessIoTo, madeSegments.join(path.sep)) + if (!fs.existsSync(p)) fs.mkdirSync(p) + }) fs.writeFileSync(dest, JSON.stringify({ in: args, out: result, - }), 'utf8'); + }), 'utf8') } } diff --git a/src/config/config-set.ts b/src/config/config-set.ts index c2b0a097fa..c30379a064 100644 --- a/src/config/config-set.ts +++ b/src/config/config-set.ts @@ -39,6 +39,7 @@ import { version as myVersion } from '..' import semver from 'semver' import { rootLogger } from '../util/logger' import { Logger } from 'bs-logger' +import { getPackageVersion } from '../util/get-package-version' const logger = rootLogger.child({ namespace: 'config' }) @@ -235,7 +236,7 @@ export class ConfigSet { tsConfig, babelConfig, diagnostics, - typeCheck: !!options.typeCheck, + isolatedModules: !!options.isolatedModules, compiler: options.compiler || 'typescript', stringifyContentPathRegex, } @@ -251,6 +252,21 @@ export class ConfigSet { return this._typescript.input } + @Memoize() + get versions(): Record { + const modules = ['jest', this.tsJest.compiler, 'tslib'] + if (this.tsJest.babelConfig) { + modules.push('@babel/core', 'babel-core', 'babel-jest') + } + return modules.reduce( + (map, name) => { + map[name] = getPackageVersion(name) || '-' + return map + }, + { 'ts-jest': myVersion } as Record, + ) + } + @Memoize() private get _typescript(): ReadTsConfigResult { const { @@ -423,7 +439,7 @@ export class ConfigSet { version: this.compilerModule.version, compiler: this.tsJest.compiler, compilerOptions: this.typescript.options, - typeCheck: this.tsJest.typeCheck, + isolatedModules: this.tsJest.isolatedModules, ignoreDiagnostics: this.tsJest.diagnostics.ignoreCodes, }), ) @@ -555,7 +571,7 @@ export class ConfigSet { delete globals['ts-jest'] return new JsonableValue({ - version: myVersion, + versions: this.versions, jest, tsJest: this.tsJest, babel: this.babel,