@teambit/tester 0.0.881 → 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.
Files changed (40) hide show
  1. package/dist/exceptions/index.js +0 -6
  2. package/dist/exceptions/index.js.map +1 -1
  3. package/dist/exceptions/no-matching-components.js +0 -3
  4. package/dist/exceptions/no-matching-components.js.map +1 -1
  5. package/dist/exceptions/no-test-files-found.js +0 -6
  6. package/dist/exceptions/no-test-files-found.js.map +1 -1
  7. package/dist/index.js +0 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/test.cmd.js +2 -37
  10. package/dist/test.cmd.js.map +1 -1
  11. package/dist/tester.aspect.js +0 -5
  12. package/dist/tester.aspect.js.map +1 -1
  13. package/dist/tester.compare.section.js +0 -13
  14. package/dist/tester.compare.section.js.map +1 -1
  15. package/dist/tester.composition.js +0 -6
  16. package/dist/tester.composition.js.map +1 -1
  17. package/dist/tester.graphql.js +0 -17
  18. package/dist/tester.graphql.js.map +1 -1
  19. package/dist/tester.js +0 -6
  20. package/dist/tester.js.map +1 -1
  21. package/dist/tester.main.runtime.js +3 -94
  22. package/dist/tester.main.runtime.js.map +1 -1
  23. package/dist/tester.service.js +0 -50
  24. package/dist/tester.service.js.map +1 -1
  25. package/dist/tester.task.js +11 -54
  26. package/dist/tester.task.js.map +1 -1
  27. package/dist/tester.ui.runtime.js +1 -34
  28. package/dist/tester.ui.runtime.js.map +1 -1
  29. package/dist/tests.section.js +0 -13
  30. package/dist/tests.section.js.map +1 -1
  31. package/dist/utils/detect-spec-files.js +0 -4
  32. package/dist/utils/detect-spec-files.js.map +1 -1
  33. package/dist/utils/index.js +0 -3
  34. package/dist/utils/index.js.map +1 -1
  35. package/dist/utils/junit-generator.js +0 -18
  36. package/dist/utils/junit-generator.js.map +1 -1
  37. package/package-tar/teambit-tester-0.0.882.tgz +0 -0
  38. package/package.json +11 -11
  39. package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
  40. package/package-tar/teambit-tester-0.0.881.tgz +0 -0
@@ -15,24 +15,18 @@ Object.defineProperty(exports, "NoTestFilesFound", {
15
15
  return _noTestFilesFound().NoTestFilesFound;
16
16
  }
17
17
  });
18
-
19
18
  function _noTestFilesFound() {
20
19
  const data = require("./no-test-files-found");
21
-
22
20
  _noTestFilesFound = function () {
23
21
  return data;
24
22
  };
25
-
26
23
  return data;
27
24
  }
28
-
29
25
  function _noMatchingComponents() {
30
26
  const data = require("./no-matching-components");
31
-
32
27
  _noMatchingComponents = function () {
33
28
  return data;
34
29
  };
35
-
36
30
  return data;
37
31
  }
38
32
 
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { NoTestFilesFound } from './no-test-files-found';\nexport { NoMatchingComponents } from './no-matching-components';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { NoTestFilesFound } from './no-test-files-found';\nexport { NoMatchingComponents } from './no-matching-components';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.NoMatchingComponents = void 0;
7
-
8
7
  class NoMatchingComponents extends Error {
9
8
  constructor(pattern) {
10
9
  super(`could not find components matching to pattern: ${pattern}`);
11
10
  }
12
-
13
11
  }
14
-
15
12
  exports.NoMatchingComponents = NoMatchingComponents;
16
13
 
