@teambit/jest 0.0.805 → 0.0.808
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jest.tester.js
CHANGED
|
@@ -234,11 +234,15 @@ class JestTester {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
async test(context) {
|
|
237
|
-
const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;
|
|
237
|
+
// const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;
|
|
238
238
|
const config = {
|
|
239
239
|
// Setting the rootDir to the env root dir to make sure we can resolve all the jest presets/plugins
|
|
240
240
|
// from the env context
|
|
241
|
-
rootDir: envRootDir,
|
|
241
|
+
// rootDir: envRootDir,
|
|
242
|
+
// TODO: set it to envRootDir and make sure we can make the --coverage to work
|
|
243
|
+
// with the current value as context.rootPath it will probably won't work correctly when using rootComponents:true (maybe even won't work at all)
|
|
244
|
+
// TODO: when changing to envRootDir we have some issues with the react-native tests. so once changed again, it needs to be validated.
|
|
245
|
+
rootDir: context.rootPath,
|
|
242
246
|
// Setting the roots (where to search for spec files) to the root path (either workspace or capsule root)
|
|
243
247
|
// TODO: consider change this to be an array of the components running dir.
|
|
244
248
|
// TODO: aka: in the workspace it will be something like <ws>/node_modules/<comp-package-name>/node_modules/<comp-package-name>
|
|
@@ -267,10 +271,17 @@ class JestTester {
|
|
|
267
271
|
} // eslint-disable-next-line global-require,import/no-dynamic-require
|
|
268
272
|
|
|
269
273
|
|
|
270
|
-
const jestConfig = require(this.jestConfig);
|
|
274
|
+
const jestConfig = require(this.jestConfig); // TODO: rollback this for now, as it makes issues.
|
|
275
|
+
// TODO: it's mostly relevant for when the root components feature is enabled.
|
|
276
|
+
// TODO: we might want to enable it only on that case (along with setting the env root dir as the root dir, above)
|
|
277
|
+
// const moduleNameMapper = await this.calculateModuleNameMapper(
|
|
278
|
+
// context.env,
|
|
279
|
+
// context.rootPath,
|
|
280
|
+
// context.additionalHostDependencies
|
|
281
|
+
// );
|
|
282
|
+
// jestConfig.moduleNameMapper = Object.assign({}, jestConfig.moduleNameMapper || {}, moduleNameMapper);
|
|
283
|
+
|
|
271
284
|
|
|
272
|
-
const moduleNameMapper = await this.calculateModuleNameMapper(context.env, context.rootPath, context.additionalHostDependencies);
|
|
273
|
-
jestConfig.moduleNameMapper = Object.assign({}, jestConfig.moduleNameMapper || {}, moduleNameMapper);
|
|
274
285
|
const jestConfigWithSpecs = Object.assign(jestConfig, {
|
|
275
286
|
testMatch: this.patternsToArray(context.patterns)
|
|
276
287
|
});
|
|
@@ -285,6 +296,8 @@ class JestTester {
|
|
|
285
296
|
async watch(context) {
|
|
286
297
|
// eslint-disable-next-line
|
|
287
298
|
return new Promise(async resolve => {
|
|
299
|
+
var _context$envRuntime$e;
|
|
300
|
+
|
|
288
301
|
const workerApi = this.jestWorker.initiate(context.ui ? {
|
|
289
302
|
stdout: true,
|
|
290
303
|
stderr: true,
|
|
@@ -297,7 +310,12 @@ class JestTester {
|
|
|
297
310
|
|
|
298
311
|
const jestConfig = require(this.jestConfig);
|
|
299
312
|
|
|
300
|
-
const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;
|
|
313
|
+
const envRootDir = (_context$envRuntime$e = context.envRuntime.envAspectDefinition) === null || _context$envRuntime$e === void 0 ? void 0 : _context$envRuntime$e.aspectPath;
|
|
314
|
+
|
|
315
|
+
if (!envRootDir) {
|
|
316
|
+
this.logger.warn(`jest tester, envRootDir is not defined, for env ${context.envRuntime.id}`);
|
|
317
|
+
}
|
|
318
|
+
|
|
301
319
|
const jestConfigWithSpecs = Object.assign(jestConfig, {
|
|
302
320
|
testMatch: this.patternsToArray(context.patterns)
|
|
303
321
|
});
|
package/dist/jest.tester.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JestTester","constructor","id","jestConfig","jestModulePath","jestWorker","logger","jestModule","require","displayConfig","readFileSync","version","getVersion","attachTestsToComponent","testerContext","testResult","ComponentMap","as","components","component","componentSpecFiles","patterns","get","undefined","specs","filter","test","pattern","minimatch","testFilePath","path","length","buildTestsObj","aggregatedResult","config","testsSuiteResult","toArray","map","testsFiles","errors","getErrors","tests","file","AbstractVinyl","contents","testResults","error","formatResultsErrors","noStackTrace","isFailure","status","TestResult","ancestorTitles","title","duration","filePath","basename","getError","testExecError","watch","JestError","failureMessage","message","stack","TestsFiles","numPassingTests","numFailingTests","numPendingTests","perfStats","runtime","slow","componentId","results","TestsResult","success","startTime","compact","reduce","code","type","push","onTestRunComplete","callback","_callback","context","envRootDir","envRuntime","envAspectDefinition","aspectPath","rootDir","roots","rootPath","console","warn","debug","runInBand","coverage","watchAll","noCache","moduleNameMapper","calculateModuleNameMapper","env","additionalHostDependencies","Object","assign","jestConfigWithSpecs","testMatch","patternsToArray","withEnv","testsOutPut","runCLI","componentsWithTests","componentTestResults","Tests","Promise","resolve","workerApi","initiate","ui","stdout","stderr","stdin","cbFn","proxy","globalErrors","watchTestResults","loading","onTestComplete","err","peerDepsConfig","getDependencies","peersAutoDetectPolicy","PeersAutoDetectPolicy","peers","keys","peerDependencies","concat","names","depsToMap","mappedValues","acc","peerName","keyName","internalPathKeyName","flatten","p"],"sources":["jest.tester.ts"],"sourcesContent":["import { readFileSync } from 'fs-extra';\nimport minimatch from 'minimatch';\nimport { compact, flatten } from 'lodash';\nimport { proxy } from 'comlink';\nimport { Logger } from '@teambit/logger';\nimport { HarmonyWorker } from '@teambit/worker';\nimport { Tester, CallbackFn, TesterContext, Tests, ComponentPatternsMap, ComponentsResults } from '@teambit/tester';\nimport { TestsFiles, TestResult, TestsResult } from '@teambit/tests-results';\nimport { TestResult as JestTestResult, AggregatedResult } from '@jest/test-result';\nimport { formatResultsErrors } from 'jest-message-util';\nimport { ComponentMap } from '@teambit/component';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { Environment } from '@teambit/envs';\nimport { EnvPolicyConfigObject, PeersAutoDetectPolicy } from '@teambit/dependency-resolver';\nimport type jest from 'jest';\nimport { JestError } from './error';\nimport type { JestWorker } from './jest.worker';\n\nexport class JestTester implements Tester {\n private readonly jestModule: typeof jest;\n\n constructor(\n readonly id: string,\n readonly jestConfig: any,\n private jestModulePath: string,\n private jestWorker: HarmonyWorker<JestWorker>,\n private logger: Logger\n ) {\n // eslint-disable-next-line global-require,import/no-dynamic-require\n this.jestModule = require(jestModulePath);\n }\n\n configPath = this.jestConfig;\n\n displayName = 'Jest';\n\n _callback: CallbackFn | undefined;\n\n displayConfig() {\n return readFileSync(this.jestConfig, 'utf8');\n }\n\n version() {\n return this.jestModule.getVersion();\n }\n\n private attachTestsToComponent(testerContext: TesterContext, testResult: JestTestResult[]) {\n return ComponentMap.as(testerContext.components, (component) => {\n const componentSpecFiles = testerContext.patterns.get(component);\n if (!componentSpecFiles) return undefined;\n const [, specs] = componentSpecFiles;\n return testResult.filter((test) => {\n return specs.filter((pattern) => minimatch(test.testFilePath, pattern.path)).length > 0;\n });\n });\n }\n\n private buildTestsObj(\n aggregatedResult: AggregatedResult,\n components: ComponentMap<JestTestResult[] | undefined>,\n testerContext: TesterContext,\n config?: any\n ): ComponentsResults[] {\n const testsSuiteResult = components.toArray().map(([component, testsFiles]) => {\n if (!testsFiles) return undefined;\n if (testsFiles?.length === 0) return undefined;\n const errors = this.getErrors(testsFiles);\n const tests = testsFiles.map((test) => {\n const file = new AbstractVinyl({ path: test.testFilePath, contents: readFileSync(test.testFilePath) });\n const testResults = test.testResults.map((testResult) => {\n const error = formatResultsErrors([testResult], config, { noStackTrace: true }) || undefined;\n const isFailure = testResult.status === 'failed';\n return new TestResult(\n testResult.ancestorTitles,\n testResult.title,\n testResult.status,\n testResult.duration,\n isFailure ? undefined : error,\n isFailure ? error : undefined\n );\n });\n const filePath = file?.basename || test.testFilePath;\n const getError = () => {\n if (!test.testExecError) return undefined;\n if (testerContext.watch) {\n // for some reason, during watch ('bit start'), if a file has an error, the `test.testExecError` is `{}`\n // (an empty object). the failureMessage contains the stringified error.\n // @todo: consider to always use the failureMessage, regardless the context.watch.\n return new JestError(test.failureMessage as string);\n }\n return new JestError(test.testExecError?.message, test.testExecError?.stack);\n };\n const error = getError();\n return new TestsFiles(\n filePath,\n testResults,\n test.numPassingTests,\n test.numFailingTests,\n test.numPendingTests,\n test.perfStats.runtime,\n test.perfStats.slow,\n error\n );\n });\n return {\n componentId: component.id,\n results: new TestsResult(tests, aggregatedResult.success, aggregatedResult.startTime),\n errors,\n };\n });\n\n return compact(testsSuiteResult);\n }\n\n private getErrors(testResult: JestTestResult[]): JestError[] {\n return testResult.reduce((errors: JestError[], test) => {\n if (test.testExecError) {\n const { message, stack, code, type } = test.testExecError;\n errors.push(new JestError(message, stack, code, type));\n } else if (test.failureMessage) {\n errors.push(new JestError(test.failureMessage));\n }\n return errors;\n }, []);\n }\n\n async onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async test(context: TesterContext): Promise<Tests> {\n const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;\n\n const config: any = {\n // Setting the rootDir to the env root dir to make sure we can resolve all the jest presets/plugins\n // from the env context\n rootDir: envRootDir,\n // Setting the roots (where to search for spec files) to the root path (either workspace or capsule root)\n // TODO: consider change this to be an array of the components running dir.\n // TODO: aka: in the workspace it will be something like <ws>/node_modules/<comp-package-name>/node_modules/<comp-package-name>\n // TODO: see dependencyResolver.getRuntimeModulePath (this will make sure the peer deps resolved correctly)\n // TODO: (@GiladShoham - when trying to set it to this paths, jest ignores it probably because the paths contains \"node_modules\"\n // TODO: trying to set the https://jestjs.io/docs/27.x/configuration#testpathignorepatterns-arraystring to something else (as it contain node_modules by default)\n // TODO: didn't help)\n roots: [context.rootPath],\n };\n\n // eslint-disable-next-line no-console\n console.warn = (message: string) => {\n this.logger.warn(message);\n };\n\n if (context.debug) {\n config.debug = true;\n config.runInBand = true;\n }\n if (context.coverage) config.coverage = true;\n config.runInBand = true;\n\n if (context.watch) {\n config.watchAll = true;\n config.noCache = true;\n }\n // eslint-disable-next-line global-require,import/no-dynamic-require\n const jestConfig = require(this.jestConfig);\n\n const moduleNameMapper = await this.calculateModuleNameMapper(\n context.env,\n context.rootPath,\n context.additionalHostDependencies\n );\n jestConfig.moduleNameMapper = Object.assign({}, jestConfig.moduleNameMapper || {}, moduleNameMapper);\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: this.patternsToArray(context.patterns),\n });\n\n const withEnv = Object.assign(jestConfigWithSpecs, config);\n\n const testsOutPut = await this.jestModule.runCLI(withEnv, [this.jestConfig]);\n const testResults = testsOutPut.results.testResults;\n const componentsWithTests = this.attachTestsToComponent(context, testResults);\n const componentTestResults = this.buildTestsObj(\n testsOutPut.results,\n componentsWithTests,\n context,\n jestConfigWithSpecs\n );\n return new Tests(componentTestResults);\n }\n\n async watch(context: TesterContext): Promise<Tests> {\n // eslint-disable-next-line\n return new Promise(async (resolve) => {\n const workerApi = this.jestWorker.initiate(\n context.ui ? { stdout: true, stderr: true, stdin: true } : { stdout: false, stderr: false, stdin: false }\n );\n\n // eslint-disable-next-line\n const jestConfig = require(this.jestConfig);\n\n const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: this.patternsToArray(context.patterns),\n });\n\n try {\n const cbFn = proxy((results) => {\n if (!this._callback) return;\n const testResults = results.testResults;\n const componentsWithTests = this.attachTestsToComponent(context, testResults);\n const componentTestResults = this.buildTestsObj(results, componentsWithTests, context, jestConfigWithSpecs);\n const globalErrors = this.getErrors(testResults);\n const watchTestResults = {\n loading: false,\n errors: globalErrors,\n components: componentTestResults,\n };\n this._callback(watchTestResults);\n resolve(watchTestResults);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n await workerApi.onTestComplete(cbFn);\n\n await workerApi.watch(\n this.jestConfig,\n this.patternsToArray(context.patterns),\n context.rootPath,\n this.jestModulePath,\n envRootDir\n );\n } catch (err: any) {\n this.logger.error('jest.tester.watch() caught an error', err);\n }\n });\n }\n\n private async calculateModuleNameMapper(\n env: Environment,\n rootPath: string,\n additionalHostDependencies?: string[]\n ): Promise<Record<string, Array<string>>> {\n const peerDepsConfig: EnvPolicyConfigObject = await env.getDependencies();\n const peersAutoDetectPolicy = new PeersAutoDetectPolicy(peerDepsConfig.peers || []);\n const peers = Object.keys(peerDepsConfig.peerDependencies || {}).concat(peersAutoDetectPolicy?.names);\n const depsToMap = peers.concat(additionalHostDependencies || []);\n\n /**\n * Try to resolve the dependency from the rootDir (the env dir) or from the root path (workspace/capsule root)\n */\n const mappedValues = ['<rootDir>/node_modules/$1', `${rootPath}/node_modules/$1`];\n\n const moduleNameMapper = depsToMap.reduce((acc, peerName) => {\n const keyName = `^(${peerName})$`;\n acc[keyName] = mappedValues;\n const internalPathKeyName = `^(${peerName}/.*)$`;\n acc[internalPathKeyName] = mappedValues;\n return acc;\n }, {});\n\n return moduleNameMapper;\n }\n\n private patternsToArray(patterns: ComponentPatternsMap) {\n return flatten(patterns.toArray().map(([, pattern]) => pattern.map((p) => p.path)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,UAAN,CAAmC;EAGxCC,WAAW,CACAC,EADA,E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H,IAArB,CAAxC,CAAR,CAAP;EACD;;AAzPuC"}
|
|
1
|
+
{"version":3,"names":["JestTester","constructor","id","jestConfig","jestModulePath","jestWorker","logger","jestModule","require","displayConfig","readFileSync","version","getVersion","attachTestsToComponent","testerContext","testResult","ComponentMap","as","components","component","componentSpecFiles","patterns","get","undefined","specs","filter","test","pattern","minimatch","testFilePath","path","length","buildTestsObj","aggregatedResult","config","testsSuiteResult","toArray","map","testsFiles","errors","getErrors","tests","file","AbstractVinyl","contents","testResults","error","formatResultsErrors","noStackTrace","isFailure","status","TestResult","ancestorTitles","title","duration","filePath","basename","getError","testExecError","watch","JestError","failureMessage","message","stack","TestsFiles","numPassingTests","numFailingTests","numPendingTests","perfStats","runtime","slow","componentId","results","TestsResult","success","startTime","compact","reduce","code","type","push","onTestRunComplete","callback","_callback","context","rootDir","rootPath","roots","console","warn","debug","runInBand","coverage","watchAll","noCache","jestConfigWithSpecs","Object","assign","testMatch","patternsToArray","withEnv","testsOutPut","runCLI","componentsWithTests","componentTestResults","Tests","Promise","resolve","workerApi","initiate","ui","stdout","stderr","stdin","envRootDir","envRuntime","envAspectDefinition","aspectPath","cbFn","proxy","globalErrors","watchTestResults","loading","onTestComplete","err","calculateModuleNameMapper","env","additionalHostDependencies","peerDepsConfig","getDependencies","peersAutoDetectPolicy","PeersAutoDetectPolicy","peers","keys","peerDependencies","concat","names","depsToMap","mappedValues","moduleNameMapper","acc","peerName","keyName","internalPathKeyName","flatten","p"],"sources":["jest.tester.ts"],"sourcesContent":["import { readFileSync } from 'fs-extra';\nimport minimatch from 'minimatch';\nimport { compact, flatten } from 'lodash';\nimport { proxy } from 'comlink';\nimport { Logger } from '@teambit/logger';\nimport { HarmonyWorker } from '@teambit/worker';\nimport { Tester, CallbackFn, TesterContext, Tests, ComponentPatternsMap, ComponentsResults } from '@teambit/tester';\nimport { TestsFiles, TestResult, TestsResult } from '@teambit/tests-results';\nimport { TestResult as JestTestResult, AggregatedResult } from '@jest/test-result';\nimport { formatResultsErrors } from 'jest-message-util';\nimport { ComponentMap } from '@teambit/component';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { Environment } from '@teambit/envs';\nimport { EnvPolicyConfigObject, PeersAutoDetectPolicy } from '@teambit/dependency-resolver';\nimport type jest from 'jest';\nimport { JestError } from './error';\nimport type { JestWorker } from './jest.worker';\n\nexport class JestTester implements Tester {\n private readonly jestModule: typeof jest;\n\n constructor(\n readonly id: string,\n readonly jestConfig: any,\n private jestModulePath: string,\n private jestWorker: HarmonyWorker<JestWorker>,\n private logger: Logger\n ) {\n // eslint-disable-next-line global-require,import/no-dynamic-require\n this.jestModule = require(jestModulePath);\n }\n\n configPath = this.jestConfig;\n\n displayName = 'Jest';\n\n _callback: CallbackFn | undefined;\n\n displayConfig() {\n return readFileSync(this.jestConfig, 'utf8');\n }\n\n version() {\n return this.jestModule.getVersion();\n }\n\n private attachTestsToComponent(testerContext: TesterContext, testResult: JestTestResult[]) {\n return ComponentMap.as(testerContext.components, (component) => {\n const componentSpecFiles = testerContext.patterns.get(component);\n if (!componentSpecFiles) return undefined;\n const [, specs] = componentSpecFiles;\n return testResult.filter((test) => {\n return specs.filter((pattern) => minimatch(test.testFilePath, pattern.path)).length > 0;\n });\n });\n }\n\n private buildTestsObj(\n aggregatedResult: AggregatedResult,\n components: ComponentMap<JestTestResult[] | undefined>,\n testerContext: TesterContext,\n config?: any\n ): ComponentsResults[] {\n const testsSuiteResult = components.toArray().map(([component, testsFiles]) => {\n if (!testsFiles) return undefined;\n if (testsFiles?.length === 0) return undefined;\n const errors = this.getErrors(testsFiles);\n const tests = testsFiles.map((test) => {\n const file = new AbstractVinyl({ path: test.testFilePath, contents: readFileSync(test.testFilePath) });\n const testResults = test.testResults.map((testResult) => {\n const error = formatResultsErrors([testResult], config, { noStackTrace: true }) || undefined;\n const isFailure = testResult.status === 'failed';\n return new TestResult(\n testResult.ancestorTitles,\n testResult.title,\n testResult.status,\n testResult.duration,\n isFailure ? undefined : error,\n isFailure ? error : undefined\n );\n });\n const filePath = file?.basename || test.testFilePath;\n const getError = () => {\n if (!test.testExecError) return undefined;\n if (testerContext.watch) {\n // for some reason, during watch ('bit start'), if a file has an error, the `test.testExecError` is `{}`\n // (an empty object). the failureMessage contains the stringified error.\n // @todo: consider to always use the failureMessage, regardless the context.watch.\n return new JestError(test.failureMessage as string);\n }\n return new JestError(test.testExecError?.message, test.testExecError?.stack);\n };\n const error = getError();\n return new TestsFiles(\n filePath,\n testResults,\n test.numPassingTests,\n test.numFailingTests,\n test.numPendingTests,\n test.perfStats.runtime,\n test.perfStats.slow,\n error\n );\n });\n return {\n componentId: component.id,\n results: new TestsResult(tests, aggregatedResult.success, aggregatedResult.startTime),\n errors,\n };\n });\n\n return compact(testsSuiteResult);\n }\n\n private getErrors(testResult: JestTestResult[]): JestError[] {\n return testResult.reduce((errors: JestError[], test) => {\n if (test.testExecError) {\n const { message, stack, code, type } = test.testExecError;\n errors.push(new JestError(message, stack, code, type));\n } else if (test.failureMessage) {\n errors.push(new JestError(test.failureMessage));\n }\n return errors;\n }, []);\n }\n\n async onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async test(context: TesterContext): Promise<Tests> {\n // const envRootDir = context.envRuntime.envAspectDefinition.aspectPath;\n\n const config: any = {\n // Setting the rootDir to the env root dir to make sure we can resolve all the jest presets/plugins\n // from the env context\n // rootDir: envRootDir,\n // TODO: set it to envRootDir and make sure we can make the --coverage to work\n // with the current value as context.rootPath it will probably won't work correctly when using rootComponents:true (maybe even won't work at all)\n // TODO: when changing to envRootDir we have some issues with the react-native tests. so once changed again, it needs to be validated.\n rootDir: context.rootPath,\n // Setting the roots (where to search for spec files) to the root path (either workspace or capsule root)\n // TODO: consider change this to be an array of the components running dir.\n // TODO: aka: in the workspace it will be something like <ws>/node_modules/<comp-package-name>/node_modules/<comp-package-name>\n // TODO: see dependencyResolver.getRuntimeModulePath (this will make sure the peer deps resolved correctly)\n // TODO: (@GiladShoham - when trying to set it to this paths, jest ignores it probably because the paths contains \"node_modules\"\n // TODO: trying to set the https://jestjs.io/docs/27.x/configuration#testpathignorepatterns-arraystring to something else (as it contain node_modules by default)\n // TODO: didn't help)\n roots: [context.rootPath],\n };\n\n // eslint-disable-next-line no-console\n console.warn = (message: string) => {\n this.logger.warn(message);\n };\n\n if (context.debug) {\n config.debug = true;\n config.runInBand = true;\n }\n if (context.coverage) config.coverage = true;\n config.runInBand = true;\n\n if (context.watch) {\n config.watchAll = true;\n config.noCache = true;\n }\n // eslint-disable-next-line global-require,import/no-dynamic-require\n const jestConfig = require(this.jestConfig);\n\n // TODO: rollback this for now, as it makes issues.\n // TODO: it's mostly relevant for when the root components feature is enabled.\n // TODO: we might want to enable it only on that case (along with setting the env root dir as the root dir, above)\n // const moduleNameMapper = await this.calculateModuleNameMapper(\n // context.env,\n // context.rootPath,\n // context.additionalHostDependencies\n // );\n // jestConfig.moduleNameMapper = Object.assign({}, jestConfig.moduleNameMapper || {}, moduleNameMapper);\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: this.patternsToArray(context.patterns),\n });\n\n const withEnv = Object.assign(jestConfigWithSpecs, config);\n\n const testsOutPut = await this.jestModule.runCLI(withEnv, [this.jestConfig]);\n const testResults = testsOutPut.results.testResults;\n const componentsWithTests = this.attachTestsToComponent(context, testResults);\n const componentTestResults = this.buildTestsObj(\n testsOutPut.results,\n componentsWithTests,\n context,\n jestConfigWithSpecs\n );\n return new Tests(componentTestResults);\n }\n\n async watch(context: TesterContext): Promise<Tests> {\n // eslint-disable-next-line\n return new Promise(async (resolve) => {\n const workerApi = this.jestWorker.initiate(\n context.ui ? { stdout: true, stderr: true, stdin: true } : { stdout: false, stderr: false, stdin: false }\n );\n\n // eslint-disable-next-line\n const jestConfig = require(this.jestConfig);\n\n\n const envRootDir = context.envRuntime.envAspectDefinition?.aspectPath;\n if (!envRootDir) {\n this.logger.warn(`jest tester, envRootDir is not defined, for env ${context.envRuntime.id}`);\n }\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: this.patternsToArray(context.patterns),\n });\n\n try {\n const cbFn = proxy((results) => {\n if (!this._callback) return;\n const testResults = results.testResults;\n const componentsWithTests = this.attachTestsToComponent(context, testResults);\n const componentTestResults = this.buildTestsObj(results, componentsWithTests, context, jestConfigWithSpecs);\n const globalErrors = this.getErrors(testResults);\n const watchTestResults = {\n loading: false,\n errors: globalErrors,\n components: componentTestResults,\n };\n this._callback(watchTestResults);\n resolve(watchTestResults);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n await workerApi.onTestComplete(cbFn);\n\n await workerApi.watch(\n this.jestConfig,\n this.patternsToArray(context.patterns),\n context.rootPath,\n this.jestModulePath,\n envRootDir\n );\n } catch (err: any) {\n this.logger.error('jest.tester.watch() caught an error', err);\n }\n });\n }\n\n private async calculateModuleNameMapper(\n env: Environment,\n rootPath: string,\n additionalHostDependencies?: string[]\n ): Promise<Record<string, Array<string>>> {\n const peerDepsConfig: EnvPolicyConfigObject = await env.getDependencies();\n const peersAutoDetectPolicy = new PeersAutoDetectPolicy(peerDepsConfig.peers || []);\n const peers = Object.keys(peerDepsConfig.peerDependencies || {}).concat(peersAutoDetectPolicy?.names);\n const depsToMap = peers.concat(additionalHostDependencies || []);\n\n /**\n * Try to resolve the dependency from the rootDir (the env dir) or from the root path (workspace/capsule root)\n */\n const mappedValues = ['<rootDir>/node_modules/$1', `${rootPath}/node_modules/$1`];\n\n const moduleNameMapper = depsToMap.reduce((acc, peerName) => {\n const keyName = `^(${peerName})$`;\n acc[keyName] = mappedValues;\n const internalPathKeyName = `^(${peerName}/.*)$`;\n acc[internalPathKeyName] = mappedValues;\n return acc;\n }, {});\n\n return moduleNameMapper;\n }\n\n private patternsToArray(patterns: ComponentPatternsMap) {\n return flatten(patterns.toArray().map(([, pattern]) => pattern.map((p) => p.path)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;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AD,CAAH,GAAeJ,YAAf;MACA,MAAMK,mBAAmB,GAAI,KAAIF,QAAS,OAA1C;MACAD,GAAG,CAACG,mBAAD,CAAH,GAA2BL,YAA3B;MACA,OAAOE,GAAP;IACD,CANwB,EAMtB,EANsB,CAAzB;IAQA,OAAOD,gBAAP;EACD;;EAEOxC,eAAe,CAAC9E,QAAD,EAAiC;IACtD,OAAO,IAAA2H,iBAAA,EAAQ3H,QAAQ,CAACe,OAAT,GAAmBC,GAAnB,CAAuB,CAAC,GAAGV,OAAH,CAAD,KAAiBA,OAAO,CAACU,GAAR,CAAa4G,CAAD,IAAOA,CAAC,CAACnH,IAArB,CAAxC,CAAR,CAAP;EACD;;AApQuC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/jest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.808",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/defender/jest",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "jest",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.808"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"@babel/runtime": "7.12.18",
|
|
21
21
|
"core-js": "^3.0.0",
|
|
22
22
|
"@teambit/harmony": "0.3.3",
|
|
23
|
-
"@teambit/cli": "0.0.
|
|
24
|
-
"@teambit/logger": "0.0.
|
|
25
|
-
"@teambit/worker": "0.0.
|
|
26
|
-
"@teambit/component": "0.0.
|
|
27
|
-
"@teambit/dependency-resolver": "0.0.
|
|
28
|
-
"@teambit/envs": "0.0.
|
|
29
|
-
"@teambit/tester": "0.0.
|
|
23
|
+
"@teambit/cli": "0.0.539",
|
|
24
|
+
"@teambit/logger": "0.0.632",
|
|
25
|
+
"@teambit/worker": "0.0.808",
|
|
26
|
+
"@teambit/component": "0.0.808",
|
|
27
|
+
"@teambit/dependency-resolver": "0.0.808",
|
|
28
|
+
"@teambit/envs": "0.0.808",
|
|
29
|
+
"@teambit/tester": "0.0.808",
|
|
30
30
|
"@teambit/tests-results": "0.0.97"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/node": "12.20.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@teambit/legacy": "1.0.
|
|
43
|
+
"@teambit/legacy": "1.0.322",
|
|
44
44
|
"jest": "27.5.1",
|
|
45
45
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.808/dist/jest.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.808/dist/jest.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|