@teambit/tester 0.0.761 → 0.0.764

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.js CHANGED
@@ -51,30 +51,30 @@ function _timer() {
51
51
  return data;
52
52
  }
53
53
 
54
- function _ink() {
55
- const data = require("ink");
54
+ function _constants() {
55
+ const data = require("@teambit/legacy/dist/constants");
56
56
 
57
- _ink = function () {
57
+ _constants = function () {
58
58
  return data;
59
59
  };
60
60
 
61
61
  return data;
62
62
  }
63
63
 
64
- function _react() {
65
- const data = _interopRequireDefault(require("react"));
64
+ function _ink() {
65
+ const data = require("ink");
66
66
 
67
- _react = function () {
67
+ _ink = function () {
68
68
  return data;
69
69
  };
70
70
 
71
71
  return data;
72
72
  }
73
73
 
74
- function _exceptions2() {
75
- const data = require("./exceptions");
74
+ function _react() {
75
+ const data = _interopRequireDefault(require("react"));
76
76
 
77
- _exceptions2 = function () {
77
+ _react = function () {
78
78
  return data;
79
79
  };
80
80
 
@@ -90,11 +90,11 @@ class TestCmd {
90
90
  (0, _defineProperty2().default)(this, "description", 'test components in the workspace');
91
91
  (0, _defineProperty2().default)(this, "arguments", [{
92
92
  name: 'component-pattern',
93
- description: 'the components to test (defaults to all components). use component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns. e.g. "ui/**, pages/**"\nwrap the pattern with quotes (note that the "!" exclusion sign cannot be used here)'
93
+ description: _constants().COMPONENT_PATTERN_HELP
94
94
  }]);
95
95
  (0, _defineProperty2().default)(this, "alias", 'at');
96
96
  (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>', 'name of the scope to test'] // TODO: we need to reduce this redundant casting every time.
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.
98
98
  ]);
99
99
  }
100
100
 
@@ -110,6 +110,11 @@ class TestCmd {
110
110
  const timer = _timer().Timer.create();
111
111
 
112
112
  const scopeName = typeof scope === 'string' ? scope : undefined;
113
+
114
+ if (scopeName) {
115
+ this.logger.consoleWarning(`--scope is deprecated, use the pattern argument instead. e.g. "scopeName/**" for the entire scope`);
116
+ }
117
+
113
118
  timer.start();
114
119
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
115
120
 
@@ -123,7 +128,6 @@ class TestCmd {
123
128
  const components = await this.workspace.getComponentsByUserInput(all, patternWithScope, true);
124
129
 
125
130
  if (!components.length) {
126
- if (userPattern) throw new (_exceptions2().NoMatchingComponents)(userPattern);
127
131
  return {
128
132
  code: 0,
129
133
  data: /*#__PURE__*/_react().default.createElement(_ink().Box, null, /*#__PURE__*/_react().default.createElement(_ink().Text, {
@@ -1 +1 @@
1
- {"version":3,"names":["TestCmd","constructor","tester","workspace","logger","name","description","render","userPattern","watch","debug","all","env","scope","junit","coverage","timer","Timer","create","scopeName","undefined","start","ConsumerNotFound","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","length","NoMatchingComponents","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 { 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 [component-pattern]';\n description = 'test components in the workspace';\n arguments = [\n {\n name: 'component-pattern',\n description:\n 'the components to test (defaults to all components). use component name, component id, or component pattern. use component pattern to select multiple components. \\nuse comma to separate patterns. e.g. \"ui/**, pages/**\"\\nwrap the pattern with quotes (note that the \"!\" exclusion sign cannot be used here)',\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 ['s', 'scope <scope-name>', '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 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 // 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;;AAcO,MAAMA,OAAN,CAAiC;EAuBtCC,WAAW,CAASC,MAAT,EAAqCC,SAArC,EAAmEC,MAAnE,EAAmF;IAAA,KAA1EF,MAA0E,GAA1EA,MAA0E;IAAA,KAA9CC,SAA8C,GAA9CA,SAA8C;IAAA,KAAhBC,MAAgB,GAAhBA,MAAgB;IAAA,8CAtBvF,0BAsBuF;IAAA,qDArBhF,kCAqBgF;IAAA,mDApBlF,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EACT;IAHJ,CADU,CAoBkF;IAAA,+CAbtF,IAasF;IAAA,+CAZtF,aAYsF;IAAA,iDAXpF,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/FqC"}
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;EA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AI/CE,KAJ+C;QAK/CC;MAL+C,CAA7B,CAApB;MAOA,IAAIqB,KAAK,CAACE,SAAN,EAAJ,EAAuBR,IAAI,GAAG,CAAP;IACxB;;IACD,MAAM;MAAES;IAAF,IAAcvB,KAAK,CAACwB,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"}
@@ -43,7 +43,7 @@ class TesterCompareSection {
43
43
  (0, _defineProperty2().default)(this, "navigationLink", {
44
44
  href: 'tests',
45
45
  children: 'Tests',
46
- order: 4
46
+ order: 3
47
47
  });
48
48
  (0, _defineProperty2().default)(this, "route", {
49
49
  path: 'tests/*',
@@ -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: 4,\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,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"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/tester",
3
- "version": "0.0.761",
3
+ "version": "0.0.764",
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.761"
9
+ "version": "0.0.764"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -25,19 +25,19 @@
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.503",
29
- "@teambit/logger": "0.0.596",
30
- "@teambit/workspace": "0.0.761",
31
- "@teambit/component": "0.0.761",
32
- "@teambit/defender.ui.test-compare": "0.0.8",
33
- "@teambit/graphql": "0.0.761",
34
- "@teambit/builder": "0.0.761",
35
- "@teambit/dev-files": "0.0.761",
36
- "@teambit/envs": "0.0.761",
28
+ "@teambit/cli": "0.0.505",
29
+ "@teambit/logger": "0.0.598",
30
+ "@teambit/workspace": "0.0.764",
31
+ "@teambit/component": "0.0.764",
32
+ "@teambit/defender.ui.test-compare": "0.0.10",
33
+ "@teambit/graphql": "0.0.764",
34
+ "@teambit/builder": "0.0.764",
35
+ "@teambit/dev-files": "0.0.764",
36
+ "@teambit/envs": "0.0.764",
37
37
  "@teambit/tests-results": "0.0.97",
38
- "@teambit/ui": "0.0.761",
39
- "@teambit/compiler": "0.0.761",
40
- "@teambit/component-compare": "0.0.9",
38
+ "@teambit/ui": "0.0.764",
39
+ "@teambit/compiler": "0.0.764",
40
+ "@teambit/component-compare": "0.0.12",
41
41
  "@teambit/bit-error": "0.0.394",
42
42
  "@teambit/defender.ui.test-loader": "0.0.490",
43
43
  "@teambit/defender.ui.test-table": "0.0.495",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@apollo/client": "^3.0.0",
64
- "@teambit/legacy": "1.0.283",
64
+ "@teambit/legacy": "1.0.285",
65
65
  "react-dom": "^16.8.0 || ^17.0.0",
66
66
  "react": "^16.8.0 || ^17.0.0"
67
67
  },
@@ -89,7 +89,7 @@
89
89
  "react": "-"
90
90
  },
91
91
  "peerDependencies": {
92
- "@teambit/legacy": "1.0.283",
92
+ "@teambit/legacy": "1.0.285",
93
93
  "react-dom": "^16.8.0 || ^17.0.0",
94
94
  "react": "^16.8.0 || ^17.0.0"
95
95
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.761/dist/tester.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.761/dist/tester.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.764/dist/tester.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.764/dist/tester.docs.mdx')]
package/test.cmd.tsx CHANGED
@@ -4,10 +4,9 @@ import { Logger } from '@teambit/logger';
4
4
  import { Workspace } from '@teambit/workspace';
5
5
  import { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';
6
6
  import { Timer } from '@teambit/legacy/dist/toolbox/timer';
7
+ import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
7
8
  import { Box, Text } from 'ink';
8
9
  import React from 'react';
9
- import { NoMatchingComponents } from './exceptions';
10
-
11
10
  import type { TesterMain } from './tester.main.runtime';
12
11
 
13
12
  type TestFlags = {
@@ -26,8 +25,7 @@ export class TestCmd implements Command {
26
25
  arguments = [
27
26
  {
28
27
  name: 'component-pattern',
29
- description:
30
- 'the components to test (defaults to all components). use component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns. e.g. "ui/**, pages/**"\nwrap the pattern with quotes (note that the "!" exclusion sign cannot be used here)',
28
+ description: COMPONENT_PATTERN_HELP,
31
29
  },
32
30
  ];
33
31
  alias = 'at';
@@ -39,7 +37,11 @@ export class TestCmd implements Command {
39
37
  ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'],
40
38
  ['', 'coverage', 'show code coverage data'],
41
39
  ['e', 'env <id>', 'test only the given env'],
42
- ['s', 'scope <scope-name>', 'name of the scope to test'],
40
+ [
41
+ 's',
42
+ 'scope <scope-name>',
43
+ 'DEPRECATED. (use the pattern instead, e.g. "scopeName/**"). name of the scope to test',
44
+ ],
43
45
  // TODO: we need to reduce this redundant casting every time.
44
46
  ] as CommandOptions;
45
47
 
@@ -51,6 +53,11 @@ export class TestCmd implements Command {
51
53
  ) {
52
54
  const timer = Timer.create();
53
55
  const scopeName = typeof scope === 'string' ? scope : undefined;
56
+ if (scopeName) {
57
+ this.logger.consoleWarning(
58
+ `--scope is deprecated, use the pattern argument instead. e.g. "scopeName/**" for the entire scope`
59
+ );
60
+ }
54
61
  timer.start();
55
62
  if (!this.workspace) throw new ConsumerNotFound();
56
63
 
@@ -62,7 +69,6 @@ export class TestCmd implements Command {
62
69
  const patternWithScope = getPatternWithScope();
63
70
  const components = await this.workspace.getComponentsByUserInput(all, patternWithScope, true);
64
71
  if (!components.length) {
65
- if (userPattern) throw new NoMatchingComponents(userPattern);
66
72
  return {
67
73
  code: 0,
68
74
  data: (
@@ -9,7 +9,7 @@ export class TesterCompareSection implements Section {
9
9
  navigationLink = {
10
10
  href: 'tests',
11
11
  children: 'Tests',
12
- order: 4,
12
+ order: 3,
13
13
  };
14
14
 
15
15
  route = {