@teambit/tester 0.0.560 → 0.0.564
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/test.cmd.d.ts +2 -1
- package/dist/test.cmd.js +22 -4
- package/dist/test.cmd.js.map +1 -1
- package/package.json +19 -19
package/dist/test.cmd.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { TesterMain } from './tester.main.runtime';
|
|
|
5
5
|
declare type TestFlags = {
|
|
6
6
|
watch: boolean;
|
|
7
7
|
debug: boolean;
|
|
8
|
+
all: boolean;
|
|
8
9
|
env?: string;
|
|
9
10
|
scope?: string;
|
|
10
11
|
junit?: string;
|
|
@@ -21,7 +22,7 @@ export declare class TestCmd implements Command {
|
|
|
21
22
|
shortDescription: string;
|
|
22
23
|
options: CommandOptions;
|
|
23
24
|
constructor(tester: TesterMain, workspace: Workspace, logger: Logger);
|
|
24
|
-
render([userPattern]: [string], { watch, debug, env, scope, junit, coverage }: TestFlags): Promise<JSX.Element | {
|
|
25
|
+
render([userPattern]: [string], { watch, debug, all, env, scope, junit, coverage }: TestFlags): Promise<JSX.Element | {
|
|
25
26
|
code: number;
|
|
26
27
|
data: JSX.Element;
|
|
27
28
|
}>;
|
package/dist/test.cmd.js
CHANGED
|
@@ -91,13 +91,14 @@ class TestCmd {
|
|
|
91
91
|
(0, _defineProperty2().default)(this, "alias", 'at');
|
|
92
92
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
93
93
|
(0, _defineProperty2().default)(this, "shortDescription", '');
|
|
94
|
-
(0, _defineProperty2().default)(this, "options", [['w', 'watch', 'start the tester in watch mode.'], ['d', 'debug', 'start the tester in debug mode.'], ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'], ['', 'coverage', 'show code coverage data'], ['e', 'env <id>', 'test only the given env'], ['s', 'scope <scope>', 'name of the scope to test'] // TODO: we need to reduce this redundant casting every time.
|
|
94
|
+
(0, _defineProperty2().default)(this, "options", [['w', 'watch', 'start the tester in watch mode.'], ['d', 'debug', 'start the tester in debug mode.'], ['a', 'all', 'test all components, not only new and modified'], ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'], ['', 'coverage', 'show code coverage data'], ['e', 'env <id>', 'test only the given env'], ['s', 'scope <scope>', 'name of the scope to test'] // TODO: we need to reduce this redundant casting every time.
|
|
95
95
|
]);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
async render([userPattern], {
|
|
99
99
|
watch = false,
|
|
100
100
|
debug = false,
|
|
101
|
+
all = false,
|
|
101
102
|
env,
|
|
102
103
|
scope,
|
|
103
104
|
junit,
|
|
@@ -110,9 +111,26 @@ class TestCmd {
|
|
|
110
111
|
const scopeName = typeof scope === 'string' ? scope : undefined;
|
|
111
112
|
timer.start();
|
|
112
113
|
if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
114
|
+
|
|
115
|
+
const getPatternWithScope = () => {
|
|
116
|
+
if (!userPattern && !scope) return undefined;
|
|
117
|
+
const pattern = userPattern || '**';
|
|
118
|
+
return scopeName ? `${scopeName}/${pattern}` : pattern;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const patternWithScope = getPatternWithScope();
|
|
122
|
+
const components = await this.workspace.getComponentsByUserInput(all, patternWithScope, true);
|
|
123
|
+
|
|
124
|
+
if (!components.length) {
|
|
125
|
+
if (userPattern) throw new (_exceptions2().NoMatchingComponents)(userPattern);
|
|
126
|
+
return {
|
|
127
|
+
code: 0,
|
|
128
|
+
data: /*#__PURE__*/_react().default.createElement(_ink().Box, null, /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
129
|
+
bold: true
|
|
130
|
+
}, "no components found to test. use \"--all\" flag to test all components or specify the ids to test, otherwise, only new and modified components will be tested", ' '))
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
116
134
|
this.logger.console(`testing total of ${components.length} components in workspace '${_chalk().default.cyan(this.workspace.name)}'`);
|
|
117
135
|
let code = 0;
|
|
118
136
|
|
package/dist/test.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["test.cmd.tsx"],"names":["TestCmd","constructor","tester","workspace","logger","render","userPattern","watch","debug","env","scope","junit","coverage","off","timer","Timer","create","scopeName","undefined","start","ConsumerNotFound","
|
|
1
|
+
{"version":3,"sources":["test.cmd.tsx"],"names":["TestCmd","constructor","tester","workspace","logger","render","userPattern","watch","debug","all","env","scope","junit","coverage","off","timer","Timer","create","scopeName","undefined","start","ConsumerNotFound","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","length","NoMatchingComponents","code","data","console","chalk","cyan","name","tests","test","results","forEach","errors","seconds","stop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAcO,MAAMA,OAAN,CAAiC;AAiBtCC,EAAAA,WAAW,CAASC,MAAT,EAAqCC,SAArC,EAAmEC,MAAnE,EAAmF;AAAA,SAA1EF,MAA0E,GAA1EA,MAA0E;AAAA,SAA9CC,SAA8C,GAA9CA,SAA8C;AAAA,SAAhBC,MAAgB,GAAhBA,MAAgB;AAAA,kDAhBvF,gBAgBuF;AAAA,yDAfhF,0CAegF;AAAA,mDAdtF,IAcsF;AAAA,mDAbtF,aAasF;AAAA,8DAZ3E,EAY2E;AAAA,qDAXpF,CACR,CAAC,GAAD,EAAM,OAAN,EAAe,iCAAf,CADQ,EAER,CAAC,GAAD,EAAM,OAAN,EAAe,iCAAf,CAFQ,EAGR,CAAC,GAAD,EAAM,KAAN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sB,MAAAA,IADK;AAELC,MAAAA,IAAI,eACF,+BAAC,UAAD,qBACE,+BAAC,WAAD,kBADF,eAEE,+BAAC,WAAD;AAAM,QAAA,KAAK,EAAC;AAAZ,SAAoBL,UAAU,CAACE,MAA/B,MAFF,eAGE,+BAAC,WAAD,yBAHF,eAIE,+BAAC,WAAD;AAAM,QAAA,KAAK,EAAC;AAAZ,SAAoBa,OAApB,MAJF,eAKE,+BAAC,WAAD,mBALF;AAHG,KAAP;AAYD;;AAxFqC","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Logger } from '@teambit/logger';\nimport { Workspace } from '@teambit/workspace';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { Box, Text } from 'ink';\nimport React from 'react';\nimport { NoMatchingComponents } from './exceptions';\n\nimport type { TesterMain } from './tester.main.runtime';\n\ntype TestFlags = {\n watch: boolean;\n debug: boolean;\n all: boolean;\n env?: string;\n scope?: string;\n junit?: string;\n coverage?: boolean;\n};\n\nexport class TestCmd implements Command {\n name = 'test [pattern]';\n description = 'test set of components in your workspace';\n alias = 'at';\n group = 'development';\n shortDescription = '';\n options = [\n ['w', 'watch', 'start the tester in watch mode.'],\n ['d', 'debug', 'start the tester in debug mode.'],\n ['a', 'all', 'test all components, not only new and modified'],\n ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'],\n ['', 'coverage', 'show code coverage data'],\n ['e', 'env <id>', 'test only the given env'],\n ['s', 'scope <scope>', 'name of the scope to test'],\n // TODO: we need to reduce this redundant casting every time.\n ] as CommandOptions;\n\n constructor(private tester: TesterMain, private workspace: Workspace, private logger: Logger) {}\n\n async render(\n [userPattern]: [string],\n { watch = false, debug = false, all = false, env, scope, junit, coverage = false }: TestFlags\n ) {\n this.logger.off();\n const timer = Timer.create();\n const scopeName = typeof scope === 'string' ? scope : undefined;\n timer.start();\n if (!this.workspace) throw new ConsumerNotFound();\n\n const getPatternWithScope = () => {\n if (!userPattern && !scope) return undefined;\n const pattern = userPattern || '**';\n return scopeName ? `${scopeName}/${pattern}` : pattern;\n };\n const patternWithScope = getPatternWithScope();\n const components = await this.workspace.getComponentsByUserInput(all, patternWithScope, true);\n if (!components.length) {\n if (userPattern) throw new NoMatchingComponents(userPattern);\n return {\n code: 0,\n data: (\n <Box>\n <Text bold>\n no components found to test. use \"--all\" flag to test all components or specify the ids to test,\n otherwise, only new and modified components will be tested{' '}\n </Text>\n </Box>\n ),\n };\n }\n\n this.logger.console(\n `testing total of ${components.length} components in workspace '${chalk.cyan(this.workspace.name)}'`\n );\n\n let code = 0;\n if (watch && !debug) {\n await this.tester.watch(components, {\n watch,\n debug,\n env,\n coverage,\n });\n } else {\n const tests = await this.tester.test(components, {\n watch,\n debug,\n env,\n junit,\n coverage,\n });\n tests?.results?.forEach((test) => (test.data?.errors?.length ? (code = 1) : null));\n }\n const { seconds } = timer.stop();\n\n if (watch) return <Box></Box>;\n return {\n code,\n data: (\n <Box>\n <Text>tested </Text>\n <Text color=\"cyan\">{components.length} </Text>\n <Text>components in </Text>\n <Text color=\"cyan\">{seconds} </Text>\n <Text>seconds.</Text>\n </Box>\n ),\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/tester",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.564",
|
|
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.564"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -24,24 +24,24 @@
|
|
|
24
24
|
"@babel/runtime": "7.12.18",
|
|
25
25
|
"core-js": "^3.0.0",
|
|
26
26
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
27
|
-
"@teambit/cli": "0.0.
|
|
28
|
-
"@teambit/logger": "0.0.
|
|
29
|
-
"@teambit/workspace": "0.0.
|
|
30
|
-
"@teambit/component": "0.0.
|
|
31
|
-
"@teambit/graphql": "0.0.
|
|
32
|
-
"@teambit/builder": "0.0.
|
|
33
|
-
"@teambit/dev-files": "0.0.
|
|
34
|
-
"@teambit/envs": "0.0.
|
|
35
|
-
"@teambit/tests-results": "0.0.
|
|
36
|
-
"@teambit/ui": "0.0.
|
|
37
|
-
"@teambit/compiler": "0.0.
|
|
38
|
-
"@teambit/bit-error": "0.0.
|
|
39
|
-
"@teambit/defender.ui.test-loader": "0.0.
|
|
40
|
-
"@teambit/defender.ui.test-table": "0.0.
|
|
27
|
+
"@teambit/cli": "0.0.392",
|
|
28
|
+
"@teambit/logger": "0.0.477",
|
|
29
|
+
"@teambit/workspace": "0.0.564",
|
|
30
|
+
"@teambit/component": "0.0.564",
|
|
31
|
+
"@teambit/graphql": "0.0.564",
|
|
32
|
+
"@teambit/builder": "0.0.564",
|
|
33
|
+
"@teambit/dev-files": "0.0.564",
|
|
34
|
+
"@teambit/envs": "0.0.564",
|
|
35
|
+
"@teambit/tests-results": "0.0.78",
|
|
36
|
+
"@teambit/ui": "0.0.564",
|
|
37
|
+
"@teambit/compiler": "0.0.564",
|
|
38
|
+
"@teambit/bit-error": "0.0.378",
|
|
39
|
+
"@teambit/defender.ui.test-loader": "0.0.471",
|
|
40
|
+
"@teambit/defender.ui.test-table": "0.0.474",
|
|
41
41
|
"@teambit/design.ui.alert-card": "0.0.13",
|
|
42
42
|
"@teambit/design.ui.empty-box": "0.0.352",
|
|
43
43
|
"@teambit/design.ui.separator": "0.0.351",
|
|
44
|
-
"@teambit/mdx.ui.mdx-layout": "0.0.
|
|
44
|
+
"@teambit/mdx.ui.mdx-layout": "0.0.473"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^17.0.8",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@apollo/client": "^3.0.0",
|
|
60
|
-
"@teambit/legacy": "1.0.
|
|
60
|
+
"@teambit/legacy": "1.0.178",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
62
62
|
"react": "^16.8.0 || ^17.0.0"
|
|
63
63
|
},
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react": "-"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@teambit/legacy": "1.0.
|
|
88
|
+
"@teambit/legacy": "1.0.178",
|
|
89
89
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
90
90
|
"react": "^16.8.0 || ^17.0.0"
|
|
91
91
|
}
|