@teambit/tester 0.0.823 → 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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TesterAspect } from './tester.aspect';
2
2
  export { Tests } from './tester';
3
- export type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults } from './tester';
3
+ export type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults, ComponentPatternsEntry } from './tester';
4
4
  export type { TesterMain } from './tester.main.runtime';
5
5
  export type { TesterUI, EmptyStateSlot } from './tester.ui.runtime';
6
6
  export { TesterAspect };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["TesterAspect"],"sources":["index.ts"],"sourcesContent":["import { TesterAspect } from './tester.aspect';\n\nexport { Tests } from './tester';\nexport type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults } from './tester';\nexport type { TesterMain } from './tester.main.runtime';\nexport type { TesterUI, EmptyStateSlot } from './tester.ui.runtime';\n\nexport { TesterAspect };\nexport default TesterAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAMeA,sB"}
1
+ {"version":3,"names":["TesterAspect"],"sources":["index.ts"],"sourcesContent":["import { TesterAspect } from './tester.aspect';\n\nexport { Tests } from './tester';\nexport type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults, ComponentPatternsEntry } from './tester';\nexport type { TesterMain } from './tester.main.runtime';\nexport type { TesterUI, EmptyStateSlot } from './tester.ui.runtime';\n\nexport { TesterAspect };\nexport default TesterAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAMeA,sB"}
package/dist/tester.d.ts CHANGED
@@ -26,10 +26,14 @@ export declare type ComponentsResults = {
26
26
  loading?: boolean;
27
27
  };
28
28
  export declare type SpecFiles = ComponentMap<AbstractVinyl[]>;
29
- export declare type ComponentPatternsMap = ComponentMap<{
30
- path: string;
31
- relative: string;
32
- }[]>;
29
+ export declare type ComponentPatternsEntry = {
30
+ componentDir: string;
31
+ paths: {
32
+ path: string;
33
+ relative: string;
34
+ }[];
35
+ };
36
+ export declare type ComponentPatternsMap = ComponentMap<ComponentPatternsEntry>;
33
37
  export interface TesterContext extends ExecutionContext {
34
38
  /**
35
39
  * whether the tester run for release (during bit build/tag) or not (during bit test command).
@@ -1 +1 @@
1
- {"version":3,"names":["Tests","constructor","components","errors","map","comp","flat"],"sources":["tester.ts"],"sourcesContent":["import { Component, ComponentID, ComponentMap } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { TestsResult } from '@teambit/tests-results';\n\nexport class Tests {\n constructor(public components: ComponentsResults[]) {}\n get errors(): Error[] {\n return this.components.map((comp) => comp.errors || []).flat();\n }\n}\n\nexport type ComponentsResults = {\n /**\n * component id.\n */\n componentId: ComponentID;\n /**\n * test results for the component.\n */\n results?: TestsResult;\n /**\n * aggregated errors from all files\n */\n errors?: Error[];\n\n /**\n * loading.\n */\n loading?: boolean;\n};\n\nexport type SpecFiles = ComponentMap<AbstractVinyl[]>;\nexport type ComponentPatternsMap = ComponentMap<{ path: string; relative: string }[]>;\n\nexport interface TesterContext extends ExecutionContext {\n /**\n * whether the tester run for release (during bit build/tag) or not (during bit test command).\n */\n release: boolean;\n\n /**\n * list of components to test.\n */\n components: Component[];\n\n /**\n * component workspace.\n */\n // workspace: Workspace;\n\n /**\n * defines whether tester is expected to run in quiet mode.\n */\n quiet?: boolean;\n\n /**\n * list of spec files to test.\n */\n specFiles: SpecFiles;\n\n /**\n * rootPath of the component workspace or the capsule root dir (during build).\n */\n rootPath: string;\n\n /**\n * determines whether tester is expected to run in debug mode.\n */\n debug?: boolean;\n\n /**\n * is start from ui\n */\n ui?: boolean;\n\n /**\n * determines whether to start the tester in watch mode.\n */\n watch?: boolean;\n\n /**\n * whether the tester should show code coverage\n */\n coverage?: boolean;\n\n /**\n * array of patterns to test.\n */\n patterns: ComponentPatternsMap;\n\n /**\n *\n * additional test host dependencies\n * This can be used in cases when you want specific dependencies to be resolved from the env during testing\n * but you don't want these dependencies as peer dependencies of the component (as they are not used during runtime)\n * An example for this is @angular/compiler, which during running tests you want to resolve from the env, but you don't\n * need it during component runtime.\n */\n additionalHostDependencies?: string[];\n}\n\n/**\n * tester interface allows extensions to implement a component tester into bit.\n */\nexport interface Tester {\n /**\n * display name of the tester.\n */\n displayName?: string;\n\n /**\n * icon of the tester.\n */\n icon?: string;\n\n /**\n * serialized config of the tester.\n */\n displayConfig?(): string;\n\n /**\n * path to the config in the filesystem.\n */\n configPath?: string;\n\n /**\n * id of the tester.\n */\n id: string;\n\n /**\n * on test run complete. (applies only during watch)\n * @param callback\n */\n onTestRunComplete?(callback: CallbackFn): Promise<void>;\n\n /**\n * execute tests on all components in the given execution context.\n */\n test(context: TesterContext): Promise<Tests>;\n\n /**\n * watch tests on all components\n */\n watch?(context: TesterContext): Promise<Tests>;\n /**\n * return the tester version.\n */\n version(): string;\n}\nexport type CallbackFn = (testSuite: Tests) => void;\n"],"mappings":";;;;;;;;;;;AAKO,MAAMA,KAAN,CAAY;EACjBC,WAAW,CAAQC,UAAR,EAAyC;IAAA,KAAjCA,UAAiC,GAAjCA,UAAiC;EAAE;;EAC5C,IAANC,MAAM,GAAY;IACpB,OAAO,KAAKD,UAAL,CAAgBE,GAAhB,CAAqBC,IAAD,IAAUA,IAAI,CAACF,MAAL,IAAe,EAA7C,EAAiDG,IAAjD,EAAP;EACD;;AAJgB"}
1
+ {"version":3,"names":["Tests","constructor","components","errors","map","comp","flat"],"sources":["tester.ts"],"sourcesContent":["import { Component, ComponentID, ComponentMap } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { TestsResult } from '@teambit/tests-results';\n\nexport class Tests {\n constructor(public components: ComponentsResults[]) {}\n get errors(): Error[] {\n return this.components.map((comp) => comp.errors || []).flat();\n }\n}\n\nexport type ComponentsResults = {\n /**\n * component id.\n */\n componentId: ComponentID;\n /**\n * test results for the component.\n */\n results?: TestsResult;\n /**\n * aggregated errors from all files\n */\n errors?: Error[];\n\n /**\n * loading.\n */\n loading?: boolean;\n};\n\nexport type SpecFiles = ComponentMap<AbstractVinyl[]>;\nexport type ComponentPatternsEntry = { componentDir: string, paths: {path: string; relative: string}[]};\nexport type ComponentPatternsMap = ComponentMap<ComponentPatternsEntry>;\n\nexport interface TesterContext extends ExecutionContext {\n /**\n * whether the tester run for release (during bit build/tag) or not (during bit test command).\n */\n release: boolean;\n\n /**\n * list of components to test.\n */\n components: Component[];\n\n /**\n * component workspace.\n */\n // workspace: Workspace;\n\n /**\n * defines whether tester is expected to run in quiet mode.\n */\n quiet?: boolean;\n\n /**\n * list of spec files to test.\n */\n specFiles: SpecFiles;\n\n /**\n * rootPath of the component workspace or the capsule root dir (during build).\n */\n rootPath: string;\n\n /**\n * determines whether tester is expected to run in debug mode.\n */\n debug?: boolean;\n\n /**\n * is start from ui\n */\n ui?: boolean;\n\n /**\n * determines whether to start the tester in watch mode.\n */\n watch?: boolean;\n\n /**\n * whether the tester should show code coverage\n */\n coverage?: boolean;\n\n /**\n * array of patterns to test.\n */\n patterns: ComponentPatternsMap;\n\n /**\n *\n * additional test host dependencies\n * This can be used in cases when you want specific dependencies to be resolved from the env during testing\n * but you don't want these dependencies as peer dependencies of the component (as they are not used during runtime)\n * An example for this is @angular/compiler, which during running tests you want to resolve from the env, but you don't\n * need it during component runtime.\n */\n additionalHostDependencies?: string[];\n}\n\n/**\n * tester interface allows extensions to implement a component tester into bit.\n */\nexport interface Tester {\n /**\n * display name of the tester.\n */\n displayName?: string;\n\n /**\n * icon of the tester.\n */\n icon?: string;\n\n /**\n * serialized config of the tester.\n */\n displayConfig?(): string;\n\n /**\n * path to the config in the filesystem.\n */\n configPath?: string;\n\n /**\n * id of the tester.\n */\n id: string;\n\n /**\n * on test run complete. (applies only during watch)\n * @param callback\n */\n onTestRunComplete?(callback: CallbackFn): Promise<void>;\n\n /**\n * execute tests on all components in the given execution context.\n */\n test(context: TesterContext): Promise<Tests>;\n\n /**\n * watch tests on all components\n */\n watch?(context: TesterContext): Promise<Tests>;\n /**\n * return the tester version.\n */\n version(): string;\n}\nexport type CallbackFn = (testSuite: Tests) => void;\n"],"mappings":";;;;;;;;;;;AAKO,MAAMA,KAAN,CAAY;EACjBC,WAAW,CAAQC,UAAR,EAAyC;IAAA,KAAjCA,UAAiC,GAAjCA,UAAiC;EAAE;;EAC5C,IAANC,MAAM,GAAY;IACpB,OAAO,KAAKD,UAAL,CAAgBE,GAAhB,CAAqBC,IAAD,IAAUA,IAAI,CAACF,MAAL,IAAe,EAA7C,EAAiDG,IAAjD,EAAP;EACD;;AAJgB"}
@@ -168,12 +168,15 @@ class TesterService {
168
168
  if (!options.ui) this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\n`);
169
169
 
170
170
  const patterns = _component().ComponentMap.as(context.components, component => {
171
- const dir = this.workspace.componentDir(component.id);
171
+ const componentDir = this.workspace.componentDir(component.id);
172
172
  const componentPatterns = this.devFiles.getDevPatterns(component, _tester2().TesterAspect.id);
173
- return componentPatterns.map(pattern => ({
174
- path: (0, _path().resolve)(dir, pattern),
175
- relative: pattern
176
- }));
173
+ return {
174
+ componentDir,
175
+ paths: componentPatterns.map(pattern => ({
176
+ path: (0, _path().resolve)(componentDir, pattern),
177
+ relative: pattern
178
+ })) || []
179
+ };
177
180
  });
178
181
 
179
182
  let additionalHostDependencies = [];
@@ -1 +1 @@
1
- {"version":3,"names":["chalk","require","OnTestsChanged","TesterService","constructor","workspace","logger","pubsub","devFiles","render","env","descriptor","getDescriptor","id","displayName","version","highlight","config","language","ignoreIllegals","environment","getTester","undefined","tester","icon","displayConfig","onTestRunComplete","callback","_callback","run","context","options","specFiles","ComponentMap","as","components","component","detectTestFiles","testCount","toArray","reduce","acc","specs","length","componentWithTests","ui","consoleWarning","cyan","Tests","console","patterns","dir","componentDir","componentPatterns","getDevPatterns","TesterAspect","map","pattern","path","resolve","relative","additionalHostDependencies","getAdditionalTestHostDependencies","testerContext","Object","assign","release","rootPath","debug","watch","coverage","results","forEach","publish","testsChanged","componentId","toString","testsResults","loading","test"],"sources":["tester.service.tsx"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { resolve } from 'path';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport { PubSubEngine } from 'graphql-subscriptions';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { Tester, Tests, CallbackFn } from './tester';\nimport { TesterAspect } from './tester.aspect';\nimport { TesterOptions } from './tester.main.runtime';\nimport { detectTestFiles } from './utils';\n\nconst chalk = require('chalk');\n\nexport const OnTestsChanged = 'OnTestsChanged';\n\nexport type TesterDescriptor = {\n /**\n * id of the tester (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the tester (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured tester.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class TesterService implements EnvService<Tests, TesterDescriptor> {\n name = 'tester';\n\n constructor(\n readonly workspace: Workspace,\n\n private logger: Logger,\n\n private pubsub: PubSubEngine,\n\n private devFiles: DevFilesMain\n ) {}\n\n _callback: CallbackFn | undefined;\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured tester: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n tester config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(environment: EnvDefinition) {\n if (!environment.env.getTester) return undefined;\n const tester: Tester = environment.env.getTester();\n\n return {\n id: tester.id || '',\n displayName: tester.displayName || '',\n icon: tester.icon || '',\n config: tester.displayConfig ? tester.displayConfig() : '',\n version: tester.version ? tester.version() : '?',\n };\n }\n\n onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async run(context: ExecutionContext, options: TesterOptions): Promise<Tests> {\n const tester: Tester = context.env.getTester();\n const specFiles = ComponentMap.as(context.components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n const testCount = specFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);\n\n const componentWithTests = specFiles.toArray().reduce((acc: number, [, specs]) => {\n if (specs.length > 0) acc += 1;\n return acc;\n }, 0);\n\n if (testCount === 0 && !options.ui) {\n this.logger.consoleWarning(`no tests found for environment ${chalk.cyan(context.id)}\\n`);\n return new Tests([]);\n }\n\n if (!options.ui)\n this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\\n`);\n\n const patterns = ComponentMap.as(context.components, (component) => {\n const dir = this.workspace.componentDir(component.id);\n const componentPatterns = this.devFiles.getDevPatterns(component, TesterAspect.id);\n return componentPatterns.map((pattern: string) => ({ path: resolve(dir, pattern), relative: pattern }));\n });\n\n let additionalHostDependencies = [];\n if (\n context.env.getAdditionalTestHostDependencies &&\n typeof context.env.getAdditionalTestHostDependencies === 'function'\n ) {\n additionalHostDependencies = await context.env.getAdditionalTestHostDependencies();\n }\n\n const testerContext = Object.assign(context, {\n release: false,\n specFiles,\n patterns,\n rootPath: this.workspace.path,\n workspace: this.workspace,\n debug: options.debug,\n watch: options.watch,\n ui: options.ui,\n coverage: options.coverage,\n additionalHostDependencies,\n });\n\n if (options.watch && options.ui && tester.watch) {\n if (tester.onTestRunComplete) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tester.onTestRunComplete((results) => {\n if (this._callback) this._callback(results);\n results.components.forEach((component) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.pubsub.publish(OnTestsChanged, {\n testsChanged: {\n id: component.componentId.toString(),\n testsResults: component.results,\n loading: component.loading,\n },\n });\n });\n });\n }\n\n return tester.watch(testerContext);\n }\n\n const results = await tester.test(testerContext);\n\n return results;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAArB;;AAEO,MAAMC,cAAc,GAAG,gBAAvB;;;AA0BA,MAAMC,aAAN,CAAmE;EAGxEC,WAAW,CACAC,SADA,EAGDC,MAHC,EAKDC,MALC,EAODC,QAPC,EAQT;IAAA,KAPSH,SAOT,GAPSA,SAOT;IAAA,KALQC,MAKR,GALQA,MAKR;IAAA,KAHQC,MAGR,GAHQA,MAGR;IAAA,KADQC,QACR,GADQA,QACR;IAAA,8CAVK,QAUL;IAAA;EAAE;;EAIJC,MAAM,CAACC,GAAD,EAAqB;IACzB,MAAMC,U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,EAAiD;MAC/C,IAAI9C,MAAM,CAACG,iBAAX,EAA8B;QAC5B;QACAH,MAAM,CAACG,iBAAP,CAA0B6C,OAAD,IAAa;UACpC,IAAI,KAAK3C,SAAT,EAAoB,KAAKA,SAAL,CAAe2C,OAAf;UACpBA,OAAO,CAACpC,UAAR,CAAmBqC,OAAnB,CAA4BpC,SAAD,IAAe;YACxC;YACA,KAAK7B,MAAL,CAAYkE,OAAZ,CAAoBvE,cAApB,EAAoC;cAClCwE,YAAY,EAAE;gBACZ7D,EAAE,EAAEuB,SAAS,CAACuC,WAAV,CAAsBC,QAAtB,EADQ;gBAEZC,YAAY,EAAEzC,SAAS,CAACmC,OAFZ;gBAGZO,OAAO,EAAE1C,SAAS,CAAC0C;cAHP;YADoB,CAApC;UAOD,CATD;QAUD,CAZD;MAaD;;MAED,OAAOvD,MAAM,CAAC8C,KAAP,CAAaN,aAAb,CAAP;IACD;;IAED,MAAMQ,OAAO,GAAG,MAAMhD,MAAM,CAACwD,IAAP,CAAYhB,aAAZ,CAAtB;IAEA,OAAOQ,OAAP;EACD;;AA7HuE"}
1
+ {"version":3,"names":["chalk","require","OnTestsChanged","TesterService","constructor","workspace","logger","pubsub","devFiles","render","env","descriptor","getDescriptor","id","displayName","version","highlight","config","language","ignoreIllegals","environment","getTester","undefined","tester","icon","displayConfig","onTestRunComplete","callback","_callback","run","context","options","specFiles","ComponentMap","as","components","component","detectTestFiles","testCount","toArray","reduce","acc","specs","length","componentWithTests","ui","consoleWarning","cyan","Tests","console","patterns","componentDir","componentPatterns","getDevPatterns","TesterAspect","paths","map","pattern","path","resolve","relative","additionalHostDependencies","getAdditionalTestHostDependencies","testerContext","Object","assign","release","rootPath","debug","watch","coverage","results","forEach","publish","testsChanged","componentId","toString","testsResults","loading","test"],"sources":["tester.service.tsx"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { resolve } from 'path';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport { PubSubEngine } from 'graphql-subscriptions';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { Tester, Tests, CallbackFn } from './tester';\nimport { TesterAspect } from './tester.aspect';\nimport { TesterOptions } from './tester.main.runtime';\nimport { detectTestFiles } from './utils';\n\nconst chalk = require('chalk');\n\nexport const OnTestsChanged = 'OnTestsChanged';\n\nexport type TesterDescriptor = {\n /**\n * id of the tester (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the tester (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured tester.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class TesterService implements EnvService<Tests, TesterDescriptor> {\n name = 'tester';\n\n constructor(\n readonly workspace: Workspace,\n\n private logger: Logger,\n\n private pubsub: PubSubEngine,\n\n private devFiles: DevFilesMain\n ) {}\n\n _callback: CallbackFn | undefined;\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured tester: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n tester config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(environment: EnvDefinition) {\n if (!environment.env.getTester) return undefined;\n const tester: Tester = environment.env.getTester();\n\n return {\n id: tester.id || '',\n displayName: tester.displayName || '',\n icon: tester.icon || '',\n config: tester.displayConfig ? tester.displayConfig() : '',\n version: tester.version ? tester.version() : '?',\n };\n }\n\n onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async run(context: ExecutionContext, options: TesterOptions): Promise<Tests> {\n const tester: Tester = context.env.getTester();\n const specFiles = ComponentMap.as(context.components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n const testCount = specFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);\n\n const componentWithTests = specFiles.toArray().reduce((acc: number, [, specs]) => {\n if (specs.length > 0) acc += 1;\n return acc;\n }, 0);\n\n if (testCount === 0 && !options.ui) {\n this.logger.consoleWarning(`no tests found for environment ${chalk.cyan(context.id)}\\n`);\n return new Tests([]);\n }\n\n if (!options.ui)\n this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\\n`);\n\n const patterns = ComponentMap.as(context.components, (component) => {\n const componentDir = this.workspace.componentDir(component.id);\n const componentPatterns = this.devFiles.getDevPatterns(component, TesterAspect.id);\n return {\n componentDir,\n paths: componentPatterns.map((pattern: string) => ({\n path: resolve(componentDir, pattern),\n relative: pattern,\n })) || [],\n }\n });\n\n let additionalHostDependencies = [];\n if (\n context.env.getAdditionalTestHostDependencies &&\n typeof context.env.getAdditionalTestHostDependencies === 'function'\n ) {\n additionalHostDependencies = await context.env.getAdditionalTestHostDependencies();\n }\n\n const testerContext = Object.assign(context, {\n release: false,\n specFiles,\n patterns,\n rootPath: this.workspace.path,\n workspace: this.workspace,\n debug: options.debug,\n watch: options.watch,\n ui: options.ui,\n coverage: options.coverage,\n additionalHostDependencies,\n });\n\n if (options.watch && options.ui && tester.watch) {\n if (tester.onTestRunComplete) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tester.onTestRunComplete((results) => {\n if (this._callback) this._callback(results);\n results.components.forEach((component) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.pubsub.publish(OnTestsChanged, {\n testsChanged: {\n id: component.componentId.toString(),\n testsResults: component.results,\n loading: component.loading,\n },\n });\n });\n });\n }\n\n return tester.watch(testerContext);\n }\n\n const results = await tester.test(testerContext);\n\n return results;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;E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C0C;cAHP;YADoB,CAApC;UAOD,CATD;QAUD,CAZD;MAaD;;MAED,OAAOvD,MAAM,CAAC8C,KAAP,CAAaN,aAAb,CAAP;IACD;;IAED,MAAMQ,OAAO,GAAG,MAAMhD,MAAM,CAACwD,IAAP,CAAYhB,aAAZ,CAAtB;IAEA,OAAOQ,OAAP;EACD;;AAnIuE"}
@@ -118,28 +118,45 @@ class TesterTask {
118
118
  componentsResults: []
119
119
  };
120
120
 
121
- const specFilesWithCapsule = _component().ComponentMap.as(components, component => {
121
+ const patternsWithCapsule = _component().ComponentMap.as(components, component => {
122
122
  const componentSpecFiles = componentsSpecFiles.get(component);
123
123
  if (!componentSpecFiles) throw new Error('capsule not found');
124
124
  const [, specs] = componentSpecFiles;
125
- return specs.map(specFile => {
126
- const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);
127
- if (!capsule) throw new Error('capsule not found');
128
- const compiler = context.env.getCompiler();
129
- const distPath = compiler.getDistPathBySrcPath(specFile.relative); // TODO: fix spec type file need to capsule will return files with type AbstractVinyl
125
+ const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);
126
+ if (!capsule) throw new Error('capsule not found');
127
+ const compiler = context.env.getCompiler();
128
+
129
+ if (!compiler) {
130
+ throw new Error(`compiler not found for ${component.id.toString()}`);
131
+ } // @ts-ignore. not sure why ts complain that compiler might be undefined, when we check it above.
132
+
133
+
134
+ const distFolder = compiler.getDistDir() || compiler.distDir;
135
+ return {
136
+ componentDir: (0, _path().join)(capsule.path, distFolder),
137
+ paths: specs.map(specFile => {
138
+ const distPath = compiler.getDistPathBySrcPath(specFile.relative); // TODO: fix spec type file need to capsule will return files with type AbstractVinyl
139
+
140
+ return {
141
+ path: (0, _path().join)(capsule.path, distPath),
142
+ relative: distPath
143
+ };
144
+ })
145
+ };
146
+ });
130
147
 
131
- return {
132
- path: (0, _path().join)(capsule.path, distPath),
133
- relative: distPath
134
- };
135
- });
148
+ const specFilesWithCapsule = _component().ComponentMap.as(components, component => {
149
+ const patternEntry = patternsWithCapsule.get(component); // @ts-ignore
150
+
151
+ const [, val] = patternEntry;
152
+ return val.paths;
136
153
  });
137
154
 
138
155
  const testerContext = Object.assign(context, {
139
156
  release: true,
140
157
  specFiles: specFilesWithCapsule,
141
158
  rootPath: context.capsuleNetwork.capsulesRootDir,
142
- patterns: specFilesWithCapsule
159
+ patterns: patternsWithCapsule
143
160
  }); // TODO: remove after fix AbstractVinyl on capsule
144
161
  // @ts-ignore
145
162
 
@@ -1 +1 @@
1
- {"version":3,"names":["TesterTask","constructor","aspectId","devFiles","CompilerAspect","id","execute","context","components","capsuleNetwork","originalSeedersCapsules","getAllComponents","tester","env","getTester","componentsSpecFiles","ComponentMap","as","component","detectTestFiles","testCount","toArray","reduce","acc","specs","length","artifacts","componentsResults","specFilesWithCapsule","componentSpecFiles","get","Error","map","specFile","capsule","graphCapsules","getCapsule","compiler","getCompiler","distPath","getDistPathBySrcPath","relative","path","join","testerContext","Object","assign","release","specFiles","rootPath","capsulesRootDir","patterns","testsResults","test","Promise","all","compResult","junit","testsResultsToJUnitFormat","componentId","toString","fs","outputFile","getJUnitArtifactPath","getArtifactDef","componentTests","componentErrors","errors","metadata","tests","results","CAPSULE_ARTIFACTS_DIR","name","globPatterns","rootDir"],"sources":["tester.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, CAPSULE_ARTIFACTS_DIR } from '@teambit/builder';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport { Compiler, CompilerAspect } from '@teambit/compiler';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { ComponentMap } from '@teambit/component';\nimport { Tester } from './tester';\nimport { detectTestFiles } from './utils';\nimport { testsResultsToJUnitFormat } from './utils/junit-generator';\n\n/**\n * tester build task. Allows to test components during component build.\n */\nexport class TesterTask implements BuildTask {\n readonly name = 'TestComponents';\n readonly dependencies = [CompilerAspect.id];\n constructor(readonly aspectId: string, private devFiles: DevFilesMain) {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const components = context.capsuleNetwork.originalSeedersCapsules.getAllComponents();\n const tester: Tester = context.env.getTester();\n const componentsSpecFiles = ComponentMap.as(components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n\n const testCount = componentsSpecFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);\n if (testCount === 0)\n return {\n artifacts: [],\n componentsResults: [],\n };\n\n const specFilesWithCapsule = ComponentMap.as(components, (component) => {\n const componentSpecFiles = componentsSpecFiles.get(component);\n if (!componentSpecFiles) throw new Error('capsule not found');\n const [, specs] = componentSpecFiles;\n return specs.map((specFile) => {\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n if (!capsule) throw new Error('capsule not found');\n const compiler: Compiler = context.env.getCompiler();\n const distPath = compiler.getDistPathBySrcPath(specFile.relative);\n\n // TODO: fix spec type file need to capsule will return files with type AbstractVinyl\n return { path: join(capsule.path, distPath), relative: distPath };\n });\n });\n\n const testerContext = Object.assign(context, {\n release: true,\n specFiles: specFilesWithCapsule,\n rootPath: context.capsuleNetwork.capsulesRootDir,\n patterns: specFilesWithCapsule,\n });\n\n // TODO: remove after fix AbstractVinyl on capsule\n // @ts-ignore\n const testsResults = await tester.test(testerContext);\n\n // write junit files\n await Promise.all(\n testsResults.components.map(async (compResult) => {\n const junit = testsResultsToJUnitFormat([compResult]);\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(compResult.componentId);\n if (!capsule) {\n throw new Error(`unable to find ${compResult.componentId.toString()} in capsules`);\n }\n await fs.outputFile(join(capsule.path, getJUnitArtifactPath()), junit);\n })\n );\n\n return {\n artifacts: getArtifactDef(), // @ts-ignore\n componentsResults: testsResults.components.map((componentTests) => {\n const componentErrors = componentTests.errors;\n const component = context.capsuleNetwork.graphCapsules.getCapsule(componentTests.componentId)?.component;\n if (!component) {\n throw new Error(`unable to find ${componentTests.componentId.toString()} in capsules`);\n }\n\n return {\n component,\n metadata: { tests: componentTests.results },\n errors: componentErrors,\n };\n }),\n };\n }\n}\n\nexport function getJUnitArtifactPath() {\n return join(CAPSULE_ARTIFACTS_DIR, '__bit_junit.xml');\n}\n\nexport function getArtifactDef() {\n return [\n {\n name: 'junit',\n globPatterns: [getJUnitArtifactPath()],\n rootDir: CAPSULE_ARTIFACTS_DIR,\n },\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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;AACA;AACA;AACO,MAAMA,UAAN,CAAsC;EAG3CC,WAAW,CAAUC,QAAV,EAAoCC,QAApC,EAA4D;IAAA,KAAlDD,QAAkD,GAAlDA,QAAkD;IAAA,KAAxBC,QAAwB,GAAxBA,QAAwB;IAAA,8CAFvD,gBAEuD;IAAA,sDAD/C,CAACC,0BAAA,CAAeC,EAAhB,CAC+C;EAAE;;EAE5D,MAAPC,OAAO,CAACC,OAAD,EAAkD;IAC7D,MAAMC,UAAU,GAAGD,OAAO,CAACE,cAAR,CAAuBC,uBAAvB,CAA+CC,gBAA/C,EAAnB;IACA,MAAMC,MAAc,GAAGL,OAAO,CAACM,GAAR,CAAYC,SAAZ,EAAvB;;IACA,MAAMC,mBAAmB,GAAGC,yBAAA,CAAaC,EAAb,CAAgBT,UAAhB,EAA6BU,SAAD,IAAe;MACrE,OAAO,IAAAC,wBAAA,EAAgBD,SAAhB,EAA2B,KAAKf,QAAhC,CAAP;IACD,CAF2B,CAA5B;;IAIA,MAAMiB,SAAS,GAAGL,mBAAmB,CAACM,OAApB,GAA8BC,MAA9B,CAAqC,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AAEC,KAAK,EAAEJ,cAAc,CAACK;UAAxB,CAFL;UAGLH,MAAM,EAAED;QAHH,CAAP;MAKD,CAZkB;IAFd,CAAP;EAgBD;;AAzE0C;;;;AA4EtC,SAASH,oBAAT,GAAgC;EACrC,OAAO,IAAApB,YAAA,EAAK4B,gCAAL,EAA4B,iBAA5B,CAAP;AACD;;AAEM,SAASP,cAAT,GAA0B;EAC/B,OAAO,CACL;IACEQ,IAAI,EAAE,OADR;IAEEC,YAAY,EAAE,CAACV,oBAAoB,EAArB,CAFhB;IAGEW,OAAO,EAAEH;EAHX,CADK,CAAP;AAOD"}
1
+ {"version":3,"names":["TesterTask","constructor","aspectId","devFiles","CompilerAspect","id","execute","context","components","capsuleNetwork","originalSeedersCapsules","getAllComponents","tester","env","getTester","componentsSpecFiles","ComponentMap","as","component","detectTestFiles","testCount","toArray","reduce","acc","specs","length","artifacts","componentsResults","patternsWithCapsule","componentSpecFiles","get","Error","capsule","graphCapsules","getCapsule","compiler","getCompiler","toString","distFolder","getDistDir","distDir","componentDir","join","path","paths","map","specFile","distPath","getDistPathBySrcPath","relative","specFilesWithCapsule","patternEntry","val","testerContext","Object","assign","release","specFiles","rootPath","capsulesRootDir","patterns","testsResults","test","Promise","all","compResult","junit","testsResultsToJUnitFormat","componentId","fs","outputFile","getJUnitArtifactPath","getArtifactDef","componentTests","componentErrors","errors","metadata","tests","results","CAPSULE_ARTIFACTS_DIR","name","globPatterns","rootDir"],"sources":["tester.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, CAPSULE_ARTIFACTS_DIR } from '@teambit/builder';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport { Compiler, CompilerAspect } from '@teambit/compiler';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { ComponentMap } from '@teambit/component';\nimport { Tester } from './tester';\nimport { detectTestFiles } from './utils';\nimport { testsResultsToJUnitFormat } from './utils/junit-generator';\n\n/**\n * tester build task. Allows to test components during component build.\n */\nexport class TesterTask implements BuildTask {\n readonly name = 'TestComponents';\n readonly dependencies = [CompilerAspect.id];\n constructor(readonly aspectId: string, private devFiles: DevFilesMain) {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const components = context.capsuleNetwork.originalSeedersCapsules.getAllComponents();\n const tester: Tester = context.env.getTester();\n const componentsSpecFiles = ComponentMap.as(components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n\n const testCount = componentsSpecFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);\n if (testCount === 0)\n return {\n artifacts: [],\n componentsResults: [],\n };\n\n const patternsWithCapsule = ComponentMap.as(components, (component) => {\n const componentSpecFiles = componentsSpecFiles.get(component);\n if (!componentSpecFiles) throw new Error('capsule not found');\n const [, specs] = componentSpecFiles;\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n if (!capsule) throw new Error('capsule not found');\n const compiler: Compiler = context.env.getCompiler();\n if (!compiler){\n throw new Error(`compiler not found for ${component.id.toString()}`);\n }\n // @ts-ignore. not sure why ts complain that compiler might be undefined, when we check it above.\n const distFolder = compiler.getDistDir() || compiler.distDir;\n return {\n componentDir: join(capsule.path, distFolder),\n paths: specs.map((specFile) => {\n const distPath = compiler.getDistPathBySrcPath(specFile.relative);\n // TODO: fix spec type file need to capsule will return files with type AbstractVinyl\n return { path: join(capsule.path, distPath), relative: distPath, };\n })\n }\n });\n\n const specFilesWithCapsule = ComponentMap.as(components, (component) => {\n const patternEntry = patternsWithCapsule.get(component);\n // @ts-ignore\n const [, val] = patternEntry;\n return val.paths;\n });\n\n const testerContext = Object.assign(context, {\n release: true,\n specFiles: specFilesWithCapsule,\n rootPath: context.capsuleNetwork.capsulesRootDir,\n patterns: patternsWithCapsule,\n });\n\n // TODO: remove after fix AbstractVinyl on capsule\n // @ts-ignore\n const testsResults = await tester.test(testerContext);\n\n // write junit files\n await Promise.all(\n testsResults.components.map(async (compResult) => {\n const junit = testsResultsToJUnitFormat([compResult]);\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(compResult.componentId);\n if (!capsule) {\n throw new Error(`unable to find ${compResult.componentId.toString()} in capsules`);\n }\n await fs.outputFile(join(capsule.path, getJUnitArtifactPath()), junit);\n })\n );\n\n return {\n artifacts: getArtifactDef(), // @ts-ignore\n componentsResults: testsResults.components.map((componentTests) => {\n const componentErrors = componentTests.errors;\n const component = context.capsuleNetwork.graphCapsules.getCapsule(componentTests.componentId)?.component;\n if (!component) {\n throw new Error(`unable to find ${componentTests.componentId.toString()} in capsules`);\n }\n\n return {\n component,\n metadata: { tests: componentTests.results },\n errors: componentErrors,\n };\n }),\n };\n }\n}\n\nexport function getJUnitArtifactPath() {\n return join(CAPSULE_ARTIFACTS_DIR, '__bit_junit.xml');\n}\n\nexport function getArtifactDef() {\n return [\n {\n name: 'junit',\n globPatterns: [getJUnitArtifactPath()],\n rootDir: CAPSULE_ARTIFACTS_DIR,\n },\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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;AACA;AACA;AACO,MAAMA,UAAN,CAAsC;EAG3CC,WAAW,CAAUC,QAAV,EAAoCC,QAApC,EAA4D;IAAA,KAAlDD,QAAkD,GAAlDA,QAAkD;IAAA,KAAxBC,QAAwB,GAAxBA,QAAwB;IAAA,8CAFvD,gBAEuD;IAAA,sDAD/C,CAACC,0BAAA,CAAeC,EAAhB,CAC+C;EAAE;;EAE5D,MAAPC,OAAO,CAACC,OAAD,EAAkD;IAC7D,MAAMC,UAAU,GA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AAI,EAAE,OADR;IAEEC,YAAY,EAAE,CAACV,oBAAoB,EAArB,CAFhB;IAGEW,OAAO,EAAEH;EAHX,CADK,CAAP;AAOD"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/tester",
3
- "version": "0.0.823",
3
+ "version": "0.0.824",
4
4
  "homepage": "https://bit.dev/teambit/defender/tester",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.defender",
8
8
  "name": "tester",
9
- "version": "0.0.823"
9
+ "version": "0.0.824"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -22,19 +22,19 @@
22
22
  "@babel/runtime": "7.12.18",
23
23
  "core-js": "^3.0.0",
24
24
  "@teambit/harmony": "0.3.3",
25
- "@teambit/cli": "0.0.551",
26
- "@teambit/logger": "0.0.644",
27
- "@teambit/workspace": "0.0.823",
28
- "@teambit/component": "0.0.823",
29
- "@teambit/defender.ui.test-compare": "0.0.59",
30
- "@teambit/graphql": "0.0.823",
31
- "@teambit/builder": "0.0.823",
32
- "@teambit/dev-files": "0.0.823",
33
- "@teambit/envs": "0.0.823",
25
+ "@teambit/cli": "0.0.552",
26
+ "@teambit/logger": "0.0.645",
27
+ "@teambit/workspace": "0.0.824",
28
+ "@teambit/component": "0.0.824",
29
+ "@teambit/defender.ui.test-compare": "0.0.60",
30
+ "@teambit/graphql": "0.0.824",
31
+ "@teambit/builder": "0.0.824",
32
+ "@teambit/dev-files": "0.0.824",
33
+ "@teambit/envs": "0.0.824",
34
34
  "@teambit/tests-results": "0.0.97",
35
- "@teambit/ui": "0.0.823",
36
- "@teambit/compiler": "0.0.823",
37
- "@teambit/component-compare": "0.0.71",
35
+ "@teambit/ui": "0.0.824",
36
+ "@teambit/compiler": "0.0.824",
37
+ "@teambit/component-compare": "0.0.72",
38
38
  "@teambit/defender.ui.test-page": "0.0.1",
39
39
  "@teambit/bit-error": "0.0.394"
40
40
  },
@@ -51,7 +51,7 @@
51
51
  "@teambit/defender.content.tester-overview": "1.95.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@teambit/legacy": "1.0.334",
54
+ "@teambit/legacy": "1.0.335",
55
55
  "react-dom": "^16.8.0 || ^17.0.0",
56
56
  "react": "^16.8.0 || ^17.0.0"
57
57
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.823/dist/tester.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.823/dist/tester.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.824/dist/tester.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.824/dist/tester.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -116,9 +116,15 @@ export class TesterService implements EnvService<Tests, TesterDescriptor> {
116
116
  this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\n`);
117
117
 
118
118
  const patterns = ComponentMap.as(context.components, (component) => {
119
- const dir = this.workspace.componentDir(component.id);
119
+ const componentDir = this.workspace.componentDir(component.id);
120
120
  const componentPatterns = this.devFiles.getDevPatterns(component, TesterAspect.id);
121
- return componentPatterns.map((pattern: string) => ({ path: resolve(dir, pattern), relative: pattern }));
121
+ return {
122
+ componentDir,
123
+ paths: componentPatterns.map((pattern: string) => ({
124
+ path: resolve(componentDir, pattern),
125
+ relative: pattern,
126
+ })) || [],
127
+ }
122
128
  });
123
129
 
124
130
  let additionalHostDependencies = [];