@testomatio/reporter 2.3.7-beta.10-stack-artifacts β†’ 2.3.7-beta.100

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/README.md CHANGED
@@ -13,7 +13,7 @@ Testomat.io Reporter (this npm package) supports:
13
13
  - πŸ”Ž [Stack traces](./docs/stacktrace.md) and error messages
14
14
  - πŸ™ [GitHub](./docs/pipes/github.md), [GitLab](./docs/pipes/gitlab.md) & [Bitbucket](./docs/pipes/bitbucket.md) integration
15
15
  - πŸš… Realtime reports
16
- - πŸ—ƒοΈ Other test frameworks supported via [JUNit XML](./docs/junit.md)
16
+ - πŸ—ƒοΈ Other test frameworks supported via [JUnit XML](./docs/junit.md) with [XML import configuration](./docs/xml-imports.md)
17
17
  - πŸšΆβ€β™€οΈ Steps _(work in progress)_
18
18
  - πŸ“„ [Logger](./docs/logger.md) _(work in progress, supports Jest for now)_
19
19
  - ☁️ Custom properties and metadata _(work in progress)_
package/lib/bin/cli.js CHANGED
@@ -37,12 +37,17 @@ program
37
37
  program
38
38
  .command('start')
39
39
  .description('Start a new run and return its ID')
