|
10 | 10 | */ |
11 | 11 | import type { Config } from '@jest/types' |
12 | 12 | import { LogContexts, Logger } from 'bs-logger' |
13 | | -import { existsSync, readFileSync, realpathSync } from 'fs' |
| 13 | +import { existsSync, readFileSync } from 'fs' |
14 | 14 | import { globsToMatcher } from 'jest-util' |
15 | 15 | import json5 = require('json5') |
16 | 16 | import { dirname, extname, isAbsolute, join, normalize, resolve } from 'path' |
@@ -128,66 +128,6 @@ const toDiagnosticCodeList = (items: any, into: number[] = []): number[] => { |
128 | 128 | } |
129 | 129 |
|
130 | 130 | export class ConfigSet { |
131 | | - /** |
132 | | - * @internal |
133 | | - */ |
134 | | - @Memoize() |
135 | | - private get projectPackageJson(): Record<string, any> { |
136 | | - const { |
137 | | - tsJest: { packageJson }, |
138 | | - } = this |
139 | | - if (packageJson) { |
140 | | - if (packageJson.kind === 'inline') { |
141 | | - return packageJson.value |
142 | | - } else if (packageJson.kind === 'file' && packageJson.value) { |
143 | | - const path = this.resolvePath(packageJson.value) |
144 | | - if (existsSync(path)) { |
145 | | - return require(path) |
146 | | - } |
147 | | - |
148 | | - this.logger.warn(Errors.UnableToFindProjectRoot) |
149 | | - |
150 | | - return {} |
151 | | - } |
152 | | - } |
153 | | - const tsJestRoot = resolve(__dirname, '..', '..') |
154 | | - let pkgPath = resolve(tsJestRoot, '..', '..', 'package.json') |
155 | | - if (existsSync(pkgPath)) { |
156 | | - return require(pkgPath) |
157 | | - } |
158 | | - if (realpathSync(this.rootDir) === realpathSync(tsJestRoot)) { |
159 | | - pkgPath = resolve(tsJestRoot, 'package.json') |
160 | | - if (existsSync(pkgPath)) { |
161 | | - return require(pkgPath) |
162 | | - } |
163 | | - } |
164 | | - |
165 | | - this.logger.warn(Errors.UnableToFindProjectRoot) |
166 | | - |
167 | | - return {} |
168 | | - } |
169 | | - |
170 | | - /** |
171 | | - * @internal |
172 | | - */ |
173 | | - @Memoize() |
174 | | - private get projectDependencies(): Record<string, string> { |
175 | | - const { projectPackageJson: pkg } = this |
176 | | - const names = Object.keys({ |
177 | | - ...pkg.optionalDependencies, |
178 | | - ...pkg.peerDependencies, |
179 | | - ...pkg.devDependencies, |
180 | | - ...pkg.dependencies, |
181 | | - }) |
182 | | - |
183 | | - return names.reduce((map, name) => { |
184 | | - const version = getPackageVersion(name) |
185 | | - if (version) map[name] = version |
186 | | - |
187 | | - return map |
188 | | - }, {} as Record<string, string>) |
189 | | - } |
190 | | - |
191 | 131 | /** |
192 | 132 | * @internal |
193 | 133 | */ |
@@ -681,7 +621,6 @@ export class ConfigSet { |
681 | 621 | stringify({ |
682 | 622 | version: this.compilerModule.version, |
683 | 623 | digest: this.tsJestDigest, |
684 | | - dependencies: this.projectDependencies, |
685 | 624 | compiler: this.tsJest.compiler, |
686 | 625 | compilerOptions: this.parsedTsConfig.options, |
687 | 626 | isolatedModules: this.tsJest.isolatedModules, |
@@ -770,7 +709,6 @@ export class ConfigSet { |
770 | 709 |
|
771 | 710 | return new JsonableValue({ |
772 | 711 | versions: this.versions, |
773 | | - projectDepVersions: this.projectDependencies, |
774 | 712 | digest: this.tsJestDigest, |
775 | 713 | transformers: Object.values(this.astTransformers) |
776 | 714 | .reduce((acc, val) => acc.concat(val), []) |
|
0 commit comments