@teambit/tester 0.0.880 → 0.0.882
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/exceptions/index.js +0 -6
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/no-matching-components.js +0 -3
- package/dist/exceptions/no-matching-components.js.map +1 -1
- package/dist/exceptions/no-test-files-found.js +0 -6
- package/dist/exceptions/no-test-files-found.js.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/test.cmd.js +2 -37
- package/dist/test.cmd.js.map +1 -1
- package/dist/tester.aspect.js +0 -5
- package/dist/tester.aspect.js.map +1 -1
- package/dist/tester.compare.section.js +0 -13
- package/dist/tester.compare.section.js.map +1 -1
- package/dist/tester.composition.js +0 -6
- package/dist/tester.composition.js.map +1 -1
- package/dist/tester.graphql.js +0 -17
- package/dist/tester.graphql.js.map +1 -1
- package/dist/tester.js +0 -6
- package/dist/tester.js.map +1 -1
- package/dist/tester.main.runtime.js +3 -94
- package/dist/tester.main.runtime.js.map +1 -1
- package/dist/tester.service.js +0 -50
- package/dist/tester.service.js.map +1 -1
- package/dist/tester.task.js +11 -54
- package/dist/tester.task.js.map +1 -1
- package/dist/tester.ui.runtime.js +1 -34
- package/dist/tester.ui.runtime.js.map +1 -1
- package/dist/tests.section.js +0 -13
- package/dist/tests.section.js.map +1 -1
- package/dist/utils/detect-spec-files.js +0 -4
- package/dist/utils/detect-spec-files.js.map +1 -1
- package/dist/utils/index.js +0 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/junit-generator.js +0 -18
- package/dist/utils/junit-generator.js.map +1 -1
- package/package-tar/teambit-tester-0.0.882.tgz +0 -0
- package/package.json +15 -15
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-tester-0.0.880.tgz +0 -0
|
@@ -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","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:\n 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;;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,MAAM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O,CAACc,EAAzB,IAA+BtB,MAAM,CAAC8C,KAA1C,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;;AApIuE"}
|
|
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:\n 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 }\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AAC,CAAC;QACJ,CAAC,CAAC;MACJ;MAEA,OAAOvD,MAAM,CAAC8C,KAAK,CAACN,aAAa,CAAC;IACpC;IAEA,MAAMQ,OAAO,GAAG,MAAMhD,MAAM,CAACwD,IAAI,CAAChB,aAAa,CAAC;IAEhD,OAAOQ,OAAO;EAChB;AACF;AAAC"}
|
package/dist/tester.task.js
CHANGED
|
@@ -1,98 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.TesterTask = void 0;
|
|
13
10
|
exports.getArtifactDef = getArtifactDef;
|
|
14
11
|
exports.getJUnitArtifactPath = getJUnitArtifactPath;
|
|
15
|
-
|
|
16
12
|
function _defineProperty2() {
|
|
17
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
|
|
19
14
|
_defineProperty2 = function () {
|
|
20
15
|
return data;
|
|
21
16
|
};
|
|
22
|
-
|
|
23
17
|
return data;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
function _builder() {
|
|
27
20
|
const data = require("@teambit/builder");
|
|
28
|
-
|
|
29
21
|
_builder = function () {
|
|
30
22
|
return data;
|
|
31
23
|
};
|
|
32
|
-
|
|
33
24
|
return data;
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
function _fsExtra() {
|
|
37
27
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
38
|
-
|
|
39
28
|
_fsExtra = function () {
|
|
40
29
|
return data;
|
|
41
30
|
};
|
|
42
|
-
|
|
43
31
|
return data;
|
|
44
32
|
}
|
|
45
|
-
|
|
46
33
|
function _path() {
|
|
47
34
|
const data = require("path");
|
|
48
|
-
|
|
49
35
|
_path = function () {
|
|
50
36
|
return data;
|
|
51
37
|
};
|
|
52
|
-
|
|
53
38
|
return data;
|
|
54
39
|
}
|
|
55
|
-
|
|
56
40
|
function _compiler() {
|
|
57
41
|
const data = require("@teambit/compiler");
|
|
58
|
-
|
|
59
42
|
_compiler = function () {
|
|
60
43
|
return data;
|
|
61
44
|
};
|
|
62
|
-
|
|
63
45
|
return data;
|
|
64
46
|
}
|
|
65
|
-
|
|
66
47
|
function _component() {
|
|
67
48
|
const data = require("@teambit/component");
|
|
68
|
-
|
|
69
49
|
_component = function () {
|
|
70
50
|
return data;
|
|
71
51
|
};
|
|
72
|
-
|
|
73
52
|
return data;
|
|
74
53
|
}
|
|
75
|
-
|
|
76
54
|
function _utils() {
|
|
77
55
|
const data = require("./utils");
|
|
78
|
-
|
|
79
56
|
_utils = function () {
|
|
80
57
|
return data;
|
|
81
58
|
};
|
|
82
|
-
|
|
83
59
|
return data;
|
|
84
60
|
}
|
|
85
|
-
|
|
86
61
|
function _junitGenerator() {
|
|
87
62
|
const data = require("./utils/junit-generator");
|
|
88
|
-
|
|
89
63
|
_junitGenerator = function () {
|
|
90
64
|
return data;
|
|
91
65
|
};
|
|
92
|
-
|
|
93
66
|
return data;
|
|
94
67
|
}
|
|
95
|
-
|
|
96
68
|
/**
|
|
97
69
|
* tester build task. Allows to test components during component build.
|
|
98
70
|
*/
|
|
@@ -103,21 +75,17 @@ class TesterTask {
|
|
|
103
75
|
(0, _defineProperty2().default)(this, "name", 'TestComponents');
|
|
104
76
|
(0, _defineProperty2().default)(this, "dependencies", [_compiler().CompilerAspect.id]);
|
|
105
77
|
}
|
|
106
|
-
|
|
107
78
|
async execute(context) {
|
|
108
79
|
const components = context.capsuleNetwork.originalSeedersCapsules.getAllComponents();
|
|
109
80
|
const tester = context.env.getTester();
|
|
110
|
-
|
|
111
81
|
const componentsSpecFiles = _component().ComponentMap.as(components, component => {
|
|
112
82
|
return (0, _utils().detectTestFiles)(component, this.devFiles);
|
|
113
83
|
});
|
|
114
|
-
|
|
115
84
|
const testCount = componentsSpecFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);
|
|
116
85
|
if (testCount === 0) return {
|
|
117
86
|
artifacts: [],
|
|
118
87
|
componentsResults: []
|
|
119
88
|
};
|
|
120
|
-
|
|
121
89
|
const patternsWithCapsule = _component().ComponentMap.as(components, component => {
|
|
122
90
|
const componentSpecFiles = componentsSpecFiles.get(component);
|
|
123
91
|
if (!componentSpecFiles) throw new Error('capsule not found');
|
|
@@ -125,18 +93,16 @@ class TesterTask {
|
|
|
125
93
|
const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);
|
|
126
94
|
if (!capsule) throw new Error('capsule not found');
|
|
127
95
|
const compiler = context.env.getCompiler();
|
|
128
|
-
|
|
129
96
|
if (!compiler) {
|
|
130
97
|
throw new Error(`compiler not found for ${component.id.toString()}`);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
98
|
+
}
|
|
99
|
+
// @ts-ignore. not sure why ts complain that compiler might be undefined, when we check it above.
|
|
134
100
|
const distFolder = compiler.getDistDir() || compiler.distDir;
|
|
135
101
|
return {
|
|
136
102
|
componentDir: (0, _path().join)(capsule.path, distFolder),
|
|
137
103
|
paths: specs.map(specFile => {
|
|
138
|
-
const distPath = compiler.getDistPathBySrcPath(specFile.relative);
|
|
139
|
-
|
|
104
|
+
const distPath = compiler.getDistPathBySrcPath(specFile.relative);
|
|
105
|
+
// TODO: fix spec type file need to capsule will return files with type AbstractVinyl
|
|
140
106
|
return {
|
|
141
107
|
path: (0, _path().join)(capsule.path, distPath),
|
|
142
108
|
relative: distPath
|
|
@@ -144,32 +110,30 @@ class TesterTask {
|
|
|
144
110
|
})
|
|
145
111
|
};
|
|
146
112
|
});
|
|
147
|
-
|
|
148
113
|
const specFilesWithCapsule = _component().ComponentMap.as(components, component => {
|
|
149
|
-
const patternEntry = patternsWithCapsule.get(component);
|
|
150
|
-
|
|
114
|
+
const patternEntry = patternsWithCapsule.get(component);
|
|
115
|
+
// @ts-ignore
|
|
151
116
|
const [, val] = patternEntry;
|
|
152
117
|
return val.paths;
|
|
153
118
|
});
|
|
154
|
-
|
|
155
119
|
const testerContext = Object.assign(context, {
|
|
156
120
|
release: true,
|
|
157
121
|
specFiles: specFilesWithCapsule,
|
|
158
122
|
rootPath: context.capsuleNetwork.capsulesRootDir,
|
|
159
123
|
patterns: patternsWithCapsule
|
|
160
|
-
});
|
|
161
|
-
// @ts-ignore
|
|
124
|
+
});
|
|
162
125
|
|
|
163
|
-
|
|
126
|
+
// TODO: remove after fix AbstractVinyl on capsule
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
const testsResults = await tester.test(testerContext);
|
|
164
129
|
|
|
130
|
+
// write junit files
|
|
165
131
|
await Promise.all(testsResults.components.map(async compResult => {
|
|
166
132
|
const junit = (0, _junitGenerator().testsResultsToJUnitFormat)([compResult]);
|
|
167
133
|
const capsule = context.capsuleNetwork.graphCapsules.getCapsule(compResult.componentId);
|
|
168
|
-
|
|
169
134
|
if (!capsule) {
|
|
170
135
|
throw new Error(`unable to find ${compResult.componentId.toString()} in capsules`);
|
|
171
136
|
}
|
|
172
|
-
|
|
173
137
|
await _fsExtra().default.outputFile((0, _path().join)(capsule.path, getJUnitArtifactPath()), junit);
|
|
174
138
|
}));
|
|
175
139
|
return {
|
|
@@ -177,14 +141,11 @@ class TesterTask {
|
|
|
177
141
|
// @ts-ignore
|
|
178
142
|
componentsResults: testsResults.components.map(componentTests => {
|
|
179
143
|
var _context$capsuleNetwo;
|
|
180
|
-
|
|
181
144
|
const componentErrors = componentTests.errors;
|
|
182
145
|
const component = (_context$capsuleNetwo = context.capsuleNetwork.graphCapsules.getCapsule(componentTests.componentId)) === null || _context$capsuleNetwo === void 0 ? void 0 : _context$capsuleNetwo.component;
|
|
183
|
-
|
|
184
146
|
if (!component) {
|
|
185
147
|
throw new Error(`unable to find ${componentTests.componentId.toString()} in capsules`);
|
|
186
148
|
}
|
|
187
|
-
|
|
188
149
|
return {
|
|
189
150
|
component,
|
|
190
151
|
metadata: {
|
|
@@ -195,15 +156,11 @@ class TesterTask {
|
|
|
195
156
|
})
|
|
196
157
|
};
|
|
197
158
|
}
|
|
198
|
-
|
|
199
159
|
}
|
|
200
|
-
|
|
201
160
|
exports.TesterTask = TesterTask;
|
|
202
|
-
|
|
203
161
|
function getJUnitArtifactPath() {
|
|
204
162
|
return (0, _path().join)(_builder().CAPSULE_ARTIFACTS_DIR, '__bit_junit.xml');
|
|
205
163
|
}
|
|
206
|
-
|
|
207
164
|
function getArtifactDef() {
|
|
208
165
|
return [{
|
|
209
166
|
name: 'junit',
|
package/dist/tester.task.js.map
CHANGED
|
@@ -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","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":"
|
|
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,UAAU,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B,YAAI,EAACqC,gCAAqB,EAAE,iBAAiB,CAAC;AACvD;AAEO,SAASP,cAAc,GAAG;EAC/B,OAAO,CACL;IACEQ,IAAI,EAAE,OAAO;IACbC,YAAY,EAAE,CAACV,oBAAoB,EAAE,CAAC;IACtCW,OAAO,EAAEH;EACX,CAAC,CACF;AACH"}
|
|
@@ -1,112 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.default = exports.TesterUI = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _ui() {
|
|
25
18
|
const data = require("@teambit/ui");
|
|
26
|
-
|
|
27
19
|
_ui = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _harmony() {
|
|
35
25
|
const data = require("@teambit/harmony");
|
|
36
|
-
|
|
37
26
|
_harmony = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _component() {
|
|
45
32
|
const data = require("@teambit/component");
|
|
46
|
-
|
|
47
33
|
_component = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _componentCompare() {
|
|
55
39
|
const data = require("@teambit/component-compare");
|
|
56
|
-
|
|
57
40
|
_componentCompare = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _tests() {
|
|
65
46
|
const data = require("./tests.section");
|
|
66
|
-
|
|
67
47
|
_tests = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _tester() {
|
|
75
53
|
const data = require("./tester.aspect");
|
|
76
|
-
|
|
77
54
|
_tester = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _testerCompare() {
|
|
85
60
|
const data = require("./tester.compare.section");
|
|
86
|
-
|
|
87
61
|
_testerCompare = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
class TesterUI {
|
|
95
67
|
constructor(component, emptyStateSlot) {
|
|
96
68
|
this.component = component;
|
|
97
69
|
this.emptyStateSlot = emptyStateSlot;
|
|
98
70
|
(0, _defineProperty2().default)(this, "stageKey", void 0);
|
|
99
71
|
}
|
|
72
|
+
|
|
100
73
|
/**
|
|
101
74
|
* register a new tester empty state. this allows to register a different empty state from each environment for example.
|
|
102
75
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
76
|
registerEmptyState(emptyStateComponent) {
|
|
106
77
|
this.emptyStateSlot.register(emptyStateComponent);
|
|
107
78
|
return this;
|
|
108
79
|
}
|
|
109
|
-
|
|
110
80
|
static async provider([component, componentCompare], config, [emptyStateSlot]) {
|
|
111
81
|
const testerUi = new TesterUI(component, emptyStateSlot);
|
|
112
82
|
const section = new (_tests().TestsSection)(emptyStateSlot);
|
|
@@ -120,16 +90,13 @@ class TesterUI {
|
|
|
120
90
|
componentCompare.registerRoutes([testerCompareSection.route]);
|
|
121
91
|
return testerUi;
|
|
122
92
|
}
|
|
123
|
-
|
|
124
93
|
}
|
|
125
|
-
|
|
126
94
|
exports.TesterUI = TesterUI;
|
|
127
95
|
(0, _defineProperty2().default)(TesterUI, "dependencies", [_component().ComponentAspect, _componentCompare().ComponentCompareAspect]);
|
|
128
96
|
(0, _defineProperty2().default)(TesterUI, "runtime", _ui().UIRuntime);
|
|
129
97
|
(0, _defineProperty2().default)(TesterUI, "slots", [_harmony().Slot.withType()]);
|
|
130
98
|
var _default = TesterUI;
|
|
131
99
|
exports.default = _default;
|
|
132
|
-
|
|
133
100
|
_tester().TesterAspect.addRuntime(TesterUI);
|
|
134
101
|
|
|
135
102
|
//# sourceMappingURL=tester.ui.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TesterUI","constructor","component","emptyStateSlot","registerEmptyState","emptyStateComponent","register","provider","componentCompare","config","testerUi","section","TestsSection","testerCompareSection","TesterCompareSection","registerRoute","route","registerNavigation","navigationLink","order","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","TesterAspect","addRuntime"],"sources":["tester.ui.runtime.tsx"],"sourcesContent":["import { ComponentType } from 'react';\nimport { UIRuntime } from '@teambit/ui';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { TestsSection } from './tests.section';\nimport { TesterAspect } from './tester.aspect';\nimport { TesterCompareSection } from './tester.compare.section';\n\nexport type EmptyStateSlot = SlotRegistry<ComponentType>;\nexport class TesterUI {\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n stageKey?: string;\n\n constructor(private component: ComponentUI, private emptyStateSlot: EmptyStateSlot) {}\n\n /**\n * register a new tester empty state. this allows to register a different empty state from each environment for example.\n */\n registerEmptyState(emptyStateComponent: ComponentType) {\n this.emptyStateSlot.register(emptyStateComponent);\n return this;\n }\n\n static slots = [Slot.withType<ComponentType>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [emptyStateSlot]: [EmptyStateSlot]\n ) {\n const testerUi = new TesterUI(component, emptyStateSlot);\n const section = new TestsSection(emptyStateSlot);\n const testerCompareSection = new TesterCompareSection(emptyStateSlot);\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation({\n props: testerCompareSection.navigationLink,\n order: testerCompareSection.navigationLink.order,\n });\n componentCompare.registerRoutes([testerCompareSection.route]);\n return testerUi;\n }\n}\n\nexport default TesterUI;\n\nTesterAspect.addRuntime(TesterUI);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TesterUI","constructor","component","emptyStateSlot","registerEmptyState","emptyStateComponent","register","provider","componentCompare","config","testerUi","section","TestsSection","testerCompareSection","TesterCompareSection","registerRoute","route","registerNavigation","navigationLink","order","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","TesterAspect","addRuntime"],"sources":["tester.ui.runtime.tsx"],"sourcesContent":["import { ComponentType } from 'react';\nimport { UIRuntime } from '@teambit/ui';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { TestsSection } from './tests.section';\nimport { TesterAspect } from './tester.aspect';\nimport { TesterCompareSection } from './tester.compare.section';\n\nexport type EmptyStateSlot = SlotRegistry<ComponentType>;\nexport class TesterUI {\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n stageKey?: string;\n\n constructor(private component: ComponentUI, private emptyStateSlot: EmptyStateSlot) {}\n\n /**\n * register a new tester empty state. this allows to register a different empty state from each environment for example.\n */\n registerEmptyState(emptyStateComponent: ComponentType) {\n this.emptyStateSlot.register(emptyStateComponent);\n return this;\n }\n\n static slots = [Slot.withType<ComponentType>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [emptyStateSlot]: [EmptyStateSlot]\n ) {\n const testerUi = new TesterUI(component, emptyStateSlot);\n const section = new TestsSection(emptyStateSlot);\n const testerCompareSection = new TesterCompareSection(emptyStateSlot);\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation({\n props: testerCompareSection.navigationLink,\n order: testerCompareSection.navigationLink.order,\n });\n componentCompare.registerRoutes([testerCompareSection.route]);\n return testerUi;\n }\n}\n\nexport default TesterUI;\n\nTesterAspect.addRuntime(TesterUI);\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,QAAQ,CAAC;EAOpBC,WAAW,CAASC,SAAsB,EAAUC,cAA8B,EAAE;IAAA,KAAhED,SAAsB,GAAtBA,SAAsB;IAAA,KAAUC,cAA8B,GAA9BA,cAA8B;IAAA;EAAG;;EAErF;AACF;AACA;EACEC,kBAAkB,CAACC,mBAAkC,EAAE;IACrD,IAAI,CAACF,cAAc,CAACG,QAAQ,CAACD,mBAAmB,CAAC;IACjD,OAAO,IAAI;EACb;EAIA,aAAaE,QAAQ,CACnB,CAACL,SAAS,EAAEM,gBAAgB,CAAoC,EAChEC,MAAM,EACN,CAACN,cAAc,CAAmB,EAClC;IACA,MAAMO,QAAQ,GAAG,IAAIV,QAAQ,CAACE,SAAS,EAAEC,cAAc,CAAC;IACxD,MAAMQ,OAAO,GAAG,KAAIC,qBAAY,EAACT,cAAc,CAAC;IAChD,MAAMU,oBAAoB,GAAG,KAAIC,qCAAoB,EAACX,cAAc,CAAC;IACrED,SAAS,CAACa,aAAa,CAACJ,OAAO,CAACK,KAAK,CAAC;IACtCd,SAAS,CAACe,kBAAkB,CAACN,OAAO,CAACO,cAAc,EAAEP,OAAO,CAACQ,KAAK,CAAC;IACnEX,gBAAgB,CAACS,kBAAkB,CAAC;MAClCG,KAAK,EAAEP,oBAAoB,CAACK,cAAc;MAC1CC,KAAK,EAAEN,oBAAoB,CAACK,cAAc,CAACC;IAC7C,CAAC,CAAC;IACFX,gBAAgB,CAACa,cAAc,CAAC,CAACR,oBAAoB,CAACG,KAAK,CAAC,CAAC;IAC7D,OAAON,QAAQ;EACjB;AACF;AAAC;AAAA,gCApCYV,QAAQ,kBACG,CAACsB,4BAAe,EAAEC,0CAAsB,CAAC;AAAA,gCADpDvB,QAAQ,aAGFwB,eAAS;AAAA,gCAHfxB,QAAQ,WAiBJ,CAACyB,eAAI,CAACC,QAAQ,EAAiB,CAAC;AAAA,eAqBlC1B,QAAQ;AAAA;AAEvB2B,sBAAY,CAACC,UAAU,CAAC5B,QAAQ,CAAC"}
|
package/dist/tests.section.js
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.TestsSection = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _react() {
|
|
21
16
|
const data = _interopRequireDefault(require("react"));
|
|
22
|
-
|
|
23
17
|
_react = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _defenderUi() {
|
|
31
23
|
const data = require("@teambit/defender.ui.test-page");
|
|
32
|
-
|
|
33
24
|
_defenderUi = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
class TestsSection {
|
|
41
30
|
constructor(emptyStateSlot) {
|
|
42
31
|
this.emptyStateSlot = emptyStateSlot;
|
|
@@ -52,9 +41,7 @@ class TestsSection {
|
|
|
52
41
|
});
|
|
53
42
|
(0, _defineProperty2().default)(this, "order", 40);
|
|
54
43
|
}
|
|
55
|
-
|
|
56
44
|
}
|
|
57
|
-
|
|
58
45
|
exports.TestsSection = TestsSection;
|
|
59
46
|
|
|
60
47
|
//# sourceMappingURL=tests.section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TestsSection","constructor","emptyStateSlot","path","element","href","children"],"sources":["tests.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { TestsPage } from '@teambit/defender.ui.test-page';\nimport { EmptyStateSlot } from './tester.ui.runtime';\n\nexport class TestsSection implements Section {\n constructor(private emptyStateSlot: EmptyStateSlot) {}\n\n route = {\n path: '~tests',\n element: <TestsPage emptyState={this.emptyStateSlot} />,\n };\n navigationLink = {\n href: '~tests',\n children: 'Tests',\n };\n order = 40;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TestsSection","constructor","emptyStateSlot","path","element","href","children"],"sources":["tests.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { TestsPage } from '@teambit/defender.ui.test-page';\nimport { EmptyStateSlot } from './tester.ui.runtime';\n\nexport class TestsSection implements Section {\n constructor(private emptyStateSlot: EmptyStateSlot) {}\n\n route = {\n path: '~tests',\n element: <TestsPage emptyState={this.emptyStateSlot} />,\n };\n navigationLink = {\n href: '~tests',\n children: 'Tests',\n };\n order = 40;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,YAAY,CAAoB;EAC3CC,WAAW,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAA,+CAE1C;MACNC,IAAI,EAAE,QAAQ;MACdC,OAAO,eAAE,+BAAC,uBAAS;QAAC,UAAU,EAAE,IAAI,CAACF;MAAe;IACtD,CAAC;IAAA,wDACgB;MACfG,IAAI,EAAE,QAAQ;MACdC,QAAQ,EAAE;IACZ,CAAC;IAAA,+CACO,EAAE;EAV2C;AAWvD;AAAC"}
|
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.detectTestFiles = detectTestFiles;
|
|
7
|
-
|
|
8
7
|
function _tester() {
|
|
9
8
|
const data = require("../tester.aspect");
|
|
10
|
-
|
|
11
9
|
_tester = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* detect test files in components
|
|
20
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["detectTestFiles","component","devFiles","files","getDevFiles","testFiles","get","TesterAspect","id","state","filesystem","filter","file","includes","relative"],"sources":["detect-spec-files.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { TesterAspect } from '../tester.aspect';\n\n/**\n * detect test files in components\n */\nexport function detectTestFiles(component: Component, devFiles: DevFilesMain) {\n const files = devFiles.getDevFiles(component);\n const testFiles = files.get(TesterAspect.id);\n return component.state.filesystem.files.filter((file) => testFiles.includes(file.relative));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["detectTestFiles","component","devFiles","files","getDevFiles","testFiles","get","TesterAspect","id","state","filesystem","filter","file","includes","relative"],"sources":["detect-spec-files.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { DevFilesMain } from '@teambit/dev-files';\nimport { TesterAspect } from '../tester.aspect';\n\n/**\n * detect test files in components\n */\nexport function detectTestFiles(component: Component, devFiles: DevFilesMain) {\n const files = devFiles.getDevFiles(component);\n const testFiles = files.get(TesterAspect.id);\n return component.state.filesystem.files.filter((file) => testFiles.includes(file.relative));\n}\n"],"mappings":";;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACO,SAASA,eAAe,CAACC,SAAoB,EAAEC,QAAsB,EAAE;EAC5E,MAAMC,KAAK,GAAGD,QAAQ,CAACE,WAAW,CAACH,SAAS,CAAC;EAC7C,MAAMI,SAAS,GAAGF,KAAK,CAACG,GAAG,CAACC,sBAAY,CAACC,EAAE,CAAC;EAC5C,OAAOP,SAAS,CAACQ,KAAK,CAACC,UAAU,CAACP,KAAK,CAACQ,MAAM,CAAEC,IAAI,IAAKP,SAAS,CAACQ,QAAQ,CAACD,IAAI,CAACE,QAAQ,CAAC,CAAC;AAC7F"}
|
package/dist/utils/index.js
CHANGED
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "detectTestFiles", {
|
|
|
9
9
|
return _detectSpecFiles().detectTestFiles;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _detectSpecFiles() {
|
|
14
13
|
const data = require("./detect-spec-files");
|
|
15
|
-
|
|
16
14
|
_detectSpecFiles = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { detectTestFiles } from './detect-spec-files';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { detectTestFiles } from './detect-spec-files';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|