@teambit/jest 1.0.107 → 1.0.109

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.
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.defender/jest-preview"]=t():e["teambit.defender/jest-preview"]=t()}(self,(()=>(()=>{"use strict";var e={93583:(e,t,o)=>{var r={id:"teambit.defender/jest@1.0.109",homepage:"https://bit.cloud/teambit/defender/jest",exported:!0};function n(){const e=i(o(87363));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const p=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-jest.svg"}));p.__bit_component=r,t.Logo=p},87363:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{compositions:()=>f,compositions_metadata:()=>l,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>c});var t=o(93583);o(87363);const n=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var p=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s.apply(this,arguments)}var a={},d="wrapper";function c(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,n.mdx)(d,s({},a,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}c.isMDXComponent=!0;const f=[t],u=[e],l={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
package/dist/error.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare class JestError extends Error {
2
2
  readonly code?: unknown;
3
- readonly type?: string | undefined;
4
- constructor(message: string, stack?: string | null, code?: unknown, type?: string | undefined);
3
+ readonly type?: string;
4
+ constructor(message: string, stack?: string | null, code?: unknown, type?: string);
5
5
  get stack(): any;
6
6
  }
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export declare const Logo: () => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const Logo: () => JSX.Element;
@@ -3,7 +3,7 @@ import { HarmonyWorker } from '@teambit/worker';
3
3
  import { Tester, CallbackFn, TesterContext, Tests } from '@teambit/tester';
4
4
  import { Component } from '@teambit/component';
5
5
  import type { JestWorker } from './jest.worker';
