@teambit/tester 0.0.748 → 0.0.749
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/tester.task.js +3 -2
- package/dist/tester.task.js.map +1 -1
- package/package-tar/teambit-tester-0.0.749.tgz +0 -0
- package/package.json +14 -14
- package/{preview-1654053813292.js → preview-1654140507156.js} +2 -2
- package/tsconfig.json +2 -1
- package/package-tar/teambit-tester-0.0.748.tgz +0 -0
package/dist/tester.task.js
CHANGED
|
@@ -105,9 +105,10 @@ class TesterTask {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
async execute(context) {
|
|
108
|
+
const components = context.capsuleNetwork.originalSeedersCapsules.getAllComponents();
|
|
108
109
|
const tester = context.env.getTester();
|
|
109
110
|
|
|
110
|
-
const componentsSpecFiles = _component().ComponentMap.as(
|
|
111
|
+
const componentsSpecFiles = _component().ComponentMap.as(components, component => {
|
|
111
112
|
return (0, _utils().detectTestFiles)(component, this.devFiles);
|
|
112
113
|
});
|
|
113
114
|
|
|
@@ -117,7 +118,7 @@ class TesterTask {
|
|
|
117
118
|
componentsResults: []
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
const specFilesWithCapsule = _component().ComponentMap.as(
|
|
121
|
+
const specFilesWithCapsule = _component().ComponentMap.as(components, component => {
|
|
121
122
|
const componentSpecFiles = componentsSpecFiles.get(component);
|
|
122
123
|
if (!componentSpecFiles) throw new Error('capsule not found');
|
|
123
124
|
const [, specs] = componentSpecFiles;
|
package/dist/tester.task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TesterTask","constructor","aspectId","devFiles","CompilerAspect","id","execute","context","tester","env","getTester","componentsSpecFiles","ComponentMap","as","
|
|
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;;EA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|
2
2
|
"name": "@teambit/tester",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.749",
|
|
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.
|
|
9
|
+
"version": "0.0.749"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@teambit/harmony": "0.3.3",
|
|
26
26
|
"@teambit/design.ui.separator": "0.0.354",
|
|
27
27
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
28
|
-
"@teambit/cli": "0.0.
|
|
29
|
-
"@teambit/logger": "0.0.
|
|
30
|
-
"@teambit/workspace": "0.0.
|
|
31
|
-
"@teambit/component": "0.0.
|
|
32
|
-
"@teambit/graphql": "0.0.
|
|
33
|
-
"@teambit/builder": "0.0.
|
|
34
|
-
"@teambit/dev-files": "0.0.
|
|
35
|
-
"@teambit/envs": "0.0.
|
|
28
|
+
"@teambit/cli": "0.0.494",
|
|
29
|
+
"@teambit/logger": "0.0.587",
|
|
30
|
+
"@teambit/workspace": "0.0.749",
|
|
31
|
+
"@teambit/component": "0.0.749",
|
|
32
|
+
"@teambit/graphql": "0.0.749",
|
|
33
|
+
"@teambit/builder": "0.0.749",
|
|
34
|
+
"@teambit/dev-files": "0.0.749",
|
|
35
|
+
"@teambit/envs": "0.0.749",
|
|
36
36
|
"@teambit/tests-results": "0.0.97",
|
|
37
|
-
"@teambit/ui": "0.0.
|
|
38
|
-
"@teambit/compiler": "0.0.
|
|
37
|
+
"@teambit/ui": "0.0.749",
|
|
38
|
+
"@teambit/compiler": "0.0.749",
|
|
39
39
|
"@teambit/bit-error": "0.0.394",
|
|
40
40
|
"@teambit/defender.ui.test-loader": "0.0.490",
|
|
41
41
|
"@teambit/defender.ui.test-table": "0.0.495",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@apollo/client": "^3.0.0",
|
|
62
|
-
"@teambit/legacy": "1.0.
|
|
62
|
+
"@teambit/legacy": "1.0.274",
|
|
63
63
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
64
64
|
"react": "^16.8.0 || ^17.0.0"
|
|
65
65
|
},
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"react": "-"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@teambit/legacy": "1.0.
|
|
90
|
+
"@teambit/legacy": "1.0.274",
|
|
91
91
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
92
92
|
"react": "^16.8.0 || ^17.0.0"
|
|
93
93
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.749/dist/tester.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.749/dist/tester.docs.mdx')]
|
package/tsconfig.json
CHANGED
|
Binary file
|