17
14
  //# sourceMappingURL=no-matching-components.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NoMatchingComponents","Error","constructor","pattern"],"sources":["no-matching-components.ts"],"sourcesContent":["export class NoMatchingComponents extends Error {\n constructor(pattern: string) {\n super(`could not find components matching to pattern: ${pattern}`);\n }\n}\n"],"mappings":";;;;;;;AAAO,MAAMA,oBAAN,SAAmCC,KAAnC,CAAyC;EAC9CC,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAO,kDAAiDA,OAAQ,EAAhE;EACD;;AAH6C"}
1
+ {"version":3,"names":["NoMatchingComponents","Error","constructor","pattern"],"sources":["no-matching-components.ts"],"sourcesContent":["export class NoMatchingComponents extends Error {\n constructor(pattern: string) {\n super(`could not find components matching to pattern: ${pattern}`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,SAASC,KAAK,CAAC;EAC9CC,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAAE,kDAAiDA,OAAQ,EAAC,CAAC;EACpE;AACF;AAAC"}
@@ -4,24 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.NoTestFilesFound = void 0;
7
-
8
7
  function _bitError() {
9
8
  const data = require("@teambit/bit-error");
10
-
11
9
  _bitError = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  class NoTestFilesFound extends _bitError().BitError {
19
15
  constructor(testRegex) {
20
16
  super(`no test files for regex: '${testRegex}' found for any of the components in the workspace.`);
21
17
  }
22
-
23
18
  }
24
-
25
19
  exports.NoTestFilesFound = NoTestFilesFound;
26
20
 
27
21
  //# sourceMappingURL=no-test-files-found.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NoTestFilesFound","BitError","constructor","testRegex"],"sources":["no-test-files-found.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class NoTestFilesFound extends BitError {\n constructor(testRegex: string) {\n super(`no test files for regex: '${testRegex}' found for any of the components in the workspace.`);\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,gBAAN,SAA+BC,oBAA/B,CAAwC;EAC7CC,WAAW,CAACC,SAAD,EAAoB;IAC7B,MAAO,6BAA4BA,SAAU,qDAA7C;EACD;;AAH4C"}
1
+ {"version":3,"names":["NoTestFilesFound","BitError","constructor","testRegex"],"sources":["no-test-files-found.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class NoTestFilesFound extends BitError {\n constructor(testRegex: string) {\n super(`no test files for regex: '${testRegex}' found for any of the components in the workspace.`);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,gBAAgB,SAASC,oBAAQ,CAAC;EAC7CC,WAAW,CAACC,SAAiB,EAAE;IAC7B,KAAK,CAAE,6BAA4BA,SAAU,qDAAoD,CAAC;EACpG;AACF;AAAC"}
package/dist/index.js CHANGED
@@ -16,29 +16,21 @@ Object.defineProperty(exports, "Tests", {
16
16
  }
17
17
  });
18
18
  exports.default = void 0;
19
-
20
19
  function _tester() {
21
20
  const data = require("./tester.aspect");
22
-
23
21
  _tester = function () {
24
22
  return data;
25
23
  };
26
-
27
24
  return data;
28
25
  }
29
-
30
26
  function _tester2() {
31
27
  const data = require("./tester");
32
-
33
28
  _tester2 = function () {
34
29
  return data;
35
30
  };
36
-
37
31
  return data;
38
32
  }
39
-
40
33
  var _default = _tester().TesterAspect;
41
-
42
34
  exports.default = _default;
43
35
 
44
36
  //# sourceMappingURL=index.js.map
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 {\n Tester,\n TesterContext,\n CallbackFn,\n SpecFiles,\n ComponentPatternsMap,\n ComponentsResults,\n ComponentPatternsEntry,\n} 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;;eAceA,sB"}
1
+ {"version":3,"names":["TesterAspect"],"sources":["index.ts"],"sourcesContent":["import { TesterAspect } from './tester.aspect';\n\nexport { Tests } from './tester';\nexport type {\n Tester,\n TesterContext,\n CallbackFn,\n SpecFiles,\n ComponentPatternsMap,\n ComponentsResults,\n ComponentPatternsEntry,\n} 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;AAAiC,eAclBA,sBAAY;AAAA"}
package/dist/test.cmd.js CHANGED
@@ -1,86 +1,61 @@
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.TestCmd = 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 _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _exceptions() {
35
25
  const data = require("@teambit/legacy/dist/consumer/exceptions");
36
-
37
26
  _exceptions = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _timer() {
45
32
  const data = require("@teambit/legacy/dist/toolbox/timer");
46
-
47
33
  _timer = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _constants() {
55
39
  const data = require("@teambit/legacy/dist/constants");
56
-
57
40
  _constants = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _ink() {
65
46
  const data = require("ink");
66
-
67
47
  _ink = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _react() {
75
53
  const data = _interopRequireDefault(require("react"));
76
-
77
54
  _react = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  class TestCmd {
85
60
  constructor(tester, workspace, logger) {
86
61
  this.tester = tester;
@@ -94,7 +69,8 @@ class TestCmd {
94
69
  }]);
95
70
  (0, _defineProperty2().default)(this, "alias", 'at');
96
71
  (0, _defineProperty2().default)(this, "group", 'development');
97
- (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>', 'DEPRECATED. (use the pattern instead, e.g. "scopeName/**"). name of the scope to test'] // TODO: we need to reduce this redundant casting every time.
72
+ (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>', 'DEPRECATED. (use the pattern instead, e.g. "scopeName/**"). name of the scope to test']
73
+ // TODO: we need to reduce this redundant casting every time.
98
74
  ]);
99
75
  }
100
76
 
@@ -108,25 +84,19 @@ class TestCmd {
108
84
  coverage = false
109
85
  }) {
110
86
  const timer = _timer().Timer.create();
111
-
112
87
  const scopeName = typeof scope === 'string' ? scope : undefined;
113
-
114
88
  if (scopeName) {
115
89
  this.logger.consoleWarning(`--scope is deprecated, use the pattern argument instead. e.g. "scopeName/**" for the entire scope`);
116
90
  }
117
-
118
91
  timer.start();
119
92
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
120
-
121
93
  const getPatternWithScope = () => {
122
94
  if (!userPattern && !scope) return undefined;
123
95
  const pattern = userPattern || '**';
124
96
  return scopeName ? `${scopeName}/${pattern}` : pattern;
125
97
  };
126
-
127
98
  const patternWithScope = getPatternWithScope();
128
99
  const components = await this.workspace.getComponentsByUserInput(all, patternWithScope, true);
129
-
130
100
  if (!components.length) {
131
101
  return {
132
102
  code: 0,
@@ -135,10 +105,8 @@ class TestCmd {
135
105
  }, "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", ' '))
136
106
  };
137
107
  }
138
-
139
108
  this.logger.console(`testing total of ${components.length} components in workspace '${_chalk().default.cyan(this.workspace.name)}'`);
140
109
  let code = 0;
141
-
142
110
  if (watch && !debug) {
143
111
  // avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be
144
112
  // swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first
@@ -160,7 +128,6 @@ class TestCmd {
160
128
  });
161
129
  if (tests.hasErrors()) code = 1;
162
130
  }
163
-
164
131
  const {
165
132
  seconds
166
133
  } = timer.stop();
@@ -172,9 +139,7 @@ class TestCmd {
172
139
  }, seconds, " "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, "seconds."))
173
140
  };
174
141
  }