40
- .action(async () => {
40
+ .option('--kind <type>', 'Specify run type: automated, manual, or mixed')
41
+ .action(async (opts) => {
41
42
  (0, utils_js_1.cleanLatestRunId)();
42
43
  console.log('Starting a new Run on Testomat.io...');
43
44
  const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config_js_1.config.TESTOMATIO;
44
45
  const client = new client_js_1.default({ apiKey });
45
- client.createRun().then(() => {
46
+ const createRunParams = {};
47
+ if (opts.kind) {
48
+ createRunParams.kind = opts.kind;
49
+ }
50
+ client.createRun(createRunParams).then(() => {
46
51
  console.log(process.env.runId);
47
52
  process.exit(0);
48
53
  });
@@ -70,6 +75,7 @@ program
70
75
  .description('Run tests with the specified command')
71
76
  .argument('<command>', 'Test runner command')
72
77
  .option('--filter <filter>', 'Additional execution filter')
78
+ .option('--kind <type>', 'Specify run type: automated, manual, or mixed')
73
79
  .action(async (command, opts) => {
74
80
  const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config_js_1.config.TESTOMATIO;
75
81
  const title = process.env.TESTOMATIO_TITLE;
@@ -108,8 +114,12 @@ program
108
114
  process.exit(code);
109
115
  });
110
116
  };
117
+ const createRunParams = {};
118
+ if (opts.kind) {
119
+ createRunParams.kind = opts.kind;
120
+ }
111
121
  if (apiKey) {
112
- await client.createRun().then(runTests);
122
+ await client.createRun(createRunParams).then(runTests);
113
123
  }
114
124
  else {
115
125
  await runTests();
@@ -35,7 +35,7 @@ while (i < args.length) {
35
35
  newArgs[0] = 'start';
36
36
  }
37
37
  else if (arg === '--finish') {
38
- // Map --finish to finish command
38
+ // Map --finish to finish command
39
39
  newArgs[0] = 'finish';
40
40
  }
41
41
  else {
@@ -46,8 +46,8 @@ while (i < args.length) {
46
46
  }
47
47
  // Execute the main CLI with mapped arguments
48
48
  const child = (0, node_child_process_1.spawn)(process.execPath, [cliPath, ...newArgs], {
49
- stdio: 'inherit'
49
+ stdio: 'inherit',
50
50
  });
51
- child.on('exit', (code) => {
51
+ child.on('exit', code => {
52
52
  process.exit(code);
53
53
  });
package/lib/client.d.ts CHANGED
@@ -44,7 +44,7 @@ export class Client {
44
44
  *
45
45
  * @returns {Promise<any>} - resolves to Run id which should be used to update / add test
46
46
  */
47
- createRun(params: any): Promise<any>;
47
+ createRun(params?: {}): Promise<any>;
48
48
  /**
49
49
  * Updates test status and its data
50
50
  *
package/lib/client.js CHANGED
@@ -131,7 +131,7 @@ class Client {
131
131
  *
132
132
  * @returns {Promise<any>} - resolves to Run id which should be used to update / add test
133
133
  */
134
- async createRun(params) {
134
+ async createRun(params = {}) {
135
135
  if (!this.pipes || !this.pipes.length)
136
136
  this.pipes = await (0, index_js_1.pipesFactory)(params || this.paramsForPipesFactory || {}, this.pipeStore);
137
137
  debug('Creating run...');
@@ -139,7 +139,7 @@ class Client {
139
139
  if (!this.pipes?.filter(p => p.isEnabled).length)
140
140
  return Promise.resolve();
141
141
  this.queue = this.queue
142
- .then(() => Promise.all(this.pipes.map(p => p.createRun())))
142
+ .then(() => Promise.all(this.pipes.map(p => p.createRun(params))))
143
143
  .catch(err => console.log(constants_js_1.APP_PREFIX, err))
144
144
  .then(() => {
145
145
  const runId = this.pipeStore?.runId;
@@ -173,7 +173,7 @@ class Client {
173
173
  * @type {TestData}
174
174
  */
175
175
  const { rid, error = null, steps: originalSteps, title, suite_title, } = testData;
176
- const steps = originalSteps;
176
+ let steps = originalSteps;
177
177
  const uploadedFiles = [];
178
178
  const stackArtifactsEnabled = (0, utils_js_1.transformEnvVarToBoolean)(process.env.TESTOMATIO_STACK_ARTIFACTS);
179
179
  const { time = 0, example = null, files = [], filesBuffers = [], code = null, file, suite_id, test_id, timestamp, links, manuallyAttachedArtifacts, overwrite, tags, } = testData;
@@ -192,12 +192,10 @@ class Client {
192
192
  message = error?.message;
193
193
  }
194
194
  let fullLogs = this.formatLogs({ error: errorFormatted, steps, logs: testData.logs });
195
- if (stackArtifactsEnabled && status && (steps || testData.logs || error)) {
196
- const timestamp = +new Date;
197
- if (fullLogs && fullLogs.trim().length > 0) {
198
- uploadedFiles.push(this.uploader.uploadFileAsBuffer(Buffer.from(stripColors(fullLogs), 'utf8'), [this.runId, rid, `logs_${timestamp}.txt`]));
199
- }
195
+ if (stackArtifactsEnabled && fullLogs?.trim()?.length > 0) {
196
+ uploadedFiles.push(this.uploader.uploadFileAsBuffer(Buffer.from(stripColors(fullLogs), 'utf8'), [this.runId, rid, `logs_${+new Date}.log`]));
200
197
  fullLogs = '';
198
+ steps = null;
201
199
  }
202
200
  if (!this.pipes || !this.pipes.length)
203
201
  this.pipes = await (0, index_js_1.pipesFactory)(this.paramsForPipesFactory || {}, this.pipeStore);
@@ -47,11 +47,12 @@ declare class TestomatioPipe implements Pipe {
47
47
  prepareRun(opts: any): Promise<string[]>;
48
48
  /**
49
49
  * Creates a new run on Testomat.io
50
- * @param {{isBatchEnabled?: boolean}} params
50
+ * @param {{isBatchEnabled?: boolean, kind?: string}} params
51
51
  * @returns Promise<void>
52
52
  */
53
53
  createRun(params?: {
54
54
  isBatchEnabled?: boolean;
55
+ kind?: string;
55
56
  }): Promise<void>;
56
57
  runUrl: string;
57
58
  runPublicUrl: any;
@@ -148,7 +148,7 @@ class TestomatioPipe {
148
148
  }
149
149
  /**
150
150
  * Creates a new run on Testomat.io
151
- * @param {{isBatchEnabled?: boolean}} params
151
+ * @param {{isBatchEnabled?: boolean, kind?: string}} params
152
152
  * @returns Promise<void>
153
153
  */
154
154
  async createRun(params = {}) {
@@ -184,6 +184,7 @@ class TestomatioPipe {
184
184
  label: this.label,
185
185
  shared_run: this.sharedRun,
186
186
  shared_run_timeout: this.sharedRunTimeout,
187
+ kind: params.kind,
187
188
  }).filter(([, value]) => !!value));
188
189
  debug(' >>>>>> Run params', JSON.stringify(runParams, null, 2));
189
190
  if (this.runId) {
@@ -420,7 +421,7 @@ class TestomatioPipe {
420
421
  if (this.runUrl && this.proceed) {
421
422
  const notFinishedMessage = picocolors_1.default.yellow(picocolors_1.default.bold('Run was not finished because of $TESTOMATIO_PROCEED'));
422
423
  console.log(constants_js_1.APP_PREFIX, `πŸ“Š ${notFinishedMessage}. Report URL: ${picocolors_1.default.magenta(this.runUrl)}`);
423
- console.log(constants_js_1.APP_PREFIX, `πŸ›¬ Run to finish it: TESTOMATIO_RUN=${this.runId} npx start-test-run --finish`);
424
+ console.log(constants_js_1.APP_PREFIX, `πŸ›¬ Run to finish it: TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter finish`);
424
425
  }
425
426
  if (this.hasUnmatchedTests) {
426
427
  console.log('');