@testomatio/reporter 2.1.0-beta.3-filter-plan → 2.1.0-beta.5-codeceptjs

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.
@@ -50,17 +50,18 @@ function CodeceptReporter(config) {
50
50
  };
51
51
  output.debug = function (msg) {
52
52
  originalOutput.debug(msg);
53
- data_storage_js_1.dataStorage.putData('log', repeat(this.stepShift) + picocolors_1.default.cyan(msg.toString()));
53
+ data_storage_js_1.dataStorage.putData('log', repeat(this?.stepShift || 0) + picocolors_1.default.cyan(msg.toString()));
54
54
  };
55
55
  output.say = function (message, color = 'cyan') {
56
56
  originalOutput.say(message, color);
57
- const sayMsg = repeat(this.stepShift) + ` ${picocolors_1.default.bold(picocolors_1.default[color](message))}`;
57
+ const sayMsg = repeat(this?.stepShift || 0) + ` ${picocolors_1.default.bold(picocolors_1.default[color](message))}`;
58
58
  data_storage_js_1.dataStorage.putData('log', sayMsg);
59
59
  };
60
60
  output.log = function (msg) {
61
61
  originalOutput.log(msg);
62
- data_storage_js_1.dataStorage.putData('log', repeat(this.stepShift) + picocolors_1.default.gray(msg));
62
+ data_storage_js_1.dataStorage.putData('log', repeat(this?.stepShift || 0) + picocolors_1.default.gray(msg));
63
63
  };
64
+ output.stepShift = 0;
64
65
  recorder.startUnlessRunning();
65
66
  const hookSteps = new Map();
66
67
  let currentHook = null;