175
-
176
142
  }
177
-
178
143
  exports.TestCmd = TestCmd;
179
144
 
180
145
  //# sourceMappingURL=test.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TestCmd","constructor","tester","workspace","logger","name","description","COMPONENT_PATTERN_HELP","render","userPattern","watch","debug","all","env","scope","junit","coverage","timer","Timer","create","scopeName","undefined","consoleWarning","start","ConsumerNotFound","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","length","code","data","console","chalk","cyan","off","tests","test","hasErrors","seconds","stop"],"sources":["test.cmd.tsx"],"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 { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Box, Text } from 'ink';\nimport React from 'react';\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 [component-pattern]';\n description = 'test components in the workspace';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'at';\n group = 'development';\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 [\n 's',\n 'scope <scope-name>',\n 'DEPRECATED. (use the pattern instead, e.g. \"scopeName/**\"). name of the scope to test',\n ],\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 const timer = Timer.create();\n const scopeName = typeof scope === 'string' ? scope : undefined;\n if (scopeName) {\n this.logger.consoleWarning(\n `--scope is deprecated, use the pattern argument instead. e.g. \"scopeName/**\" for the entire scope`\n );\n }\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 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 // avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be\n // swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first\n // place, these errors won't be shown)\n this.logger.off();\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 if (tests.hasErrors()) code = 1;\n }\n const { seconds } = timer.stop();\n\n if (watch) return <Box></Box>;\n return {\n code,\n data: (\n <Box>\n <Text>test has been completed in </Text>\n <Text color=\"cyan\">{seconds} </Text>\n <Text>seconds.</Text>\n </Box>\n ),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;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;;AAaO,MAAMA,OAAN,CAAiC;EA0BtCC,WAAW,CAASC,MAAT,EAAqCC,SAArC,EAAmEC,MAAnE,EAAmF;IAAA,KAA1EF,MAA0E,GAA1EA,MAA0E;IAAA,KAA9CC,S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IAAN,EAApB;IAEA,IAAI/B,KAAJ,EAAW,oBAAO,+BAAC,UAAD,OAAP;IACX,OAAO;MACLqB,IADK;MAELC,IAAI,eACF,+BAAC,UAAD,qBACE,+BAAC,WAAD,sCADF,eAEE,+BAAC,WAAD;QAAM,KAAK,EAAC;MAAZ,GAAoBQ,OAApB,MAFF,eAGE,+BAAC,WAAD,mBAHF;IAHG,CAAP;EAUD;;AAtGqC"}
