@teambit/tester 0.0.554 → 0.0.555

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tester.d.ts CHANGED
@@ -17,26 +17,90 @@ export declare type ComponentPatternsMap = ComponentMap<{
17
17
  relative: string;
18
18
  }[]>;
19
19
  export interface TesterContext extends ExecutionContext {
20
+ /**
21
+ * whether the tester run for release (during bit build/tag) or not (during bit test command).
22
+ */
20
23
  release: boolean;
24
+ /**
25
+ * list of components to test.
26
+ */
21
27
  components: Component[];
28
+ /**
29
+ * component workspace.
30
+ */
31
+ /**
32
+ * defines whether tester is expected to run in quiet mode.
33
+ */
22
34
  quiet?: boolean;
35
+ /**
36
+ * list of spec files to test.
37
+ */
23
38
  specFiles: SpecFiles;
39
+ /**
40
+ * rootPath of the component workspace or the capsule root dir (during build).
41
+ */
24
42
  rootPath: string;
43
+ /**
44
+ * determines whether tester is expected to run in debug mode.
45
+ */
25
46
  debug?: boolean;
47
+ /**
48
+ * is start from ui
49
+ */
26
50
  ui?: boolean;
51
+ /**
52
+ * determines whether to start the tester in watch mode.
53
+ */
27
54
  watch?: boolean;
55
+ /**
56
+ * whether the tester should show code coverage
57
+ */
28
58
  coverage?: boolean;
59
+ /**
60
+ * array of patterns to test.
61
+ */
29
62
  patterns: ComponentPatternsMap;
30
63
  }
64
+ /**
65
+ * tester interface allows extensions to implement a component tester into bit.
66
+ */
31
67
  export interface Tester {
68
+ /**
69
+ * display name of the tester.
70
+ */
32
71
  displayName?: string;
72
+ /**
73
+ * icon of the tester.
74
+ */
33
75
  icon?: string;
76
+ /**
77
+ * serialized config of the tester.
78
+ */
34
79
  displayConfig?(): string;
80
+ /**
81
+ * path to the config in the filesystem.
82
+ */
35
83
  configPath?: string;
84
+ /**
85
+ * id of the tester.
86
+ */
36
87
  id: string;
88
+ /**
89
+ * on test run complete. (applies only during watch)
90
+ * @param callback
91
+ */
37
92
  onTestRunComplete?(callback: CallbackFn): Promise<void>;
93
+ /**
94
+ * execute tests on all components in the given execution context.
95
+ */
38
96
  test(context: TesterContext): Promise<Tests>;
97
+ /**
98
+ * watch tests on all components
99
+ */
39
100
  watch?(context: TesterContext): Promise<Tests>;
101
+ /**
102
+ * return the tester version.
103
+ */
40
104
  version(): string;
41
105
  }
42
106
  export declare type CallbackFn = (testSuite: Tests) => void;
@@ -12,35 +12,97 @@ import { ComponentsResults, CallbackFn, Tests } from './tester';
12
12
  import { TesterService } from './tester.service';
13
13
  import { TesterTask } from './tester.task';
14
14
  export declare type TesterExtensionConfig = {
15
+ /**
16
+ * regex of the text environment.
17
+ */
15
18
  testRegex: string;
19
+ /**
20
+ * determine whether to watch on start.
21
+ */
16
22
  watchOnStart: boolean;
17
23
  patterns: string[];
18
24
  };
19
25
  export declare type TesterOptions = {
26
+ /**
27
+ * start the tester in watch mode.
28
+ */
20
29
  watch: boolean;
30
+ /**
31
+ * start the tester in debug mode.
32
+ */
21
33
  debug: boolean;
34
+ /**
35
+ * start the tester in debug mode.
36
+ */
22
37
  ui?: boolean;
38
+ /**
39
+ * initiate the tester on given env.
40
+ */
23
41
  env?: string;
42
+ /**
43
+ * generate JUnit files on the specified dir
44
+ */
24
45
  junit?: string;
46
+ /**
47
+ * show code coverage
48
+ */
25
49
  coverage?: boolean;
26
50
  callback?: CallbackFn;
27
51
  };