@@ -113,8 +113,7 @@ class TestomatioPipe {
113
113
  const resp = await this.client.request({
114
114
  method: 'GET',
115
115
  url: '/api/test_grep',
116
- params: q.params,
117
- responseType: q.responseType
116
+ ...q,
118
117
  });
119
118
  if (Array.isArray(resp.data?.tests) && resp.data?.tests?.length > 0) {
120
119
  (0, utils_js_1.foundedTestLog)(constants_js_1.APP_PREFIX, resp.data.tests);
@@ -9,6 +9,8 @@ export default _default;
9
9
  /**
10
10
  * Stores path to file as artifact and uploads it to the S3 storage
11
11
  * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
12
+ * @param {any} [context=null] - optional context parameter
13
+ * @returns {void}
12
14
  */
13
15
  declare function saveArtifact(data: string | {
14
16
  path: string;
@@ -17,18 +19,21 @@ declare function saveArtifact(data: string | {
17
19
  }, context?: any): void;
18
20
  /**
19
21
  * Attach log message(s) to the test report
20
- * @param string
22
+ * @param {...any} args - log messages to attach
23
+ * @returns {void}
21
24
  */
22
25
  declare function logMessage(...args: any[]): void;
23
26
  /**
24
27
  * Similar to "log" function but marks message in report as a step
25
- * @param {string} message
28
+ * @param {string} message - step message
29
+ * @returns {void}
26
30
  */
27
31
  declare function addStep(message: string): void;
28
32
  /**
29
33
  * Add key-value pair(s) to the test report
30
- * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
31
- * @param {string?} value
34
+ * @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) or key (string)
35
+ * @param {string|null} [value=null] - optional value when keyValue is a string
36
+ * @returns {void}
32
37
  */
33
38
  declare function setKeyValue(keyValue: {
34
39
  [key: string]: string;
@@ -36,6 +41,7 @@ declare function setKeyValue(keyValue: {
36
41
  /**
37
42
  * Add a single label to the test report
38
43
  * @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
39
- * @param {string} [value] - optional label value (e.g. 'high', 'login')
44
+ * @param {string|null} [value=null] - optional label value (e.g. 'high', 'login')
45
+ * @returns {void}
40
46
  */
41
- declare function setLabel(key: string, value?: string): void;
47
+ declare function setLabel(key: string, value?: string | null): void;
@@ -4,6 +4,8 @@ const index_js_1 = require("./services/index.js");
4
4
  /**
5
5
  * Stores path to file as artifact and uploads it to the S3 storage
6
6
  * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
7
+ * @param {any} [context=null] - optional context parameter
8
+ * @returns {void}
7
9
  */
8
10
  function saveArtifact(data, context = null) {
9
11
  if (process.env.IS_PLAYWRIGHT)
@@ -15,7 +17,8 @@ function saveArtifact(data, context = null) {
15
17
  }
16
18
  /**
17
19
  * Attach log message(s) to the test report
18
- * @param string
20
+ * @param {...any} args - log messages to attach
21
+ * @returns {void}
19
22
  */
20
23
  function logMessage(...args) {
21
24
  if (process.env.IS_PLAYWRIGHT)
@@ -24,7 +27,8 @@ function logMessage(...args) {
24
27
  }
25
28
  /**
26
29
  * Similar to "log" function but marks message in report as a step
27
- * @param {string} message
30
+ * @param {string} message - step message
31
+ * @returns {void}
28
32
  */
29
33
  function addStep(message) {
30
34
  if (process.env.IS_PLAYWRIGHT)
@@ -33,8 +37,9 @@ function addStep(message) {
33
37
  }
34
38
  /**
35
39
  * Add key-value pair(s) to the test report
36
- * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
37
- * @param {string?} value
40
+ * @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) or key (string)
41
+ * @param {string|null} [value=null] - optional value when keyValue is a string
42
+ * @returns {void}
38
43
  */
39
44
  function setKeyValue(keyValue, value = null) {
40
45
  if (process.env.IS_PLAYWRIGHT)
@@ -47,7 +52,8 @@ function setKeyValue(keyValue, value = null) {
47
52
  /**
48
53
  * Add a single label to the test report
49
54
  * @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
50
- * @param {string} [value] - optional label value (e.g. 'high', 'login')
55
+ * @param {string|null} [value=null] - optional label value (e.g. 'high', 'login')
56
+ * @returns {void}
51
57
  */
52
58
  function setLabel(key, value = null) {
53
59
  if (!key || typeof key !== 'string') {
package/lib/reporter.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- export type artifact = typeof import("./reporter-functions.js");
2
1
  export const artifact: (data: string | {
3
2
  path: string;
4
3
  type: string;
5
4
  name: string;
6
5
  }, context?: any) => void;
7
- export type log = typeof import("./reporter-functions.js");
8
6
  export const log: (...args: any[]) => void;
9
- export type logger = typeof import("./services/index.js");
10
7
  export const logger: {
11
8
  "__#13@#originalUserLogger": {
12
9
  assert(condition?: boolean, ...data: any[]): void;
@@ -75,14 +72,11 @@ export const logger: {
75
72
  }): void;
76
73
  prettyObjects: boolean;
77
74
  };
78
- export type meta = typeof import("./reporter-functions.js");
79
75
  export const meta: (keyValue: {
80
76
  [key: string]: string;
81
77
  } | string, value?: string | null) => void;
82
- export type step = typeof import("./reporter-functions.js");
83
78
  export const step: (message: string) => void;
84
- export type label = typeof import("./reporter-functions.js");
85
- export const label: (key: string, value?: string) => void;
79
+ export const label: (key: string, value?: string | null) => void;
86
80
  declare namespace _default {
87
81
  let testomatioLogger: {
88
82
  "__#13@#originalUserLogger": {
@@ -230,6 +224,12 @@ declare namespace _default {
230
224
  [key: string]: string;
231
225
  } | string, value?: string | null) => void;
232
226
  let step: (message: string) => void;
233
- let label: (key: string, value?: string) => void;
227
+ let label: (key: string, value?: string | null) => void;
234
228
  }
235
229
  export default _default;
230
+ export type ArtifactFunction = typeof import("./reporter-functions.js").default.artifact;
231
+ export type LogFunction = typeof import("./reporter-functions.js").default.log;
232
+ export type LoggerService = typeof import("./services/index.js").services.logger;
233
+ export type MetaFunction = typeof import("./reporter-functions.js").default.keyValue;
234
+ export type StepFunction = typeof import("./reporter-functions.js").default.step;
235
+ export type LabelFunction = typeof import("./reporter-functions.js").default.label;
package/lib/reporter.js CHANGED
@@ -15,12 +15,12 @@ exports.meta = reporter_functions_js_1.default.keyValue;
15
15
  exports.step = reporter_functions_js_1.default.step;
16
16
  exports.label = reporter_functions_js_1.default.label;
17
17
  /**
18
- * @typedef {import('./reporter-functions.js')} artifact
19
- * @typedef {import('./reporter-functions.js')} log
20
- * @typedef {import('./services/index.js')} logger
21
- * @typedef {import('./reporter-functions.js')} meta
22
- * @typedef {import('./reporter-functions.js')} step
23
- * @typedef {import('./reporter-functions.js')} label
18
+ * @typedef {typeof import('./reporter-functions.js').default.artifact} ArtifactFunction
19
+ * @typedef {typeof import('./reporter-functions.js').default.log} LogFunction
20
+ * @typedef {typeof import('./services/index.js').services.logger} LoggerService
21
+ * @typedef {typeof import('./reporter-functions.js').default.keyValue} MetaFunction
22
+ * @typedef {typeof import('./reporter-functions.js').default.step} StepFunction
23
+ * @typedef {typeof import('./reporter-functions.js').default.label} LabelFunction
24
24
  */
25
25
  module.exports = {
26
26
  /**
@@ -74,8 +74,11 @@ function parseFilterParams(opts) {
74
74
  * Returns undefined if the type is not valid.
75
75
  */
76
76
  function updateFilterType(type) {
77
- const typeLowerCase = type.toLowerCase();
78
- const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
77
+ let typeLowerCase = type.toLowerCase();
78
+ const filterTypes = ['tag-name', 'plan', 'label', 'jira-ticket'];
79
+ if (typeLowerCase === 'plan-id') {
80
+ typeLowerCase = 'plan';
81
+ }
79
82
  const filterApi = [
80
83
  'tag',
81
84
  'plan',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.1.0-beta.3-filter-plan",
3
+ "version": "2.1.0-beta.5-codeceptjs",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -56,19 +56,20 @@ function CodeceptReporter(config) {
56
56
 
57
57
  output.debug = function(msg) {
58
58
  originalOutput.debug(msg);
59
- dataStorage.putData('log', repeat(this.stepShift) + pc.cyan(msg.toString()));
59
+ dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.cyan(msg.toString()));
60
60
  };
61
61
 
62
62
  output.say = function(message, color = 'cyan') {
63
63
  originalOutput.say(message, color);
64
- const sayMsg = repeat(this.stepShift) + ` ${pc.bold(pc[color](message))}`;
64
+ const sayMsg = repeat(this?.stepShift || 0) + ` ${pc.bold(pc[color](message))}`;
65
65
  dataStorage.putData('log', sayMsg);
66
66
  };
67
67
 
68
68
  output.log = function(msg) {
69
69
  originalOutput.log(msg);
70
- dataStorage.putData('log', repeat(this.stepShift) + pc.gray(msg));
70
+ dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.gray(msg));
71
71
  };
72
+ output.stepShift = 0;
72
73
 
73
74
  recorder.startUnlessRunning();
74
75
 
package/src/bin/cli.js CHANGED
File without changes
File without changes
@@ -119,7 +119,7 @@ class TestomatioPipe {
119
119
  const resp = await this.client.request({
120
120
  method: 'GET',
121
121
  url: '/api/test_grep',
122
- params: q
122
+ ...q,
123
123
  });
124
124
 
125
125
  if (Array.isArray(resp.data?.tests) && resp.data?.tests?.length > 0) {
@@ -3,6 +3,8 @@ import { services } from './services/index.js';
3
3
  /**
4
4
  * Stores path to file as artifact and uploads it to the S3 storage
5
5
  * @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
6
+ * @param {any} [context=null] - optional context parameter
7
+ * @returns {void}
6
8
  */
7
9
  function saveArtifact(data, context = null) {
8
10
  if (process.env.IS_PLAYWRIGHT)
@@ -14,7 +16,8 @@ function saveArtifact(data, context = null) {
14
16
 
15
17
  /**
16
18
  * Attach log message(s) to the test report
17
- * @param string
19
+ * @param {...any} args - log messages to attach
20
+ * @returns {void}
18
21
  */
19
22
  function logMessage(...args) {
20
23
  if (process.env.IS_PLAYWRIGHT) throw new Error('This function is not available in Playwright framework');
@@ -23,7 +26,8 @@ function logMessage(...args) {
23
26
 
24
27
  /**
25
28
  * Similar to "log" function but marks message in report as a step
26
- * @param {string} message
29
+ * @param {string} message - step message
30
+ * @returns {void}
27
31
  */
28
32
  function addStep(message) {
29
33
  if (process.env.IS_PLAYWRIGHT)
@@ -34,8 +38,9 @@ function addStep(message) {
34
38
 
35
39
  /**
36
40
  * Add key-value pair(s) to the test report
37
- * @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
38
- * @param {string?} value
41
+ * @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) or key (string)
42
+ * @param {string|null} [value=null] - optional value when keyValue is a string
43
+ * @returns {void}
39
44
  */
40
45
  function setKeyValue(keyValue, value = null) {
41
46
  if (process.env.IS_PLAYWRIGHT)
@@ -50,7 +55,8 @@ function setKeyValue(keyValue, value = null) {
50
55
  /**
51
56
  * Add a single label to the test report
52
57
  * @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
53
- * @param {string} [value] - optional label value (e.g. 'high', 'login')
58
+ * @param {string|null} [value=null] - optional label value (e.g. 'high', 'login')
59
+ * @returns {void}
54
60
  */
55
61
  function setLabel(key, value = null) {
56
62
  if (!key || typeof key !== 'string') {
package/src/reporter.js CHANGED
@@ -11,12 +11,12 @@ export const step = reporterFunctions.step;
11
11
  export const label = reporterFunctions.label;
12
12
 
13
13
  /**
14
- * @typedef {import('./reporter-functions.js')} artifact
15
- * @typedef {import('./reporter-functions.js')} log
16
- * @typedef {import('./services/index.js')} logger
17
- * @typedef {import('./reporter-functions.js')} meta
18
- * @typedef {import('./reporter-functions.js')} step
19
- * @typedef {import('./reporter-functions.js')} label
14
+ * @typedef {typeof import('./reporter-functions.js').default.artifact} ArtifactFunction
15
+ * @typedef {typeof import('./reporter-functions.js').default.log} LogFunction
16
+ * @typedef {typeof import('./services/index.js').services.logger} LoggerService
17
+ * @typedef {typeof import('./reporter-functions.js').default.keyValue} MetaFunction
18
+ * @typedef {typeof import('./reporter-functions.js').default.step} StepFunction
19
+ * @typedef {typeof import('./reporter-functions.js').default.label} LabelFunction
20
20
  */
21
21
  export default {
22
22
  /**
@@ -69,9 +69,13 @@ function parseFilterParams(opts) {
69
69
  * Returns undefined if the type is not valid.
70
70
  */
71
71
  function updateFilterType(type) {
72
- const typeLowerCase = type.toLowerCase();
72
+ let typeLowerCase = type.toLowerCase();
73
73
 
74
- const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
74
+ const filterTypes = ['tag-name', 'plan', 'label', 'jira-ticket'];
75
+
76
+ if (typeLowerCase === 'plan-id') {
77
+ typeLowerCase = 'plan';
78
+ }
75
79
 
76
80
  const filterApi = [
77
81
  'tag',
@@ -1,21 +0,0 @@
1
- // const _reporter = require('../lib/reporter.js');
2
-
3
-
4
- // /**
5
- // * @typedef {import('../lib/reporter-functions.js').saveArtifact} artifact
6
- // * @typedef {import('../lib/reporter-functions.js').log} log
7
- // * @typedef {import('../lib/reporter-functions.js').logger} logger
8
- // * @typedef {import('../lib/reporter-functions.js')} meta
9
- // * @typedef {import('../lib/reporter-functions.js')} step
10
- // *
11
- // * "Reporter" type which is object containing all types from the above
12
- // * @typedef {{artifact: artifact, log: log, logger: logger, meta: meta, step: step, }} Reporter
13
- // */
14
-
15
- // // const reporter = _reporter;
16
-
17
- // /**
18
- // * @type {Reporter}
19
- // */
20
- // const reporter = _reporter;
21
- // module.exports = reporter;