1
+ {"version":3,"names":["TestCmd","constructor","tester","workspace","logger","name","description","COMPONENT_PATTERN_HELP","render","userPattern","watch","debug","all","env","scope","junit","coverage","timer","Timer","create","scopeName","undefined","consoleWarning","start","ConsumerNotFound","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","length","code","data","console","chalk","cyan","off","tests","test","hasErrors","seconds","stop"],"sources":["test.cmd.tsx"],"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 { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Box, Text } from 'ink';\nimport React from 'react';\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 [component-pattern]';\n description = 'test components in the workspace';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'at';\n group = 'development';\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 [\n 's',\n 'scope <scope-name>',\n 'DEPRECATED. (use the pattern instead, e.g. \"scopeName/**\"). name of the scope to test',\n ],\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 const timer = Timer.create();\n const scopeName = typeof scope === 'string' ? scope : undefined;\n if (scopeName) {\n this.logger.consoleWarning(\n `--scope is deprecated, use the pattern argument instead. e.g. \"scopeName/**\" for the entire scope`\n );\n }\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 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 // avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be\n // swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first\n // place, these errors won't be shown)\n this.logger.off();\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 if (tests.hasErrors()) code = 1;\n }\n const { seconds } = timer.stop();\n\n if (watch) return <Box></Box>;\n return {\n code,\n data: (\n <Box>\n <Text>test has been completed in </Text>\n <Text color=\"cyan\">{seconds} </Text>\n <Text>seconds.</Text>\n </Box>\n ),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;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AAK;QACLE,GAAG;QACHG;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,MAAMqB,KAAK,GAAG,MAAM,IAAI,CAACnC,MAAM,CAACoC,IAAI,CAACV,UAAU,EAAE;QAC/ClB,KAAK;QACLC,KAAK;QACLE,GAAG;QACHE,KAAK;QACLC;MACF,CAAC,CAAC;MACF,IAAIqB,KAAK,CAACE,SAAS,EAAE,EAAER,IAAI,GAAG,CAAC;IACjC;IACA,MAAM;MAAES;IAAQ,CAAC,GAAGvB,KAAK,CAACwB,IAAI,EAAE;IAEhC,IAAI/B,KAAK,EAAE,oBAAO,+BAAC,UAAG,OAAO;IAC7B,OAAO;MACLqB,IAAI;MACJC,IAAI,eACF,+BAAC,UAAG,qBACF,+BAAC,WAAI,sCAAmC,eACxC,+BAAC,WAAI;QAAC,KAAK,EAAC;MAAM,GAAEQ,OAAO,MAAS,eACpC,+BAAC,WAAI,mBAAgB;IAG3B,CAAC;EACH;AACF;AAAC"}
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.TesterAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const TesterAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.defender/tester'
20
16
  });