6
- export declare type JestTesterOptions = {
6
+ export type JestTesterOptions = {
7
7
  /**
8
8
  * array of patterns to test. (override the patterns provided by the context)
9
9
  */
@@ -32,7 +32,7 @@ export declare class JestTester implements Tester {
32
32
  displayName: string;
33
33
  _callback: CallbackFn | undefined;
34
34
  displayConfig(): string;
35
- version(): string;
35
+ version(): any;
36
36
  private attachTestsToComponent;
37
37
  private buildTestsObj;
38
38
  private getErrors;
@@ -121,7 +121,7 @@ class JestTester {
121
121
  buildTestsObj(aggregatedResult, components, testerContext, config) {
122
122
  const testsSuiteResult = components.toArray().map(([component, testsFiles]) => {
123
123
  if (!testsFiles) return undefined;
124
- if ((testsFiles === null || testsFiles === void 0 ? void 0 : testsFiles.length) === 0) return undefined;
124
+ if (testsFiles?.length === 0) return undefined;
125
125
  const errors = this.getErrors(testsFiles);
126
126
  const tests = testsFiles.map(test => {
127
127
  const file = new (_sources().AbstractVinyl)({
@@ -135,9 +135,8 @@ class JestTester {
135
135
  const isFailure = testResult.status === 'failed';
136
136
  return new (_testsResults().TestResult)(testResult.ancestorTitles, testResult.title, testResult.status, testResult.duration, isFailure ? undefined : error, isFailure ? error : undefined);
137
137
  });
138
- const filePath = (file === null || file === void 0 ? void 0 : file.basename) || test.testFilePath;
138
+ const filePath = file?.basename || test.testFilePath;
139
139
  const getError = () => {
140
- var _test$testExecError, _test$testExecError2;
141
140
  if (!test.testExecError) return undefined;
142
141
  if (testerContext.watch) {
143
142
  // for some reason, during watch ('bit start'), if a file has an error, the `test.testExecError` is `{}`
@@ -145,7 +144,7 @@ class JestTester {
145
144
  // @todo: consider to always use the failureMessage, regardless the context.watch.
146
145
  return new (_error().JestError)(test.failureMessage);
147
146
  }
148
- return new (_error().JestError)((_test$testExecError = test.testExecError) === null || _test$testExecError === void 0 ? void 0 : _test$testExecError.message, (_test$testExecError2 = test.testExecError) === null || _test$testExecError2 === void 0 ? void 0 : _test$testExecError2.stack);
147
+ return new (_error().JestError)(test.testExecError?.message, test.testExecError?.stack);
149
148
  };
150
149
  const error = getError();
151
150
  return new (_testsResults().TestsFiles)(filePath, testResults, test.numPassingTests, test.numFailingTests, test.numPendingTests, test.perfStats.runtime, test.perfStats.slow, error);
@@ -238,7 +237,6 @@ class JestTester {
238
237
  async watch(context) {
239
238
  // eslint-disable-next-line
240
239
  return new Promise(async resolve => {
241
- var _context$envRuntime$e;
242
240
  const workerApi = this.jestWorker.initiate(context.ui ? {
243
241
  stdout: true,
244
242
  stderr: true,
@@ -251,7 +249,7 @@ class JestTester {
251
249
 
252
250
  // eslint-disable-next-line
253
251
  const jestConfig = require(this.jestConfig);
254
- const envRootDir = (_context$envRuntime$e = context.envRuntime.envAspectDefinition) === null || _context$envRuntime$e === void 0 ? void 0 : _context$envRuntime$e.aspectPath;
252
+ const envRootDir = context.envRuntime.envAspectDefinition?.aspectPath;
255
253
  if (!envRootDir) {
256
254
  this.logger.warn(`jest tester, envRootDir is not defined, for env ${context.envRuntime.id}`);
257
255
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_fsExtra","_minimatch","_interopRequireDefault","_lodash","_comlink","_tester","_testsResults","_jestMessageUtil","_component","_sources","_error","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JestTester","constructor","id","jestConfig","jestModulePath","jestWorker","logger","opts","jestModule","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","_test$testExecError","_test$testExecError2","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","assign","testMatch","patternsToArray","withEnv","testsOutPut","runCLI","componentsWithTests","componentTestResults","Tests","Promise","resolve","_context$envRuntime$e","workerApi","initiate","ui","stdout","stderr","stdin","envRootDir","envRuntime","envAspectDefinition","aspectPath","cbFn","proxy","globalErrors","watchTestResults","loading","onTestComplete","err","flatten","resolveSpecPaths","customPatterns","isEmpty","customPattern","rootDirs","componentDir","resolvePattern","paths","p","pattern","dir","exports"],"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 { Tester, CallbackFn, TesterContext, Tests, ComponentsResults, ComponentPatternsEntry } 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';\n// import { Environment } from '@teambit/envs';\n// import { 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,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;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AAOA,QAAQ,CAAChG,GAAG,CAAEsG,GAAG,IAAK,IAAA9B,eAAO,EAAC8B,GAAG,EAAED,OAAO,CAAC,CAAC;EACrD;AACF;AAACE,OAAA,CAAA9I,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_path","data","require","_fsExtra","_minimatch","_interopRequireDefault","_lodash","_comlink","_tester","_testsResults","_jestMessageUtil","_component","_sources","_error","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JestTester","constructor","id","jestConfig","jestModulePath","jestWorker","logger","opts","jestModule","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","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","flatten","resolveSpecPaths","customPatterns","isEmpty","customPattern","rootDirs","componentDir","resolvePattern","paths","p","pattern","dir","exports"],"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 { Tester, CallbackFn, TesterContext, Tests, ComponentsResults, ComponentPatternsEntry } 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';\n// import { Environment } from '@teambit/envs';\n// import { EnvPolicyConfigObject, PeersAutoDetectPolicy } from '@teambit/dependency-resolver';\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: any;\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,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WA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5D,uBAAuBA,CAC7BR,SAAoB,EACpBM,YAAoC,EACpC8D,OAAsB,EACZ;IACV,IAAI,IAAI,CAAChF,IAAI,CAACyH,gBAAgB,EAAE;MAC9B,OAAO,IAAI,CAACzH,IAAI,CAACyH,gBAAgB,CAAC7G,SAAS,EAAEoE,OAAO,CAAC;IACvD;IACA,MAAM0C,cAAc,GAAG,IAAI,CAAC1H,IAAI,CAACc,QAAQ;IACzC;IACA,IAAI4G,cAAc,IAAI,CAAC,IAAAC,iBAAO,EAACD,cAAc,CAAC,EAAE;MAC9CA,cAAc,CAAC1F,GAAG,CAAE4F,aAAa,IAAK;QACpC,MAAMC,QAAQ,GAAG,IAAI,CAAC7H,IAAI,CAACmF,KAAK,IAAI,CAACjE,YAAY,CAAC4G,YAAY,CAAC;QAC/D,OAAO,IAAI,CAACC,cAAc,CAACH,aAAa,EAAEC,QAAQ,CAAC;MACrD,CAAC,CAAC;IACJ;IACA,OAAO3G,YAAY,CAAC8G,KAAK,CAAChG,GAAG,CAAEiG,CAAC,IAAKA,CAAC,CAAC1F,IAAI,CAAC;EAC9C;EAEQwF,cAAcA,CAACG,OAAe,EAAEL,QAAkB,EAAE;IAC1D,OAAOA,QAAQ,CAAC7F,GAAG,CAAEmG,GAAG,IAAK,IAAA7B,eAAO,EAAC6B,GAAG,EAAED,OAAO,CAAC,CAAC;EACrD;AACF;AAACE,OAAA,CAAA3I,UAAA,GAAAA,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_flatted","data","require","_worker","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JestWorker","constructor","onTestComplete","onTestCompleteCb","watch","jestConfigPath","testFiles","rootPath","jestModulePath","envRootDir","Promise","resolve","console","warn","jestConfig","jestModule","jestConfigWithSpecs","assign","testMatch","config","rootDir","roots","runInBand","silent","watchAll","watchPlugins","__dirname","specFiles","onComplete","results","json","parse","stringify","error","withEnv","res","runCLI","catch","err","exports","expose"],"sources":["jest.worker.ts"],"sourcesContent":["import { stringify, parse } from 'flatted';\nimport { expose } from '@teambit/worker';\nimport type jest from 'jest';\n\nexport class JestWorker {\n private onTestCompleteCb;\n\n onTestComplete(onTestComplete) {\n this.onTestCompleteCb = onTestComplete;\n // return this;\n }\n\n watch(\n jestConfigPath: string,\n testFiles: string[],\n rootPath: string,\n jestModulePath: string,\n envRootDir: string\n ): Promise<void> {\n return new Promise((resolve) => {\n // TODO: remove this after jest publish new version to npm: https://github.com/facebook/jest/pull/10804\n // eslint-disable-next-line\n console.warn = function () {};\n /* The path to the jest config file. */\n // eslint-disable-next-line import/no-dynamic-require,global-require\n const jestConfig = require(jestConfigPath);\n // eslint-disable-next-line import/no-dynamic-require,global-require\n const jestModule: typeof jest = require(jestModulePath);\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: testFiles,\n });\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: [rootPath],\n // useStderr: true,\n // TODO: check way to enable it\n runInBand: true,\n silent: false,\n watch: true,\n watchAll: true,\n watchPlugins: [\n [\n `${__dirname}/watch.js`,\n {\n specFiles: testFiles,\n onComplete: (results) => {\n if (!this.onTestCompleteCb) return;\n try {\n const json = parse(stringify(results));\n this.onTestCompleteCb(json);\n // disable eslint because we want to catch error but not print it on worker\n // eslint-disable-next-line\n } catch (error: any) {}\n },\n },\n ],\n ],\n };\n\n const withEnv = Object.assign(jestConfigWithSpecs, config);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const res = jestModule.runCLI(withEnv, [jestConfigPath]);\n // eslint-disable-next-line no-console\n res.catch((err) => console.error(err));\n resolve();\n });\n }\n}\n\nexpose(new JestWorker());\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAGlC,MAAMW,U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AACiC,MAAM,CAACD,mBAAmB,EAAEG,MAAM,CAAC;MAC1D;MACA,MAAMgB,GAAG,GAAGpB,UAAU,CAACqB,MAAM,CAACF,OAAO,EAAE,CAAC7B,cAAc,CAAC,CAAC;MACxD;MACA8B,GAAG,CAACE,KAAK,CAAEC,GAAG,IAAK1B,OAAO,CAACqB,KAAK,CAACK,GAAG,CAAC,CAAC;MACtC3B,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;EACJ;AACF;AAAC4B,OAAA,CAAAvC,UAAA,GAAAA,UAAA;AAED,IAAAwC,gBAAM,EAAC,IAAIxC,UAAU,CAAC,CAAC,CAAC"}
1
+ {"version":3,"names":["_flatted","data","require","_worker","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JestWorker","constructor","onTestComplete","onTestCompleteCb","watch","jestConfigPath","testFiles","rootPath","jestModulePath","envRootDir","Promise","resolve","console","warn","jestConfig","jestModule","jestConfigWithSpecs","assign","testMatch","config","rootDir","roots","runInBand","silent","watchAll","watchPlugins","__dirname","specFiles","onComplete","results","json","parse","stringify","error","withEnv","res","runCLI","catch","err","exports","expose"],"sources":["jest.worker.ts"],"sourcesContent":["import { stringify, parse } from 'flatted';\nimport { expose } from '@teambit/worker';\n\nexport class JestWorker {\n private onTestCompleteCb;\n\n onTestComplete(onTestComplete) {\n this.onTestCompleteCb = onTestComplete;\n // return this;\n }\n\n watch(\n jestConfigPath: string,\n testFiles: string[],\n rootPath: string,\n jestModulePath: string,\n envRootDir: string\n ): Promise<void> {\n return new Promise((resolve) => {\n // TODO: remove this after jest publish new version to npm: https://github.com/facebook/jest/pull/10804\n // eslint-disable-next-line\n console.warn = function () {};\n /* The path to the jest config file. */\n // eslint-disable-next-line import/no-dynamic-require,global-require\n const jestConfig = require(jestConfigPath);\n // eslint-disable-next-line import/no-dynamic-require,global-require\n const jestModule: any = require(jestModulePath);\n\n const jestConfigWithSpecs = Object.assign(jestConfig, {\n testMatch: testFiles,\n });\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: [rootPath],\n // useStderr: true,\n // TODO: check way to enable it\n runInBand: true,\n silent: false,\n watch: true,\n watchAll: true,\n watchPlugins: [\n [\n `${__dirname}/watch.js`,\n {\n specFiles: testFiles,\n onComplete: (results) => {\n if (!this.onTestCompleteCb) return;\n try {\n const json = parse(stringify(results));\n this.onTestCompleteCb(json);\n // disable eslint because we want to catch error but not print it on worker\n // eslint-disable-next-line\n } catch (error: any) {}\n },\n },\n ],\n ],\n };\n\n const withEnv = Object.assign(jestConfigWithSpecs, config);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const res = jestModule.runCLI(withEnv, [jestConfigPath]);\n // eslint-disable-next-line no-console\n res.catch((err) => console.error(err));\n resolve();\n });\n }\n}\n\nexpose(new JestWorker());\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAG,gBAAAC,GAAA,EAAAC,GA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AAS,EAAEZ;MACb,CAAC,CAAC;MAEF,MAAMa,MAAW,GAAG;QAClB;QACA;QACAC,OAAO,EAAEX,UAAU;QACnB;QACA;QACA;QACA;QACA;QACA;QACA;QACAY,KAAK,EAAE,CAACd,QAAQ,CAAC;QACjB;QACA;QACAe,SAAS,EAAE,IAAI;QACfC,MAAM,EAAE,KAAK;QACbnB,KAAK,EAAE,IAAI;QACXoB,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE,CACZ,CACG,GAAEC,SAAU,WAAU,EACvB;UACEC,SAAS,EAAErB,SAAS;UACpBsB,UAAU,EAAGC,OAAO,IAAK;YACvB,IAAI,CAAC,IAAI,CAAC1B,gBAAgB,EAAE;YAC5B,IAAI;cACF,MAAM2B,IAAI,GAAG,IAAAC,gBAAK,EAAC,IAAAC,oBAAS,EAACH,OAAO,CAAC,CAAC;cACtC,IAAI,CAAC1B,gBAAgB,CAAC2B,IAAI,CAAC;cAC3B;cACA;YACF,CAAC,CAAC,OAAOG,KAAU,EAAE,CAAC;UACxB;QACF,CAAC,CACF;MAEL,CAAC;MAED,MAAMC,OAAO,GAAGlD,MAAM,CAACiC,MAAM,CAACD,mBAAmB,EAAEG,MAAM,CAAC;MAC1D;MACA,MAAMgB,GAAG,GAAGpB,UAAU,CAACqB,MAAM,CAACF,OAAO,EAAE,CAAC7B,cAAc,CAAC,CAAC;MACxD;MACA8B,GAAG,CAACE,KAAK,CAAEC,GAAG,IAAK1B,OAAO,CAACqB,KAAK,CAACK,GAAG,CAAC,CAAC;MACtC3B,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;EACJ;AACF;AAAC4B,OAAA,CAAAvC,UAAA,GAAAA,UAAA;AAED,IAAAwC,gBAAM,EAAC,IAAIxC,UAAU,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@1.0.107/dist/jest.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@1.0.107/dist/jest.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@1.0.109/dist/jest.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_jest@1.0.109/dist/jest.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/dist/watch.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SpecFiles } from '@teambit/tester';
2
- export declare type PluginConfig = {
2
+ export type PluginConfig = {
3
3
  onComplete: (testSuite: any) => void;
4
4
  specFiles: SpecFiles;
5
5
  };
package/dist/watch.js CHANGED
@@ -27,7 +27,7 @@ class Watch {
27
27
  if (paths.includes(specFile)) return true;
28
28
  return false;
29
29
  });
30
- return component === null || component === void 0 ? void 0 : component[0];
30
+ return component?.[0];
31
31
  }
32
32
  apply(jestHooks) {
33
33
  // jestHooks.shouldRunTestSuite(async (testSuite) => {
package/dist/watch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Watch","constructor","stdin","stdout","config","_defineProperty","_stdin","_stdout","_specFiles","specFiles","_onComplete","onComplete","findComponent","specFile","component","toArray","find","specs","paths","map","spec","path","includes","apply","jestHooks","onTestRunComplete","results","module","exports"],"sources":["watch.ts"],"sourcesContent":["import { Prompt, WatchPlugin, JestHookSubscriber, UsageData } from 'jest-watcher';\nimport { SpecFiles } from '@teambit/tester';\n\nexport type PluginConfig = {\n onComplete: (testSuite: any) => void;\n specFiles: SpecFiles;\n};\n\nclass Watch implements WatchPlugin {\n _stdin: NodeJS.ReadStream;\n\n _stdout: NodeJS.WriteStream;\n\n _prompt: Prompt;\n\n _testResults: any;\n\n _usageInfo: UsageData;\n\n _specFiles: SpecFiles;\n\n _onComplete: (testSuite: any) => void;\n\n constructor({\n stdin,\n stdout,\n config,\n }: {\n stdin: NodeJS.ReadStream;\n stdout: NodeJS.WriteStream;\n config: PluginConfig;\n }) {\n this._stdin = stdin;\n this._stdout = stdout;\n this._specFiles = config.specFiles;\n this._onComplete = config.onComplete;\n }\n\n private findComponent(specFile: string) {\n const component = this._specFiles.toArray().find(([, specs]) => {\n const paths = specs.map((spec) => spec.path);\n if (paths.includes(specFile)) return true;\n return false;\n });\n return component?.[0];\n }\n\n apply(jestHooks: JestHookSubscriber) {\n // jestHooks.shouldRunTestSuite(async (testSuite) => {\n // const component = this.findComponent(testSuite.testPath);\n // if ((await component?.isModified()) || (await component?.isNew())) return true;\n // return false;\n // });\n\n jestHooks.onTestRunComplete((results) => {\n this._onComplete(results);\n });\n }\n}\n\nmodule.exports = Watch;\n"],"mappings":";;;;;AAQA,MAAMA,KAAK,CAAwB;EAejCC,WAAWA,CAAC;IACVC,KAAK;IACLC,MAAM;IACNC;EAKF,CAAC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAI,CAACC,MAAM,GAAGJ,KAAK;IACnB,IAAI,CAACK,OAAO,GAAGJ,MAAM;IACrB,IAAI,CAACK,UAAU,GAAGJ,MAAM,CAACK,SAAS;IAClC,IAAI,CAACC,WAAW,GAAGN,MAAM,CAACO,UAAU;EACtC;EAEQC,aAAaA,CAACC,QAAgB,EAAE;IACtC,MAAMC,SAAS,GAAG,IAAI,CAACN,UAAU,CAACO,OAAO,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,GAAGC,KAAK,CAAC,KAAK;MAC9D,MAAMC,KAAK,GAAGD,KAAK,CAACE,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,CAAC;MAC5C,IAAIH,KAAK,CAACI,QAAQ,CAACT,QAAQ,CAAC,EAAE,OAAO,IAAI;MACzC,OAAO,KAAK;IACd,CAAC,CAAC;IACF,OAAOC,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,CAAC,CAAC;EACvB;EAEAS,KAAKA,CAACC,SAA6B,EAAE;IACnC;IACA;IACA;IACA;IACA;;IAEAA,SAAS,CAACC,iBAAiB,CAAEC,OAAO,IAAK;MACvC,IAAI,CAAChB,WAAW,CAACgB,OAAO,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAEAC,MAAM,CAACC,OAAO,GAAG5B,KAAK"}
1
+ {"version":3,"names":["Watch","constructor","stdin","stdout","config","_defineProperty","_stdin","_stdout","_specFiles","specFiles","_onComplete","onComplete","findComponent","specFile","component","toArray","find","specs","paths","map","spec","path","includes","apply","jestHooks","onTestRunComplete","results","module","exports"],"sources":["watch.ts"],"sourcesContent":["import { Prompt, WatchPlugin, JestHookSubscriber, UsageData } from 'jest-watcher';\nimport { SpecFiles } from '@teambit/tester';\n\nexport type PluginConfig = {\n onComplete: (testSuite: any) => void;\n specFiles: SpecFiles;\n};\n\nclass Watch implements WatchPlugin {\n _stdin: NodeJS.ReadStream;\n\n _stdout: NodeJS.WriteStream;\n\n _prompt: Prompt;\n\n _testResults: any;\n\n _usageInfo: UsageData;\n\n _specFiles: SpecFiles;\n\n _onComplete: (testSuite: any) => void;\n\n constructor({\n stdin,\n stdout,\n config,\n }: {\n stdin: NodeJS.ReadStream;\n stdout: NodeJS.WriteStream;\n config: PluginConfig;\n }) {\n this._stdin = stdin;\n this._stdout = stdout;\n this._specFiles = config.specFiles;\n this._onComplete = config.onComplete;\n }\n\n private findComponent(specFile: string) {\n const component = this._specFiles.toArray().find(([, specs]) => {\n const paths = specs.map((spec) => spec.path);\n if (paths.includes(specFile)) return true;\n return false;\n });\n return component?.[0];\n }\n\n apply(jestHooks: JestHookSubscriber) {\n // jestHooks.shouldRunTestSuite(async (testSuite) => {\n // const component = this.findComponent(testSuite.testPath);\n // if ((await component?.isModified()) || (await component?.isNew())) return true;\n // return false;\n // });\n\n jestHooks.onTestRunComplete((results) => {\n this._onComplete(results);\n });\n }\n}\n\nmodule.exports = Watch;\n"],"mappings":";;;;;AAQA,MAAMA,KAAK,CAAwB;EAejCC,WAAWA,CAAC;IACVC,KAAK;IACLC,MAAM;IACNC;EAKF,CAAC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAI,CAACC,MAAM,GAAGJ,KAAK;IACnB,IAAI,CAACK,OAAO,GAAGJ,MAAM;IACrB,IAAI,CAACK,UAAU,GAAGJ,MAAM,CAACK,SAAS;IAClC,IAAI,CAACC,WAAW,GAAGN,MAAM,CAACO,UAAU;EACtC;EAEQC,aAAaA,CAACC,QAAgB,EAAE;IACtC,MAAMC,SAAS,GAAG,IAAI,CAACN,UAAU,CAACO,OAAO,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,GAAGC,KAAK,CAAC,KAAK;MAC9D,MAAMC,KAAK,GAAGD,KAAK,CAACE,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,CAAC;MAC5C,IAAIH,KAAK,CAACI,QAAQ,CAACT,QAAQ,CAAC,EAAE,OAAO,IAAI;MACzC,OAAO,KAAK;IACd,CAAC,CAAC;IACF,OAAOC,SAAS,GAAG,CAAC,CAAC;EACvB;EAEAS,KAAKA,CAACC,SAA6B,EAAE;IACnC;IACA;IACA;IACA;IACA;;IAEAA,SAAS,CAACC,iBAAiB,CAAEC,OAAO,IAAK;MACvC,IAAI,CAAChB,WAAW,CAACgB,OAAO,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAEAC,MAAM,CAACC,OAAO,GAAG5B,KAAK"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/jest",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "homepage": "https://bit.cloud/teambit/defender/jest",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.defender",
8
8
  "name": "jest",
9
- "version": "1.0.107"
9
+ "version": "1.0.109"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -17,31 +17,27 @@
17
17
  "minimatch": "3.0.5",
18
18
  "flatted": "3.1.0",
19
19
  "jest-watcher": "27.5.1",
20
- "core-js": "^3.0.0",
21
- "@babel/runtime": "7.20.0",
22
20
  "@teambit/harmony": "0.4.6",
23
- "@teambit/cli": "0.0.839",
24
- "@teambit/logger": "0.0.932",
25
- "@teambit/worker": "0.0.1143",
26
- "@teambit/component": "1.0.107",
27
- "@teambit/tester": "1.0.107",
28
- "@teambit/tests-results": "1.0.4"
21
+ "@teambit/tests-results": "1.0.4",
22
+ "@teambit/cli": "0.0.841",
23
+ "@teambit/logger": "0.0.934",
24
+ "@teambit/worker": "0.0.1145",
25
+ "@teambit/component": "1.0.109",
26
+ "@teambit/tester": "1.0.109"
29
27
  },
30
28
  "devDependencies": {
31
29
  "@types/lodash": "4.14.165",
32
- "@types/react": "^17.0.8",
33
- "@types/jest": "^26.0.0",
30
+ "@types/jest": "^29.2.2",
34
31
  "@types/fs-extra": "9.0.7",
35
32
  "@types/minimatch": "3.0.4",
36
- "@types/node": "12.20.4",
37
- "@types/react-dom": "^17.0.5",
38
- "@types/testing-library__jest-dom": "5.9.5"
33
+ "@types/testing-library__jest-dom": "^5.9.5",
34
+ "@teambit/harmony.envs.core-aspect-env": "0.0.14"
39
35
  },
40
36
  "peerDependencies": {
41
- "@teambit/legacy": "1.0.624",
37
+ "@teambit/legacy": "1.0.625",
42
38
  "jest": "27.5.1",
43
- "react": "^16.8.0 || ^17.0.0",
44
- "react-dom": "^16.8.0 || ^17.0.0"
39
+ "react": "^17.0.0 || ^18.0.0",
40
+ "@types/react": "^18.2.12"
45
41
  },
46
42
  "license": "Apache-2.0",
47
43
  "optionalDependencies": {},
@@ -55,7 +51,7 @@
55
51
  },
56
52
  "private": false,
57
53
  "engines": {
58
- "node": ">=12.22.0"
54
+ "node": ">=16.0.0"
59
55
  },
60
56
  "repository": {
61
57
  "type": "git",
@@ -64,12 +60,9 @@
64
60
  "keywords": [
65
61
  "bit",
66
62
  "bit-aspect",
63
+ "bit-core-aspect",
67
64
  "components",
68
65
  "collaboration",
69
- "web",
70
- "react",
71
- "react-components",
72
- "angular",
73
- "angular-components"
66
+ "web"
74
67
  ]
75
68
  }
package/tsconfig.json CHANGED
@@ -1,38 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable",
8
- "ScriptHost"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
9
7
  ],
10
- "target": "es2015",
11
- "module": "CommonJS",
12
- "jsx": "react",
13
- "allowJs": true,
14
- "composite": true,
8
+ "target": "es2020",
9
+ "module": "es2020",
10
+ "jsx": "react-jsx",
15
11
  "declaration": true,
16
12
  "sourceMap": true,
17
- "skipLibCheck": true,
18
13
  "experimentalDecorators": true,
19
- "outDir": "dist",
14
+ "skipLibCheck": true,
20
15
  "moduleResolution": "node",
21
16
  "esModuleInterop": true,
22
- "rootDir": ".",
23
17
  "resolveJsonModule": true,
24
- "emitDeclarationOnly": true,
25
- "emitDecoratorMetadata": true,
26
- "allowSyntheticDefaultImports": true,
27
- "strictPropertyInitialization": false,
28
- "strict": true,
29
- "noImplicitAny": false,
30
- "preserveConstEnums": true
18
+ "allowJs": true,
19
+ "outDir": "dist",
20
+ "emitDeclarationOnly": true
31
21
  },
32
22
  "exclude": [
23
+ "artifacts",
24
+ "public",
33
25
  "dist",
26
+ "node_modules",
27
+ "package.json",
34
28
  "esm.mjs",
35
- "package.json"
29
+ "**/*.cjs",
30
+ "./dist"
36
31
  ],
37
32
  "include": [
38
33
  "**/*",
package/types/asset.d.ts CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
5
5
  declare module '*.svg' {
6
6
  import type { FunctionComponent, SVGProps } from 'react';
7
7
 
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
9
11
  const src: string;
10
12
  export default src;
11
13
  }
12
-
13
- // @TODO Gilad
14
14
  declare module '*.jpg' {
15
15
  const value: any;
16
16
  export = value;
@@ -27,3 +27,15 @@ declare module '*.bmp' {
27
27
  const value: any;
28
28
  export = value;
29
29
  }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }