@teambit/jest 0.0.821 → 0.0.824

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.
@@ -1,13 +1,13 @@
1
1
  import { LoggerMain, Logger } from '@teambit/logger';
2
2
  import { WorkerMain, HarmonyWorker } from '@teambit/worker';
3
- import { JestTester } from './jest.tester';
3
+ import { JestTester, JestTesterOptions } from './jest.tester';
4
4
  import type { JestWorker } from './jest.worker';
5
5
  export declare const WORKER_NAME = "jest";
6
6
  export declare class JestMain {
7
7
  private jestWorker;
8
8
  private logger;
9
9
  constructor(jestWorker: HarmonyWorker<JestWorker>, logger: Logger);
10
- createTester(jestConfig: any, jestModulePath?: string): JestTester;
10
+ createTester(jestConfig: any, jestModulePath?: string, opts?: JestTesterOptions): JestTester;
11
11
  static runtime: import("@teambit/harmony").RuntimeDefinition;
12
12
  static dependencies: import("@teambit/harmony").Aspect[];
13
13
  static provider([worker, loggerAspect]: [WorkerMain, LoggerMain]): Promise<JestMain>;
@@ -80,8 +80,8 @@ class JestMain {
80
80
  this.logger = logger;
81
81
  }
82
82
 
83
- createTester(jestConfig, jestModulePath = require.resolve('jest')) {
84
- return new (_jest2().JestTester)(_jest().JestAspect.id, jestConfig, jestModulePath, this.jestWorker, this.logger);
83
+ createTester(jestConfig, jestModulePath = require.resolve('jest'), opts) {
84
+ return new (_jest2().JestTester)(_jest().JestAspect.id, jestConfig, jestModulePath, this.jestWorker, this.logger, opts);
85
85
  }
86
86
 
87
87
  static async provider([worker, loggerAspect]) {
@@ -1 +1 @@
1
- {"version":3,"names":["WORKER_NAME","JestMain","constructor","jestWorker","logger","createTester","jestConfig","jestModulePath","require","resolve","JestTester","JestAspect","id","provider","worker","loggerAspect","createLogger","declareWorker","MainRuntime","WorkerAspect","LoggerAspect","addRuntime"],"sources":["jest.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { WorkerAspect, WorkerMain, HarmonyWorker } from '@teambit/worker';\nimport { JestAspect } from './jest.aspect';\nimport { JestTester } from './jest.tester';\nimport type { JestWorker } from './jest.worker';\n\nexport const WORKER_NAME = 'jest';\n\nexport class JestMain {\n constructor(private jestWorker: HarmonyWorker<JestWorker>, private logger: Logger) {}\n\n createTester(jestConfig: any, jestModulePath = require.resolve('jest')) {\n return new JestTester(JestAspect.id, jestConfig, jestModulePath, this.jestWorker, this.logger);\n }\n\n static runtime = MainRuntime;\n static dependencies = [WorkerAspect, LoggerAspect];\n\n static async provider([worker, loggerAspect]: [WorkerMain, LoggerMain]) {\n const logger = loggerAspect.createLogger(JestAspect.id);\n const jestWorker = await worker.declareWorker<JestWorker>(WORKER_NAME, require.resolve('./jest.worker'));\n return new JestMain(jestWorker, logger);\n }\n}\n\nJestAspect.addRuntime(JestMain);\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;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,WAAW,GAAG,MAApB;;;AAEA,MAAMC,QAAN,CAAe;EACpBC,WAAW,CAASC,UAAT,EAAwDC,MAAxD,EAAwE;IAAA,KAA/DD,UAA+D,GAA/DA,UAA+D;IAAA,KAAhBC,MAAgB,GAAhBA,MAAgB;EAAE;;EAErFC,YAAY,CAACC,UAAD,EAAkBC,cAAc,GAAGC,OAAO,CAACC,OAAR,CAAgB,MAAhB,CAAnC,EAA4D;IACtE,OAAO,KAAIC,mBAAJ,EAAeC,kBAAA,CAAWC,EAA1B,EAA8BN,UAA9B,EAA0CC,cAA1C,EAA0D,KAAKJ,UAA/D,EAA2E,KAAKC,MAAhF,CAAP;EACD;;EAKoB,aAARS,QAAQ,CAAC,CAACC,MAAD,EAASC,YAAT,CAAD,EAAmD;IACtE,MAAMX,MAAM,GAAGW,YAAY,CAACC,YAAb,CAA0BL,kBAAA,CAAWC,EAArC,CAAf;IACA,MAAMT,UAAU,GAAG,MAAMW,MAAM,CAACG,aAAP,CAAiCjB,WAAjC,EAA8CQ,OAAO,CAACC,OAAR,CAAgB,eAAhB,CAA9C,CAAzB;IACA,OAAO,IAAIR,QAAJ,CAAaE,UAAb,EAAyBC,MAAzB,CAAP;EACD;;AAdmB;;;gCAATH,Q,aAOMiB,kB;gCAPNjB,Q,kBAQW,CAACkB,sBAAD,EAAeC,sBAAf,C;;AASxBT,kBAAA,CAAWU,UAAX,CAAsBpB,QAAtB"}
1
+ {"version":3,"names":["WORKER_NAME","JestMain","constructor","jestWorker","logger","createTester","jestConfig","jestModulePath","require","resolve","opts","JestTester","JestAspect","id","provider","worker","loggerAspect","createLogger","declareWorker","MainRuntime","WorkerAspect","LoggerAspect","addRuntime"],"sources":["jest.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { WorkerAspect, WorkerMain, HarmonyWorker } from '@teambit/worker';\nimport { JestAspect } from './jest.aspect';\nimport { JestTester, JestTesterOptions } from './jest.tester';\nimport type { JestWorker } from './jest.worker';\n\nexport const WORKER_NAME = 'jest';\n\nexport class JestMain {\n constructor(private jestWorker: HarmonyWorker<JestWorker>, private logger: Logger) {}\n\n createTester(jestConfig: any, jestModulePath = require.resolve('jest'), opts?: JestTesterOptions) {\n return new JestTester(JestAspect.id, jestConfig, jestModulePath, this.jestWorker, this.logger, opts);\n }\n\n static runtime = MainRuntime;\n static dependencies = [WorkerAspect, LoggerAspect];\n\n static async provider([worker, loggerAspect]: [WorkerMain, LoggerMain]) {\n const logger = loggerAspect.createLogger(JestAspect.id);\n const jestWorker = await worker.declareWorker<JestWorker>(WORKER_NAME, require.resolve('./jest.worker'));\n return new JestMain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 -1,15 +1,33 @@
1
1
  import { Logger } from '@teambit/logger';
2
2
  import { HarmonyWorker } from '@teambit/worker';
3
3
  import { Tester, CallbackFn, TesterContext, Tests } from '@teambit/tester';
4
+ import { Component } from '@teambit/component';
4
5
  import type { JestWorker } from './jest.worker';
6
+ export declare type JestTesterOptions = {
7
+ /**
8
+ * array of patterns to test. (override the patterns provided by the context)
9
+ */
10
+ patterns?: string[];
11
+ /**
12
+ * add more root paths to look for tests.
13
+ */
14
+ roots?: string[];
15
+ /**
16
+ * A function that knows to resolve the paths of the spec files.
17
+ * This usually used when you want only subset of your spec files to be used
18
+ * (usually when you use multi tester with different specs files for each tester instance).
19
+ */
20
+ resolveSpecPaths?: (component: Component, context: TesterContext) => string[];
21
+ };
5
22
  export declare class JestTester implements Tester {
6
23
  readonly id: string;
7
24
  readonly jestConfig: any;
8
25
  private jestModulePath;
9
26
  private jestWorker;
10
27
  private logger;
28
+ private opts;
11
29
  private readonly jestModule;
12
- constructor(id: string, jestConfig: any, jestModulePath: string, jestWorker: HarmonyWorker<JestWorker>, logger: Logger);
30
+ constructor(id: string, jestConfig: any, jestModulePath: string, jestWorker: HarmonyWorker<JestWorker>, logger: Logger, opts?: JestTesterOptions);
13
31
  configPath: any;
14
32
  displayName: string;
15
33
  _callback: CallbackFn | undefined;
@@ -23,4 +41,6 @@ export declare class JestTester implements Tester {
23
41
  watch(context: TesterContext): Promise<Tests>;
24
42
  private calculateModuleNameMapper;
25
43
  private patternsToArray;
44
+ private resolveComponentPattern;
45
+ private resolvePattern;
26
46
  }
@@ -21,6 +21,16 @@ function _defineProperty2() {
21
21
  return data;
22
22
  }
23
23
 
24
+ function _path() {
25
+ const data = require("path");
26
+
27
+ _path = function () {
28
+ return data;
29
+ };
30
+
31
+ return data;
32
+ }
33
+
24
34
  function _fsExtra() {
25
35
  const data = require("fs-extra");
26
36
 
@@ -132,12 +142,13 @@ function _error() {
132
142
  }
133
143
 
134
144
  class JestTester {
135
- constructor(id, jestConfig, jestModulePath, jestWorker, logger) {
145
+ constructor(id, jestConfig, jestModulePath, jestWorker, logger, opts = {}) {
136
146
  this.id = id;
137
147
  this.jestConfig = jestConfig;
138
148
  this.jestModulePath = jestModulePath;
139
149
  this.jestWorker = jestWorker;
140
150
  this.logger = logger;
151
+ this.opts = opts;
141
152
  (0, _defineProperty2().default)(this, "jestModule", void 0);
142
153
  (0, _defineProperty2().default)(this, "configPath", this.jestConfig);
143
154
  (0, _defineProperty2().default)(this, "displayName", 'Jest');
@@ -156,11 +167,12 @@ class JestTester {
156
167
 
157
168
  attachTestsToComponent(testerContext, testResult) {
158
169
  return _component().ComponentMap.as(testerContext.components, component => {
159
- const componentSpecFiles = testerContext.patterns.get(component);
160
- if (!componentSpecFiles) return undefined;
161
- const [, specs] = componentSpecFiles;
170
+ const componentPatternValue = testerContext.patterns.get(component);
171
+ if (!componentPatternValue) return undefined;
172
+ const [currComponent, patternEntry] = componentPatternValue;
173
+ const resolvedPatterns = this.resolveComponentPattern(currComponent, patternEntry, testerContext);
162
174
  return testResult.filter(test => {
163
- return specs.filter(pattern => (0, _minimatch().default)(test.testFilePath, pattern.path)).length > 0;
175
+ return resolvedPatterns.filter(resolvedPattern => (0, _minimatch().default)(test.testFilePath, resolvedPattern)).length > 0;
164
176
  });
165
177
  });
166
178
  }
@@ -283,7 +295,7 @@ class JestTester {
283
295
 
284
296
 
285
297
  const jestConfigWithSpecs = Object.assign(jestConfig, {
286
- testMatch: this.patternsToArray(context.patterns)
298
+ testMatch: this.patternsToArray(context)
287
299
  });
288
300
  const withEnv = Object.assign(jestConfigWithSpecs, config);
289
301
  const testsOutPut = await this.jestModule.runCLI(withEnv, [this.jestConfig]);
@@ -317,7 +329,7 @@ class JestTester {
317
329
  }
318
330
 
319
331
  const jestConfigWithSpecs = Object.assign(jestConfig, {
320
- testMatch: this.patternsToArray(context.patterns)
332
+ testMatch: this.patternsToArray(context)
321
333
  });
322
334
 
323
335
  try {
@@ -339,7 +351,7 @@ class JestTester {
339
351
  }); // eslint-disable-next-line @typescript-eslint/no-floating-promises
340
352
 
341
353
  await workerApi.onTestComplete(cbFn);
342
- await workerApi.watch(this.jestConfig, this.patternsToArray(context.patterns), context.rootPath, this.jestModulePath, envRootDir);
354
+ await workerApi.watch(this.jestConfig, this.patternsToArray(context), context.rootPath, this.jestModulePath, envRootDir);
343
355
  } catch (err) {
344
356
  this.logger.error('jest.tester.watch() caught an error', err);
345
357
  }
@@ -366,8 +378,31 @@ class JestTester {
366
378
  return moduleNameMapper;
367
379
  }
368
380
 
369
- patternsToArray(patterns) {
370
- return (0, _lodash().flatten)(patterns.toArray().map(([, pattern]) => pattern.map(p => p.path)));
381
+ patternsToArray(context) {
382
+ return (0, _lodash().flatten)(context.patterns.toArray().map(([component, patternEntry]) => {
383
+ return this.resolveComponentPattern(component, patternEntry, context);
384
+ }));
385
+ }
386
+
387
+ resolveComponentPattern(component, patternEntry, context) {
388
+ if (this.opts.resolveSpecPaths) {
389
+ return this.opts.resolveSpecPaths(component, context);
390
+ }
391
+
392
+ const customPatterns = this.opts.patterns; // If pattern were provided to the specific instance of the tester, use them
393
+
394
+ if (customPatterns && !(0, _lodash().isEmpty)(customPatterns)) {
395
+ customPatterns.map(customPattern => {
396
+ const rootDirs = this.opts.roots || [patternEntry.componentDir];
397
+ return this.resolvePattern(customPattern, rootDirs);
398
+ });
399
+ }
400
+
401
+ return patternEntry.paths.map(p => p.path);
402
+ }
403
+
404
+ resolvePattern(pattern, rootDirs) {
405
+ return rootDirs.map(dir => (0, _path().resolve)(dir, pattern));
371
406
  }
372
407
 
373
408
  }
@@ -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","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;;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;EA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BC,GAAnB,CAAuB,CAAC,GAAGV,OAAH,CAAD,KAAiBA,OAAO,CAACU,GAAR,CAAa4G,CAAD,IAAOA,CAAC,CAACnH,IAArB,CAAxC,CAAR,CAAP;EACD;;AApQuC"}
1
+ {"version":3,"names":["JestTester","constructor","id","jestConfig","jestModulePath","jestWorker","logger","opts","jestModule","require","displayConfig","readFileSync","version","getVersion","attachTestsToComponent","testerContext","testResult","ComponentMap","as","components","component","componentPatternValue","patterns","get","undefined","currComponent","patternEntry","resolvedPatterns","resolveComponentPattern","filter","test","resolvedPattern","minimatch","testFilePath","length","buildTestsObj","aggregatedResult","config","testsSuiteResult","toArray","map","testsFiles","errors","getErrors","tests","file","AbstractVinyl","path","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","resolveSpecPaths","customPatterns","isEmpty","customPattern","rootDirs","componentDir","resolvePattern","paths","p","pattern","dir"],"sources":["jest.tester.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { readFileSync } from 'fs-extra';\nimport minimatch from 'minimatch';\nimport { compact, flatten, isEmpty } from 'lodash';\nimport { proxy } from 'comlink';\nimport { Logger } from '@teambit/logger';\nimport { HarmonyWorker } from '@teambit/worker';\nimport {\n Tester,\n CallbackFn,\n TesterContext,\n Tests,\n ComponentsResults,\n ComponentPatternsEntry,\n} 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 { Component, 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 type JestTesterOptions = {\n /**\n * array of patterns to test. (override the patterns provided by the context)\n */\n patterns?: string[];\n\n /**\n * add more root paths to look for tests.\n */\n roots?: string[];\n\n /**\n * A function that knows to resolve the paths of the spec files.\n * This usually used when you want only subset of your spec files to be used\n * (usually when you use multi tester with different specs files for each tester instance).\n */\n resolveSpecPaths?: (component: Component, context: TesterContext) => string[];\n};\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 private opts: JestTesterOptions = {}\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 componentPatternValue = testerContext.patterns.get(component);\n if (!componentPatternValue) return undefined;\n const [currComponent, patternEntry] = componentPatternValue;\n const resolvedPatterns = this.resolveComponentPattern(currComponent, patternEntry, testerContext);\n return testResult.filter((test) => {\n return resolvedPatterns.filter((resolvedPattern) => minimatch(test.testFilePath, resolvedPattern)).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),\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 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),\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),\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(context: TesterContext): string[] {\n return flatten(\n context.patterns.toArray().map(([component, patternEntry]) => {\n return this.resolveComponentPattern(component, patternEntry, context);\n })\n );\n }\n\n private resolveComponentPattern(\n component: Component,\n patternEntry: ComponentPatternsEntry,\n context: TesterContext\n ): string[] {\n if (this.opts.resolveSpecPaths) {\n return this.opts.resolveSpecPaths(component, context);\n }\n const customPatterns = this.opts.patterns;\n // If pattern were provided to the specific instance of the tester, use them\n if (customPatterns && !isEmpty(customPatterns)) {\n customPatterns.map((customPattern) => {\n const rootDirs = this.opts.roots || [patternEntry.componentDir];\n return this.resolvePattern(customPattern, rootDirs);\n });\n }\n return patternEntry.paths.map((p) => p.path);\n }\n\n private resolvePattern(pattern: string, rootDirs: string[]) {\n return rootDirs.map((dir) => resolve(dir, pattern));\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;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;EAAA;;EAA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hSuC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/jest",
3
- "version": "0.0.821",
3
+ "version": "0.0.824",
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.821"
9
+ "version": "0.0.824"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -20,27 +20,27 @@
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.549",
24
- "@teambit/logger": "0.0.642",
25
- "@teambit/worker": "0.0.821",
26
- "@teambit/component": "0.0.821",
27
- "@teambit/dependency-resolver": "0.0.821",
28
- "@teambit/envs": "0.0.821",
29
- "@teambit/tester": "0.0.821",
23
+ "@teambit/cli": "0.0.552",
24
+ "@teambit/logger": "0.0.645",
25
+ "@teambit/worker": "0.0.824",
26
+ "@teambit/component": "0.0.824",
27
+ "@teambit/dependency-resolver": "0.0.824",
28
+ "@teambit/envs": "0.0.824",
29
+ "@teambit/tester": "0.0.824",
30
30
  "@teambit/tests-results": "0.0.97"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "4.14.165",
34
34
  "@types/react": "^17.0.8",
35
35
  "@types/fs-extra": "9.0.7",
36
+ "@types/jest": "^26.0.0",
36
37
  "@types/minimatch": "3.0.4",
37
38
  "@types/testing-library__jest-dom": "5.9.5",
38
- "@types/jest": "^26.0.0",
39
39
  "@types/react-dom": "^17.0.5",
40
40
  "@types/node": "12.20.4"
41
41
  },
42
42
  "peerDependencies": {
43
- "@teambit/legacy": "1.0.332",
43
+ "@teambit/legacy": "1.0.335",
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.821/dist/jest.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.821/dist/jest.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.824/dist/jest.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@0.0.824/dist/jest.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];