21
-
22
17
  exports.TesterAspect = TesterAspect;
23
18
  var _default = TesterAspect;
24
19
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["TesterAspect","Aspect","create","id"],"sources":["tester.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const TesterAspect = Aspect.create({\n id: 'teambit.defender/tester',\n});\n\nexport default TesterAspect;\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,YAAY,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACxCC,EAAE,EAAE;AADoC,CAAd,CAArB;;;eAIQH,Y"}
1
+ {"version":3,"names":["TesterAspect","Aspect","create","id"],"sources":["tester.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const TesterAspect = Aspect.create({\n id: 'teambit.defender/tester',\n});\n\nexport default TesterAspect;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,YAAY,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACxCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC;AAAA,eAEYH,YAAY;AAAA"}
@@ -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.TesterCompareSection = 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-compare");
32
-
33
24
  _defenderUi = function () {
34
25
  return data;
35
26
  };
36
-
37
27
  return data;
38
28
  }
39
-
40
29
  class TesterCompareSection {
41
30
  constructor(emptyStateSlot) {
42
31
  this.emptyStateSlot = emptyStateSlot;
@@ -52,9 +41,7 @@ class TesterCompareSection {
52
41
  })
53
42
  });
54
43
  }
55
-
56
44
  }
57
-
58
45
  exports.TesterCompareSection = TesterCompareSection;
59
46
 
60
47
  //# sourceMappingURL=tester.compare.section.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TesterCompareSection","constructor","emptyStateSlot","href","children","order","path","element"],"sources":["tester.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { CompareTests } from '@teambit/defender.ui.test-compare';\nimport { EmptyStateSlot } from './tester.ui.runtime';\n\nexport class TesterCompareSection implements Section {\n constructor(private emptyStateSlot: EmptyStateSlot) {}\n\n navigationLink = {\n href: 'tests',\n children: 'Tests',\n order: 3,\n };\n\n route = {\n path: 'tests/*',\n element: <CompareTests emptyState={this.emptyStateSlot} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,oBAAN,CAA8C;EACnDC,WAAW,CAASC,cAAT,EAAyC;IAAA,KAAhCA,cAAgC,GAAhCA,cAAgC;IAAA,wDAEnC;MACfC,IAAI,EAAE,OADS;MAEfC,QAAQ,EAAE,OAFK;MAGfC,KAAK,EAAE;IAHQ,CAFmC;IAAA,+CAQ5C;MACNC,IAAI,EAAE,SADA;MAENC,OAAO,eAAE,+BAAC,0BAAD;QAAc,UAAU,EAAE,KAAKL;MAA/B;IAFH,CAR4C;EAAE;;AADH"}