28
52
  export declare class TesterMain {
53
+ /**
54
+ * graphql extension.
55
+ */
29
56
  private graphql;
57
+ /**
58
+ * envs extension.
59
+ */
30
60
  private envs;
61
+ /**
62
+ * workspace extension.
63
+ */
31
64
  private workspace;
65
+ /**
66
+ * tester service.
67
+ */
32
68
  readonly service: TesterService;
69
+ /**
70
+ * build task.
71
+ */
33
72
  readonly task: TesterTask;
34
73
  private devFiles;
35
74
  private builder;
36
75
  static runtime: import("@teambit/harmony").RuntimeDefinition;
37
76
  static dependencies: import("@teambit/harmony").Aspect[];
38
- constructor(graphql: GraphqlMain, envs: EnvsMain, workspace: Workspace, service: TesterService, task: TesterTask, devFiles: DevFilesMain, builder: BuilderMain);
77
+ constructor(
78
+ /**
79
+ * graphql extension.
80
+ */
81
+ graphql: GraphqlMain,
82
+ /**
83
+ * envs extension.
84
+ */
85
+ envs: EnvsMain,
86
+ /**
87
+ * workspace extension.
88
+ */
89
+ workspace: Workspace,
90
+ /**
91
+ * tester service.
92
+ */
93
+ service: TesterService,
94
+ /**
95
+ * build task.
96
+ */
97
+ task: TesterTask, devFiles: DevFilesMain, builder: BuilderMain);
39
98
  _testsResults: {
40
99
  [componentId: string]: ComponentsResults;
41
100
  } | undefined[];
42
101
  test(components: Component[], opts?: TesterOptions): Promise<EnvsExecutionResult<Tests>>;
43
102
  private generateJUnit;
103
+ /**
104
+ * watch all components for changes and test upon each.
105
+ */
44
106
  watch(components: Component[], opts?: TesterOptions): Promise<EnvsExecutionResult<Tests>>;
45
107
  uiWatch(): Promise<EnvsExecutionResult<Tests>>;
46
108
  getTestsResults(component: Component): Promise<{
@@ -48,10 +110,19 @@ export declare class TesterMain {
48
110
  loading: boolean;
49
111
  } | undefined>;
50
112
  private getTestsResultsFromState;
113
+ /**
114
+ * get all test files of a component.
115
+ */
51
116
  getTestFiles(component: Component): import("@teambit/legacy/dist/consumer/component/sources").AbstractVinyl[];
52
117
  private getOptions;
53
118
  static defaultConfig: {
119
+ /**
120
+ * default test regex for which files tester to apply on.
121
+ */
54
122
  patterns: string[];
123
+ /**
124
+ * determine whether to watch on start.
125
+ */
55
126
  watchOnStart: boolean;
56
127
  };
57
128
  static provider([cli, envs, workspace, loggerAspect, graphql, ui, devFiles, builder]: [
@@ -7,20 +7,39 @@ import { Tests, CallbackFn } from './tester';
7
7
  import { TesterOptions } from './tester.main.runtime';
8
8
  export declare const OnTestsChanged = "OnTestsChanged";
9
9
  export declare type TesterDescriptor = {
10
+ /**
11
+ * id of the tester (e.g. jest/mocha)
12
+ */
10
13
  id: string;
14
+ /**
15
+ * display name of the tester (e.g. Jest / Mocha)
16
+ */
11
17
  displayName: string;
18
+ /**
19
+ * icon of the configured tester.
20
+ */
12
21
  icon: string;
22
+ /**
23
+ * string containing the config for display.
24
+ */
13
25
  config: string;
14
26
  version?: string;
15
27
  };
16
28
  export declare class TesterService implements EnvService<Tests, TesterDescriptor> {
17
29
  readonly workspace: Workspace;
30
+ /**
31
+ * regex used to identify which files to test.
32
+ */
18
33
  readonly patterns: string[];
19
34
  private logger;
20
35
  private pubsub;
21
36
  private devFiles;
22
37
  name: string;
23
- constructor(workspace: Workspace, patterns: string[], logger: Logger, pubsub: PubSub, devFiles: DevFilesMain);
38
+ constructor(workspace: Workspace,
39
+ /**
40
+ * regex used to identify which files to test.
41
+ */
42
+ patterns: string[], logger: Logger, pubsub: PubSub, devFiles: DevFilesMain);
24
43
  _callback: CallbackFn | undefined;
25
44
  render(env: EnvDefinition): JSX.Element;
26
45
  getDescriptor(environment: EnvDefinition): {
@@ -1,5 +1,8 @@
1
1
  import { BuildContext, BuiltTaskResult, BuildTask } from '@teambit/builder';
2
2
  import { DevFilesMain } from '@teambit/dev-files';
3
+ /**
4
+ * tester build task. Allows to test components during component build.
5
+ */
3
6
  export declare class TesterTask implements BuildTask {
4
7
  readonly aspectId: string;
5
8
  private devFiles;
@@ -9,6 +9,9 @@ export declare class TesterUI {
9
9
  static runtime: import("@teambit/harmony").RuntimeDefinition;
10
10
  stageKey?: string;
11
11
  constructor(component: ComponentUI, emptyStateSlot: EmptyStateSlot);
12
+ /**
13
+ * register a new tester empty state. this allows to register a different empty state from each environment for example.
14
+ */
12
15
  registerEmptyState(emptyStateComponent: ComponentType): this;
13
16
  static slots: ((registerFn: () => string) => SlotRegistry<ComponentType<{}>>)[];
14
17
  static provider([component]: [ComponentUI], config: any, [emptyStateSlot]: [EmptyStateSlot]): Promise<TesterUI>;
@@ -1,3 +1,6 @@
1
1
  import { Component } from '@teambit/component';
2
2
  import { DevFilesMain } from '@teambit/dev-files';
3
+ /**
4
+ * detect test files in components
5
+ */
3
6
  export declare function detectTestFiles(component: Component, devFiles: DevFilesMain): import("@teambit/legacy/dist/consumer/component/sources").AbstractVinyl[];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/tester",
3
- "version": "0.0.554",
3
+ "version": "0.0.555",
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.554"
9
+ "version": "0.0.555"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -24,24 +24,24 @@
24
24
  "@babel/runtime": "7.12.18",
25
25
  "core-js": "^3.0.0",
26
26
  "@teambit/documenter.ui.heading": "4.1.1",
27
- "@teambit/cli": "0.0.385",
28
- "@teambit/logger": "0.0.470",
29
- "@teambit/workspace": "0.0.554",
30
- "@teambit/component": "0.0.554",
31
- "@teambit/graphql": "0.0.554",
32
- "@teambit/builder": "0.0.554",
33
- "@teambit/dev-files": "0.0.554",
34
- "@teambit/envs": "0.0.554",
35
- "@teambit/tests-results": "0.0.71",
36
- "@teambit/ui": "0.0.554",
37
- "@teambit/compiler": "0.0.554",
38
- "@teambit/bit-error": "0.0.371",
39
- "@teambit/defender.ui.test-loader": "0.0.464",
40
- "@teambit/defender.ui.test-table": "0.0.467",
27
+ "@teambit/cli": "0.0.386",
28
+ "@teambit/logger": "0.0.471",
29
+ "@teambit/workspace": "0.0.555",
30
+ "@teambit/component": "0.0.555",
31
+ "@teambit/graphql": "0.0.555",
32
+ "@teambit/builder": "0.0.555",
33
+ "@teambit/dev-files": "0.0.555",
34
+ "@teambit/envs": "0.0.555",
35
+ "@teambit/tests-results": "0.0.72",
36
+ "@teambit/ui": "0.0.555",
37
+ "@teambit/compiler": "0.0.555",
38
+ "@teambit/bit-error": "0.0.372",
39
+ "@teambit/defender.ui.test-loader": "0.0.465",
40
+ "@teambit/defender.ui.test-table": "0.0.468",
41
41
  "@teambit/design.ui.alert-card": "0.0.13",
42
42
  "@teambit/design.ui.empty-box": "0.0.352",
43
43
  "@teambit/design.ui.separator": "0.0.351",
44
- "@teambit/mdx.ui.mdx-layout": "0.0.466"
44
+ "@teambit/mdx.ui.mdx-layout": "0.0.467"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/react": "^17.0.8",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@apollo/client": "^3.0.0",
60
- "@teambit/legacy": "1.0.171",
60
+ "@teambit/legacy": "1.0.172",
61
61
  "react-dom": "^16.8.0 || ^17.0.0",
62
62
  "react": "^16.8.0 || ^17.0.0"
63
63
  },
@@ -85,7 +85,7 @@
85
85
  "react": "-"
86
86
  },
87
87
  "peerDependencies": {
88
- "@teambit/legacy": "1.0.171",
88
+ "@teambit/legacy": "1.0.172",
89
89
  "react-dom": "^16.8.0 || ^17.0.0",
90
90
  "react": "^16.8.0 || ^17.0.0"
91
91
  }
package/tsconfig.json CHANGED
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },