@teambit/tester 0.0.815 → 0.0.818

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/index.d.ts CHANGED
@@ -2,10 +2,6 @@ import { TesterAspect } from './tester.aspect';
2
2
  export { Tests } from './tester';
3
3
  export type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults } from './tester';
4
4
  export type { TesterMain } from './tester.main.runtime';
5
- export type { TesterUI } from './tester.ui.runtime';
6
- export declare const styles: {
7
- testsPage: string;
8
- testBlock: string;
9
- };
5
+ export type { TesterUI, EmptyStateSlot } from './tester.ui.runtime';
10
6
  export { TesterAspect };
11
7
  export default TesterAspect;
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -17,7 +15,7 @@ Object.defineProperty(exports, "Tests", {
17
15
  return _tester2().Tests;
18
16
  }
19
17
  });
20
- exports.styles = exports.default = void 0;
18
+ exports.default = void 0;
21
19
 
22
20
  function _tester() {
23
21
  const data = require("./tester.aspect");
@@ -29,16 +27,6 @@ function _tester() {
29
27
  return data;
30
28
  }
31
29
 
32
- function _testsPageModule() {
33
- const data = _interopRequireDefault(require("./ui/tests-page.module.scss"));
34
-
35
- _testsPageModule = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
30
  function _tester2() {
43
31
  const data = require("./tester");
44
32
 
@@ -49,17 +37,6 @@ function _tester2() {
49
37
  return data;
50
38
  }
51
39
 
52
- const {
53
- testsPage,
54
- testBlock
55
- } = _testsPageModule().default;
56
-
57
- const styles = {
58
- testsPage,
59
- testBlock
60
- };
61
- exports.styles = styles;
62
-
63
40
  var _default = _tester().TesterAspect;
64
41
 
65
42
  exports.default = _default;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["testsPage","testBlock","pageStyles","styles","TesterAspect"],"sources":["index.ts"],"sourcesContent":["import { TesterAspect } from './tester.aspect';\nimport pageStyles from './ui/tests-page.module.scss';\n\nexport { Tests } from './tester';\nexport type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults } from './tester';\nexport type { TesterMain } from './tester.main.runtime';\nexport type { TesterUI } from './tester.ui.runtime';\nconst { testsPage, testBlock } = pageStyles;\nexport const styles = { testsPage, testBlock };\n\nexport { TesterAspect };\nexport default TesterAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA,MAAM;EAAEA,SAAF;EAAaC;AAAb,IAA2BC,0BAAjC;;AACO,MAAMC,MAAM,GAAG;EAAEH,SAAF;EAAaC;AAAb,CAAf;;;eAGQG,sB"}
1
+ {"version":3,"names":["TesterAspect"],"sources":["index.ts"],"sourcesContent":["import { TesterAspect } from './tester.aspect';\n\nexport { Tests } from './tester';\nexport type { Tester, TesterContext, CallbackFn, SpecFiles, ComponentPatternsMap, ComponentsResults } 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;;eAMeA,sB"}
@@ -27,10 +27,10 @@ function _react() {
27
27
  return data;
28
28
  }
29
29
 
30
- function _testsPage() {
31
- const data = require("./ui/tests-page");
30
+ function _defenderUi() {
31
+ const data = require("@teambit/defender.ui.test-page");
32
32
 
33
- _testsPage = function () {
33
+ _defenderUi = function () {
34
34
  return data;
35
35
  };
36
36
 
@@ -42,7 +42,7 @@ class TestsSection {
42
42
  this.emptyStateSlot = emptyStateSlot;
43
43
  (0, _defineProperty2().default)(this, "route", {
44
44
  path: '~tests',
45
- element: /*#__PURE__*/_react().default.createElement(_testsPage().TestsPage, {
45
+ element: /*#__PURE__*/_react().default.createElement(_defenderUi().TestsPage, {
46
46
  emptyState: this.emptyStateSlot
47
47
  })
48
48
  });
@@ -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 './ui/tests-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,YAAN,CAAsC;EAC3CC,WAAW,CAASC,cAAT,EAAyC;IAAA,KAAhCA,cAAgC,GAAhCA,cAAgC;IAAA,+CAE5C;MACNC,IAAI,EAAE,QADA;MAENC,OAAO,eAAE,+BAAC,sBAAD;QAAW,UAAU,EAAE,KAAKF;MAA5B;IAFH,CAF4C;IAAA,wDAMnC;MACfG,IAAI,EAAE,QADS;MAEfC,QAAQ,EAAE;IAFK,CANmC;IAAA,+CAU5C,EAV4C;EAAE;;AADX"}
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,YAAN,CAAsC;EAC3CC,WAAW,CAASC,cAAT,EAAyC;IAAA,KAAhCA,cAAgC,GAAhCA,cAAgC;IAAA,+CAE5C;MACNC,IAAI,EAAE,QADA;MAENC,OAAO,eAAE,+BAAC,uBAAD;QAAW,UAAU,EAAE,KAAKF;MAA5B;IAFH,CAF4C;IAAA,wDAMnC;MACfG,IAAI,EAAE,QADS;MAEfC,QAAQ,EAAE;IAFK,CANmC;IAAA,+CAU5C,EAV4C;EAAE;;AADX"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/tester",
3
- "version": "0.0.815",
3
+ "version": "0.0.818",
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.815"
9
+ "version": "0.0.818"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,41 +17,32 @@
17
17
  "lodash.compact": "3.0.1",
18
18
  "lodash": "4.17.21",
19
19
  "cli-highlight": "2.1.9",
20
- "classnames": "2.2.6",
21
20
  "junit-report-builder": "3.0.0",
22
21
  "strip-ansi": "6.0.0",
23
22
  "@babel/runtime": "7.12.18",
24
23
  "core-js": "^3.0.0",
25
24
  "@teambit/harmony": "0.3.3",
26
- "@teambit/design.ui.separator": "0.0.354",
27
- "@teambit/documenter.ui.heading": "4.1.1",
28
- "@teambit/cli": "0.0.544",
29
- "@teambit/logger": "0.0.637",
30
- "@teambit/workspace": "0.0.815",
31
- "@teambit/component": "0.0.815",
32
- "@teambit/defender.ui.test-compare": "0.0.52",
33
- "@teambit/graphql": "0.0.815",
34
- "@teambit/builder": "0.0.815",
35
- "@teambit/dev-files": "0.0.815",
36
- "@teambit/envs": "0.0.815",
25
+ "@teambit/cli": "0.0.546",
26
+ "@teambit/logger": "0.0.639",
27
+ "@teambit/workspace": "0.0.818",
28
+ "@teambit/component": "0.0.818",
29
+ "@teambit/defender.ui.test-compare": "0.0.54",
30
+ "@teambit/graphql": "0.0.818",
31
+ "@teambit/builder": "0.0.818",
32
+ "@teambit/dev-files": "0.0.818",
33
+ "@teambit/envs": "0.0.818",
37
34
  "@teambit/tests-results": "0.0.97",
38
- "@teambit/ui": "0.0.815",
39
- "@teambit/compiler": "0.0.815",
40
- "@teambit/component-compare": "0.0.63",
41
- "@teambit/bit-error": "0.0.394",
42
- "@teambit/defender.ui.test-loader": "0.0.490",
43
- "@teambit/defender.ui.test-table": "0.0.495",
44
- "@teambit/design.ui.alert-card": "0.0.17",
45
- "@teambit/design.ui.empty-box": "0.0.354",
46
- "@teambit/mdx.ui.mdx-layout": "0.0.501",
47
- "@teambit/ui-foundation.ui.react-router.use-query": "0.0.487"
35
+ "@teambit/ui": "0.0.818",
36
+ "@teambit/compiler": "0.0.818",
37
+ "@teambit/component-compare": "0.0.66",
38
+ "@teambit/defender.ui.test-page": "0.0.1",
39
+ "@teambit/bit-error": "0.0.394"
48
40
  },
49
41
  "devDependencies": {
50
42
  "@types/react": "^17.0.8",
51
43
  "@types/fs-extra": "9.0.7",
52
44
  "@types/lodash.compact": "3.0.6",
53
45
  "@types/lodash": "4.14.165",
54
- "@types/classnames": "2.2.11",
55
46
  "@types/mocha": "9.1.0",
56
47
  "@types/testing-library__jest-dom": "5.9.5",
57
48
  "@types/jest": "^26.0.0",
@@ -60,8 +51,7 @@
60
51
  "@teambit/defender.content.tester-overview": "1.95.0"
61
52
  },
62
53
  "peerDependencies": {
63
- "@apollo/client": "^3.0.0",
64
- "@teambit/legacy": "1.0.327",
54
+ "@teambit/legacy": "1.0.329",
65
55
  "react-dom": "^16.8.0 || ^17.0.0",
66
56
  "react": "^16.8.0 || ^17.0.0"
67
57
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.815/dist/tester.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.815/dist/tester.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.818/dist/tester.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_tester@0.0.818/dist/tester.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/tests.section.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Section } from '@teambit/component';
3
- import { TestsPage } from './ui/tests-page';
3
+ import { TestsPage } from '@teambit/defender.ui.test-page';
4
4
  import { EmptyStateSlot } from './tester.ui.runtime';
5
5
 
6
6
  export class TestsSection implements Section {
@@ -1,7 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { EmptyStateSlot } from '../tester.ui.runtime';
3
- declare type TestsPageProps = {
4
- emptyState: EmptyStateSlot;
5
- } & HTMLAttributes<HTMLDivElement>;
6
- export declare function TestsPage({ className, emptyState }: TestsPageProps): JSX.Element;
7
- export {};
@@ -1,260 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.TestsPage = TestsPage;
9
-
10
- function _client() {
11
- const data = require("@apollo/client");
12
-
13
- _client = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- function _component() {
21
- const data = require("@teambit/component");
22
-
23
- _component = function () {
24
- return data;
25
- };
26
-
27
- return data;
28
- }
29
-
30
- function _uiFoundationUiReactRouter() {
31
- const data = require("@teambit/ui-foundation.ui.react-router.use-query");
32
-
33
- _uiFoundationUiReactRouter = function () {
34
- return data;
35
- };
36
-
37
- return data;
38
- }
39
-
40
- function _documenterUi() {
41
- const data = require("@teambit/documenter.ui.heading");
42
-
43
- _documenterUi = function () {
44
- return data;
45
- };
46
-
47
- return data;
48
- }
49
-
50
- function _designUi() {
51
- const data = require("@teambit/design.ui.separator");
52
-
53
- _designUi = function () {
54
- return data;
55
- };
56
-
57
- return data;
58
- }
59
-
60
- function _designUi2() {
61
- const data = require("@teambit/design.ui.empty-box");
62
-
63
- _designUi2 = function () {
64
- return data;
65
- };
66
-
67
- return data;
68
- }
69
-
70
- function _mdxUi() {
71
- const data = require("@teambit/mdx.ui.mdx-layout");
72
-
73
- _mdxUi = function () {
74
- return data;
75
- };
76
-
77
- return data;
78
- }
79
-
80
- function _designUi3() {
81
- const data = require("@teambit/design.ui.alert-card");
82
-
83
- _designUi3 = function () {
84
- return data;
85
- };
86
-
87
- return data;
88
- }
89
-
90
- function _defenderUi() {
91
- const data = require("@teambit/defender.ui.test-loader");
92
-
93
- _defenderUi = function () {
94
- return data;
95
- };
96
-
97
- return data;
98
- }
99
-
100
- function _classnames() {
101
- const data = _interopRequireDefault(require("classnames"));
102
-
103
- _classnames = function () {
104
- return data;
105
- };
106
-
107
- return data;
108
- }
109
-
110
- function _react() {
111
- const data = _interopRequireWildcard(require("react"));
112
-
113
- _react = function () {
114
- return data;
115
- };
116
-
117
- return data;
118
- }
119
-
120
- function _defenderUi2() {
121
- const data = require("@teambit/defender.ui.test-table");
122
-
123
- _defenderUi2 = function () {
124
- return data;
125
- };
126
-
127
- return data;
128
- }
129
-
130
- function _testsPageModule() {
131
- const data = _interopRequireDefault(require("./tests-page.module.scss"));
132
-
133
- _testsPageModule = function () {
134
- return data;
135
- };
136
-
137
- return data;
138
- }
139
-
140
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
141
-
142
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
143
-
144
- const TESTS_SUBSCRIPTION_CHANGED = (0, _client().gql)`
145
- subscription OnTestsChanged($id: String!) {
146
- testsChanged(id: $id) {
147
- testsResults {
148
- testFiles {
149
- file
150
- duration
151
- pass
152
- failed
153
- pending
154
- errorStr
155
- tests {
156
- ancestor
157
- duration
158
- status
159
- name
160
- error
161
- }
162
- }
163
- }
164
- }
165
- }
166
- `;
167
- const GET_COMPONENT = (0, _client().gql)`
168
- query ($id: String!) {
169
- getHost {
170
- id # for GQL caching
171
- getTests(id: $id) {
172
- loading
173
- testsResults {
174
- testFiles {
175
- file
176
- duration
177
- pass
178
- failed
179
- pending
180
- errorStr
181
- tests {
182
- ancestor
183
- duration
184
- status
185
- name
186
- error
187
- }
188
- }
189
- }
190
- }
191
- }
192
- }
193
- `;
194
-
195
- function TestsPage({
196
- className,
197
- emptyState
198
- }) {
199
- var _onTestsChanged$data, _data$getHost, _testData$testsResult, _component$environmen;
200
-
201
- const query = (0, _uiFoundationUiReactRouter().useQuery)();
202
- const component = (0, _react().useContext)(_component().ComponentContext);
203
- const queryHasVersion = query.get('version');
204
- const id = queryHasVersion ? component.id.toString() : component.id.toStringWithoutVersion();
205
- const onTestsChanged = (0, _client().useSubscription)(TESTS_SUBSCRIPTION_CHANGED, {
206
- variables: {
207
- id
208
- }
209
- });
210
- const {
211
- data
212
- } = (0, _client().useQuery)(GET_COMPONENT, {
213
- variables: {
214
- id
215
- }
216
- });
217
- const testData = ((_onTestsChanged$data = onTestsChanged.data) === null || _onTestsChanged$data === void 0 ? void 0 : _onTestsChanged$data.testsChanged) || (data === null || data === void 0 ? void 0 : (_data$getHost = data.getHost) === null || _data$getHost === void 0 ? void 0 : _data$getHost.getTests);
218
- const testResults = testData === null || testData === void 0 ? void 0 : (_testData$testsResult = testData.testsResults) === null || _testData$testsResult === void 0 ? void 0 : _testData$testsResult.testFiles; // TODO: change loading EmptyBox
219
-
220
- if (testData !== null && testData !== void 0 && testData.loading) return /*#__PURE__*/_react().default.createElement(_defenderUi().TestLoader, null);
221
- const env = (_component$environmen = component.environment) === null || _component$environmen === void 0 ? void 0 : _component$environmen.id;
222
- const EmptyStateTemplate = emptyState.get(env || '');
223
-
224
- if ((testResults === null || (testData === null || testData === void 0 ? void 0 : testData.testsResults) === null) && component.host === 'teambit.workspace/workspace' && EmptyStateTemplate) {
225
- return /*#__PURE__*/_react().default.createElement("div", {
226
- className: (0, _classnames().default)(_testsPageModule().default.testsPage, className)
227
- }, /*#__PURE__*/_react().default.createElement("div", null, /*#__PURE__*/_react().default.createElement(_documenterUi().H1, {
228
- className: _testsPageModule().default.title
229
- }, "Tests"), /*#__PURE__*/_react().default.createElement(_designUi().Separator, {
230
- isPresentational: true,
231
- className: _testsPageModule().default.separator
232
- }), /*#__PURE__*/_react().default.createElement(_designUi3().AlertCard, {
233
- level: "info",
234
- title: "There are no tests for this Component. Learn how to add tests:"
235
- }, /*#__PURE__*/_react().default.createElement(_mdxUi().MDXLayout, null, /*#__PURE__*/_react().default.createElement(EmptyStateTemplate, null)))));
236
- } // TODO: get the docs domain from the community aspect and pass it here as a prop
237
-
238
-
239
- if (testResults === null || (testData === null || testData === void 0 ? void 0 : testData.testsResults) === null) {
240
- return /*#__PURE__*/_react().default.createElement(_designUi2().EmptyBox, {
241
- title: "This component doesn\u2019t have any tests.",
242
- linkText: "Learn how to add tests to your components",
243
- link: `https://bit.dev/docs/dev-services-overview/tester/tester-overview`
244
- });
245
- }
246
-
247
- return /*#__PURE__*/_react().default.createElement("div", {
248
- className: (0, _classnames().default)(_testsPageModule().default.testsPage, className)
249
- }, /*#__PURE__*/_react().default.createElement("div", null, /*#__PURE__*/_react().default.createElement(_documenterUi().H1, {
250
- className: _testsPageModule().default.title
251
- }, "Tests"), /*#__PURE__*/_react().default.createElement(_designUi().Separator, {
252
- isPresentational: true,
253
- className: _testsPageModule().default.separator
254
- }), /*#__PURE__*/_react().default.createElement(_defenderUi2().TestTable, {
255
- testResults: testResults,
256
- className: _testsPageModule().default.testBlock
257
- })));
258
- }
259
-
260
- //# sourceMappingURL=tests-page.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TESTS_SUBSCRIPTION_CHANGED","gql","GET_COMPONENT","TestsPage","className","emptyState","query","useRouterQuery","component","useContext","ComponentContext","queryHasVersion","get","id","toString","toStringWithoutVersion","onTestsChanged","useSubscription","variables","data","useQuery","testData","testsChanged","getHost","getTests","testResults","testsResults","testFiles","loading","env","environment","EmptyStateTemplate","host","classNames","styles","testsPage","title","separator","testBlock"],"sources":["tests-page.tsx"],"sourcesContent":["import { useQuery, useSubscription, gql } from '@apollo/client';\nimport { ComponentContext } from '@teambit/component';\nimport { useQuery as useRouterQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { H1 } from '@teambit/documenter.ui.heading';\nimport { Separator } from '@teambit/design.ui.separator';\nimport { EmptyBox } from '@teambit/design.ui.empty-box';\nimport { MDXLayout } from '@teambit/mdx.ui.mdx-layout';\nimport { AlertCard } from '@teambit/design.ui.alert-card';\nimport { TestLoader } from '@teambit/defender.ui.test-loader';\nimport classNames from 'classnames';\nimport React, { HTMLAttributes, useContext } from 'react';\nimport { TestTable } from '@teambit/defender.ui.test-table';\nimport { EmptyStateSlot } from '../tester.ui.runtime';\nimport styles from './tests-page.module.scss';\n\nconst TESTS_SUBSCRIPTION_CHANGED = gql`\n subscription OnTestsChanged($id: String!) {\n testsChanged(id: $id) {\n testsResults {\n testFiles {\n file\n duration\n pass\n failed\n pending\n errorStr\n tests {\n ancestor\n duration\n status\n name\n error\n }\n }\n }\n }\n }\n`;\n\nconst GET_COMPONENT = gql`\n query ($id: String!) {\n getHost {\n id # for GQL caching\n getTests(id: $id) {\n loading\n testsResults {\n testFiles {\n file\n duration\n pass\n failed\n pending\n errorStr\n tests {\n ancestor\n duration\n status\n name\n error\n }\n }\n }\n }\n }\n }\n`;\n\ntype TestsPageProps = {\n emptyState: EmptyStateSlot;\n} & HTMLAttributes<HTMLDivElement>;\n\nexport function TestsPage({ className, emptyState }: TestsPageProps) {\n const query = useRouterQuery();\n\n const component = useContext(ComponentContext);\n\n const queryHasVersion = query.get('version');\n\n const id = queryHasVersion ? component.id.toString() : component.id.toStringWithoutVersion();\n\n const onTestsChanged = useSubscription(TESTS_SUBSCRIPTION_CHANGED, {\n variables: { id },\n });\n\n const { data } = useQuery(GET_COMPONENT, {\n variables: { id },\n });\n\n const testData = onTestsChanged.data?.testsChanged || data?.getHost?.getTests;\n const testResults = testData?.testsResults?.testFiles;\n\n // TODO: change loading EmptyBox\n if (testData?.loading) return <TestLoader />;\n\n const env = component.environment?.id;\n const EmptyStateTemplate = emptyState.get(env || '');\n\n if (\n (testResults === null || testData?.testsResults === null) &&\n component.host === 'teambit.workspace/workspace' &&\n EmptyStateTemplate\n ) {\n return (\n <div className={classNames(styles.testsPage, className)}>\n <div>\n <H1 className={styles.title}>Tests</H1>\n <Separator isPresentational className={styles.separator} />\n <AlertCard\n level=\"info\"\n title=\"There are no\n tests for this Component. Learn how to add tests:\"\n >\n <MDXLayout>\n <EmptyStateTemplate />\n </MDXLayout>\n </AlertCard>\n </div>\n </div>\n );\n }\n\n // TODO: get the docs domain from the community aspect and pass it here as a prop\n if (testResults === null || testData?.testsResults === null) {\n return (\n <EmptyBox\n title=\"This component doesn’t have any tests.\"\n linkText=\"Learn how to add tests to your components\"\n link={`https://bit.dev/docs/dev-services-overview/tester/tester-overview`}\n />\n );\n }\n\n return (\n <div className={classNames(styles.testsPage, className)}>\n <div>\n <H1 className={styles.title}>Tests</H1>\n <Separator isPresentational className={styles.separator} />\n <TestTable testResults={testResults} className={styles.testBlock} />\n </div>\n </div>\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;;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;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEA,MAAMA,0BAA0B,GAAG,IAAAC,aAAA,CAAI;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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E,+BAAC,wBAAD;IAAW,WAAW,EAAEZ,WAAxB;IAAqC,SAAS,EAAES,0BAAA,CAAOI;EAAvD,EAHF,CADF,CADF;AASD"}
@@ -1,20 +0,0 @@
1
- .testsPage {
2
- padding: 50px 40px 100px 40px;
3
- width: 100%;
4
- overflow-y: auto;
5
- max-width: 1440px;
6
- margin: 0 auto;
7
- box-sizing: border-box;
8
-
9
- .title {
10
- margin-bottom: 24px;
11
- font-size: var(--bit-h-xs, 26px);
12
- }
13
- .separator {
14
- margin-bottom: 41px;
15
- }
16
- }
17
-
18
- .testBlock {
19
- margin-bottom: 50px;
20
- }
@@ -1,20 +0,0 @@
1
- .testsPage {
2
- padding: 50px 40px 100px 40px;
3
- width: 100%;
4
- overflow-y: auto;
5
- max-width: 1440px;
6
- margin: 0 auto;
7
- box-sizing: border-box;
8
-
9
- .title {
10
- margin-bottom: 24px;
11
- font-size: var(--bit-h-xs, 26px);
12
- }
13
- .separator {
14
- margin-bottom: 41px;
15
- }
16
- }
17
-
18
- .testBlock {
19
- margin-bottom: 50px;
20
- }
package/ui/tests-page.tsx DELETED
@@ -1,142 +0,0 @@
1
- import { useQuery, useSubscription, gql } from '@apollo/client';
2
- import { ComponentContext } from '@teambit/component';
3
- import { useQuery as useRouterQuery } from '@teambit/ui-foundation.ui.react-router.use-query';
4
- import { H1 } from '@teambit/documenter.ui.heading';
5
- import { Separator } from '@teambit/design.ui.separator';
6
- import { EmptyBox } from '@teambit/design.ui.empty-box';
7
- import { MDXLayout } from '@teambit/mdx.ui.mdx-layout';
8
- import { AlertCard } from '@teambit/design.ui.alert-card';
9
- import { TestLoader } from '@teambit/defender.ui.test-loader';
10
- import classNames from 'classnames';
11
- import React, { HTMLAttributes, useContext } from 'react';
12
- import { TestTable } from '@teambit/defender.ui.test-table';
13
- import { EmptyStateSlot } from '../tester.ui.runtime';
14
- import styles from './tests-page.module.scss';
15
-
16
- const TESTS_SUBSCRIPTION_CHANGED = gql`
17
- subscription OnTestsChanged($id: String!) {
18
- testsChanged(id: $id) {
19
- testsResults {
20
- testFiles {
21
- file
22
- duration
23
- pass
24
- failed
25
- pending
26
- errorStr
27
- tests {
28
- ancestor
29
- duration
30
- status
31
- name
32
- error
33
- }
34
- }
35
- }
36
- }
37
- }
38
- `;
39
-
40
- const GET_COMPONENT = gql`
41
- query ($id: String!) {
42
- getHost {
43
- id # for GQL caching
44
- getTests(id: $id) {
45
- loading
46
- testsResults {
47
- testFiles {
48
- file
49
- duration
50
- pass
51
- failed
52
- pending
53
- errorStr
54
- tests {
55
- ancestor
56
- duration
57
- status
58
- name
59
- error
60
- }
61
- }
62
- }
63
- }
64
- }
65
- }
66
- `;
67
-
68
- type TestsPageProps = {
69
- emptyState: EmptyStateSlot;
70
- } & HTMLAttributes<HTMLDivElement>;
71
-
72
- export function TestsPage({ className, emptyState }: TestsPageProps) {
73
- const query = useRouterQuery();
74
-
75
- const component = useContext(ComponentContext);
76
-
77
- const queryHasVersion = query.get('version');
78
-
79
- const id = queryHasVersion ? component.id.toString() : component.id.toStringWithoutVersion();
80
-
81
- const onTestsChanged = useSubscription(TESTS_SUBSCRIPTION_CHANGED, {
82
- variables: { id },
83
- });
84
-
85
- const { data } = useQuery(GET_COMPONENT, {
86
- variables: { id },
87
- });
88
-
89
- const testData = onTestsChanged.data?.testsChanged || data?.getHost?.getTests;
90
- const testResults = testData?.testsResults?.testFiles;
91
-
92
- // TODO: change loading EmptyBox
93
- if (testData?.loading) return <TestLoader />;
94
-
95
- const env = component.environment?.id;
96
- const EmptyStateTemplate = emptyState.get(env || '');
97
-
98
- if (
99
- (testResults === null || testData?.testsResults === null) &&
100
- component.host === 'teambit.workspace/workspace' &&
101
- EmptyStateTemplate
102
- ) {
103
- return (
104
- <div className={classNames(styles.testsPage, className)}>
105
- <div>
106
- <H1 className={styles.title}>Tests</H1>
107
- <Separator isPresentational className={styles.separator} />
108
- <AlertCard
109
- level="info"
110
- title="There are no
111
- tests for this Component. Learn how to add tests:"
112
- >
113
- <MDXLayout>
114
- <EmptyStateTemplate />
115
- </MDXLayout>
116
- </AlertCard>
117
- </div>
118
- </div>
119
- );
120
- }
121
-
122
- // TODO: get the docs domain from the community aspect and pass it here as a prop
123
- if (testResults === null || testData?.testsResults === null) {
124
- return (
125
- <EmptyBox
126
- title="This component doesn’t have any tests."
127
- linkText="Learn how to add tests to your components"
128
- link={`https://bit.dev/docs/dev-services-overview/tester/tester-overview`}
129
- />
130
- );
131
- }
132
-
133
- return (
134
- <div className={classNames(styles.testsPage, className)}>
135
- <div>
136
- <H1 className={styles.title}>Tests</H1>
137
- <Separator isPresentational className={styles.separator} />
138
- <TestTable testResults={testResults} className={styles.testBlock} />
139
- </div>
140
- </div>
141
- );
142
- }