1
+ {"version":3,"names":["TesterCompareSection","constructor","emptyStateSlot","href","children","order","path","element"],"sources":["tester.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { CompareTests } from '@teambit/defender.ui.test-compare';\nimport { EmptyStateSlot } from './tester.ui.runtime';\n\nexport class TesterCompareSection implements Section {\n constructor(private emptyStateSlot: EmptyStateSlot) {}\n\n navigationLink = {\n href: 'tests',\n children: 'Tests',\n order: 3,\n };\n\n route = {\n path: 'tests/*',\n element: <CompareTests emptyState={this.emptyStateSlot} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,oBAAoB,CAAoB;EACnDC,WAAW,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAA,wDAEjC;MACfC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,OAAO;MACjBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,SAAS;MACfC,OAAO,eAAE,+BAAC,0BAAY;QAAC,UAAU,EAAE,IAAI,CAACL;MAAe;IACzD,CAAC;EAXoD;AAYvD;AAAC"}
@@ -1,22 +1,17 @@
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.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/tester.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=tester.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["tester.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/tester.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["tester.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/tester.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAoD,EAAG,CAEzF;AAAC"}
@@ -1,54 +1,39 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.testerSchema = testerSchema;
11
-
12
9
  function _graphqlSubscriptions() {
13
10
  const data = require("graphql-subscriptions");
14
-
15
11
  _graphqlSubscriptions = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  function _bitId() {
23
17
  const data = require("@teambit/legacy/dist/bit-id");
24
-
25
18
  _bitId = function () {
26
19
  return data;
27
20
  };
28
-
29
21
  return data;
30
22
  }
31
-
32
23
  function _graphqlTag() {
33
24
  const data = _interopRequireDefault(require("graphql-tag"));
34
-
35
25
  _graphqlTag = function () {
36
26
  return data;
37
27
  };
38
-
39
28
  return data;
40
29
  }
41
-
42
30
  function _tester() {
43
31
  const data = require("./tester.service");
44
-
45
32
  _tester = function () {
46
33
  return data;
47
34
  };
48
-
49
35
  return data;
50
36
  }
51
-
52
37
  function testerSchema(tester, graphql) {
53
38
  return {
54
39
  typeDefs: (0, _graphqlTag().default)`
@@ -107,9 +92,7 @@ function testerSchema(tester, graphql) {
107
92
  id
108
93
  }) => {
109
94
  const componentId = await host.resolveComponentId(id);
110
-
111
95
  const idHasVersion = _bitId().BitId.parse(id).hasVersion();
112
-
113
96
  const component = await host.get(componentId);
114
97
  if (!component) return null;
115
98
  const testsResults = await tester.getTestsResults(component, idHasVersion);
@@ -1 +1 @@
1
- {"version":3,"names":["testerSchema","tester","graphql","typeDefs","gql","resolvers","Subscription","testsChanged","subscribe","withFilter","pubsub","asyncIterator","OnTestsChanged","payload","variables","id","ComponentHost","getTests","host","componentId","resolveComponentId","idHasVersion","BitId","parse","hasVersion","component","get","testsResults","getTestsResults"],"sources":["tester.graphql.ts"],"sourcesContent":["import { GraphqlMain, Schema } from '@teambit/graphql';\nimport { ComponentFactory } from '@teambit/component';\nimport { withFilter } from 'graphql-subscriptions';\nimport { BitId } from '@teambit/legacy/dist/bit-id';\nimport gql from 'graphql-tag';\n\nimport { TesterMain } from './tester.main.runtime';\nimport { OnTestsChanged } from './tester.service';\n\nexport function testerSchema(tester: TesterMain, graphql: GraphqlMain): Schema {\n return {\n typeDefs: gql`\n extend type ComponentHost {\n getTests(id: String!): Tests\n }\n\n type Subscription {\n testsChanged(id: String!): Tests\n }\n\n type Tests {\n loading: Boolean!\n testsResults: TestsResults\n }\n\n type TestsChanged {\n testsResults: TestsResults\n }\n\n type TestsResults {\n testFiles: [TestFiles]\n success: Boolean\n start: Int\n }\n\n type TestFiles {\n file: String\n tests: [Tests]\n pass: Int\n failed: Int\n pending: Int\n duration: Int\n slow: Boolean\n errorStr: String\n }\n\n type Tests {\n ancestor: [String]\n name: String\n duration: String\n status: String\n error: String\n }\n `,\n resolvers: {\n Subscription: {\n testsChanged: {\n subscribe: withFilter(\n () => graphql.pubsub.asyncIterator(OnTestsChanged),\n (payload, variables) => {\n return payload.testsChanged.id === variables.id;\n }\n ),\n },\n },\n\n ComponentHost: {\n getTests: async (host: ComponentFactory, { id }: { id: string }) => {\n const componentId = await host.resolveComponentId(id);\n const idHasVersion = BitId.parse(id).hasVersion();\n const component = await host.get(componentId);\n if (!component) return null;\n const testsResults = await tester.getTestsResults(component, idHasVersion);\n if (!testsResults) return null;\n return testsResults;\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,SAASA,YAAT,CAAsBC,MAAtB,EAA0CC,OAA1C,EAAwE;EAC7E,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAA,CAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA3CS;IA4CLC,SAAS,EAAE;MACTC,YAAY,EAAE;QACZC,YAAY,EAAE;UACZC,SAAS,EAAE,IAAAC,kCAAA,EACT,MAAMP,OAAO,CAACQ,MAAR,CAAeC,aAAf,CAA6BC,wBAA7B,CADG,EAET,CAACC,OAAD,EAAUC,SAAV,KAAwB;YACtB,OAAOD,OAAO,CAACN,YAAR,CAAqBQ,EAArB,KAA4BD,SAAS,CAACC,EAA7C;UACD,CAJQ;QADC;MADF,CADL;MAYTC,aAAa,EAAE;QACbC,QAAQ,EAAE,OAAOC,IAAP,EAA+B;UAAEH;QAAF,CAA/B,KAA0D;UAClE,MAAMI,WAAW,GAAG,MAAMD,IAAI,CAACE,kBAAL,CAAwBL,EAAxB,CAA1B;;UACA,MAAMM,YAAY,GAAGC,cAAA,CAAMC,KAAN,CAAYR,EAAZ,EAAgBS,UAAhB,EAArB;;UACA,MAAMC,SAAS,GAAG,MAAMP,IAAI,CAACQ,GAAL,CAASP,WAAT,CAAxB;UACA,IAAI,CAACM,SAAL,EAAgB,OAAO,IAAP;UAChB,MAAME,YAAY,GAAG,MAAM1B,MAAM,CAAC2B,eAAP,CAAuBH,SAAvB,EAAkCJ,YAAlC,CAA3B;UACA,IAAI,CAACM,YAAL,EAAmB,OAAO,IAAP;UACnB,OAAOA,YAAP;QACD;MATY;IAZN;EA5CN,CAAP;AAqED"}
1
+ {"version":3,"names":["testerSchema","tester","graphql","typeDefs","gql","resolvers","Subscription","testsChanged","subscribe","withFilter","pubsub","asyncIterator","OnTestsChanged","payload","variables","id","ComponentHost","getTests","host","componentId","resolveComponentId","idHasVersion","BitId","parse","hasVersion","component","get","testsResults","getTestsResults"],"sources":["tester.graphql.ts"],"sourcesContent":["import { GraphqlMain, Schema } from '@teambit/graphql';\nimport { ComponentFactory } from '@teambit/component';\nimport { withFilter } from 'graphql-subscriptions';\nimport { BitId } from '@teambit/legacy/dist/bit-id';\nimport gql from 'graphql-tag';\n\nimport { TesterMain } from './tester.main.runtime';\nimport { OnTestsChanged } from './tester.service';\n\nexport function testerSchema(tester: TesterMain, graphql: GraphqlMain): Schema {\n return {\n typeDefs: gql`\n extend type ComponentHost {\n getTests(id: String!): Tests\n }\n\n type Subscription {\n testsChanged(id: String!): Tests\n }\n\n type Tests {\n loading: Boolean!\n testsResults: TestsResults\n }\n\n type TestsChanged {\n testsResults: TestsResults\n }\n\n type TestsResults {\n testFiles: [TestFiles]\n success: Boolean\n start: Int\n }\n\n type TestFiles {\n file: String\n tests: [Tests]\n pass: Int\n failed: Int\n pending: Int\n duration: Int\n slow: Boolean\n errorStr: String\n }\n\n type Tests {\n ancestor: [String]\n name: String\n duration: String\n status: String\n error: String\n }\n `,\n resolvers: {\n Subscription: {\n testsChanged: {\n subscribe: withFilter(\n () => graphql.pubsub.asyncIterator(OnTestsChanged),\n (payload, variables) => {\n return payload.testsChanged.id === variables.id;\n }\n ),\n },\n },\n\n ComponentHost: {\n getTests: async (host: ComponentFactory, { id }: { id: string }) => {\n const componentId = await host.resolveComponentId(id);\n const idHasVersion = BitId.parse(id).hasVersion();\n const component = await host.get(componentId);\n if (!component) return null;\n const testsResults = await tester.getTestsResults(component, idHasVersion);\n if (!testsResults) return null;\n return testsResults;\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,YAAY,CAACC,MAAkB,EAAEC,OAAoB,EAAU;EAC7E,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,YAAY,EAAE;QACZC,YAAY,EAAE;UACZC,SAAS,EAAE,IAAAC,kCAAU,EACnB,MAAMP,OAAO,CAACQ,MAAM,CAACC,aAAa,CAACC,wBAAc,CAAC,EAClD,CAACC,OAAO,EAAEC,SAAS,KAAK;YACtB,OAAOD,OAAO,CAACN,YAAY,CAACQ,EAAE,KAAKD,SAAS,CAACC,EAAE;UACjD,CAAC;QAEL;MACF,CAAC;MAEDC,aAAa,EAAE;QACbC,QAAQ,EAAE,OAAOC,IAAsB,EAAE;UAAEH;QAAmB,CAAC,KAAK;UAClE,MAAMI,WAAW,GAAG,MAAMD,IAAI,CAACE,kBAAkB,CAACL,EAAE,CAAC;UACrD,MAAMM,YAAY,GAAGC,cAAK,CAACC,KAAK,CAACR,EAAE,CAAC,CAACS,UAAU,EAAE;UACjD,MAAMC,SAAS,GAAG,MAAMP,IAAI,CAACQ,GAAG,CAACP,WAAW,CAAC;UAC7C,IAAI,CAACM,SAAS,EAAE,OAAO,IAAI;UAC3B,MAAME,YAAY,GAAG,MAAM1B,MAAM,CAAC2B,eAAe,CAACH,SAAS,EAAEJ,YAAY,CAAC;UAC1E,IAAI,CAACM,YAAY,EAAE,OAAO,IAAI;UAC9B,OAAOA,YAAY;QACrB;MACF;IACF;EACF,CAAC;AACH"}
package/dist/tester.js CHANGED
@@ -1,25 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.array.flat.js");
4
-
5
4
  require("core-js/modules/es.array.unscopables.flat.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.Tests = void 0;
11
-
12
9
  class Tests {
13
10
  constructor(components) {
14
11
  this.components = components;
15
12
  }
16
-
17
13
  get errors() {
18
14
  return this.components.map(comp => comp.errors || []).flat();
19
15
  }
20
-
21
16
  }
22
-
23
17
  exports.Tests = Tests;
24
18
 
25
19
  //# sourceMappingURL=tester.js.map
@@ -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 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"}
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,KAAK,CAAC;EACjBC,WAAW,CAAQC,UAA+B,EAAE;IAAA,KAAjCA,UAA+B,GAA/BA,UAA+B;EAAG;EACrD,IAAIC,MAAM,GAAY;IACpB,OAAO,IAAI,CAACD,UAAU,CAACE,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACF,MAAM,IAAI,EAAE,CAAC,CAACG,IAAI,EAAE;EAChE;AACF;AAAC"}