@testomatio/reporter 2.0.0-beta-esm → 2.0.0-beta.1-xml

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.
Files changed (123) hide show
  1. package/lib/adapter/codecept.d.ts +2 -0
  2. package/lib/adapter/codecept.js +31 -26
  3. package/lib/adapter/cucumber/current.d.ts +14 -0
  4. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  5. package/lib/adapter/cucumber.d.ts +2 -0
  6. package/lib/adapter/cypress-plugin/index.d.ts +2 -0
  7. package/lib/adapter/cypress-plugin/index.js +10 -10
  8. package/lib/adapter/jasmine.d.ts +11 -0
  9. package/lib/adapter/jest.d.ts +13 -0
  10. package/lib/adapter/mocha.d.ts +2 -0
  11. package/lib/adapter/mocha.js +4 -4
  12. package/lib/adapter/nightwatch.d.ts +4 -0
  13. package/lib/adapter/nightwatch.js +80 -0
  14. package/lib/adapter/playwright.d.ts +14 -0
  15. package/lib/adapter/playwright.js +58 -33
  16. package/lib/adapter/vitest.d.ts +35 -0
  17. package/lib/adapter/vitest.js +6 -6
  18. package/lib/adapter/webdriver.d.ts +24 -0
  19. package/lib/adapter/webdriver.js +51 -14
  20. package/lib/bin/cli.d.ts +2 -0
  21. package/lib/bin/cli.js +250 -0
  22. package/lib/bin/reportXml.d.ts +2 -0
  23. package/lib/bin/reportXml.js +15 -11
  24. package/lib/bin/startTest.d.ts +2 -0
  25. package/lib/bin/startTest.js +12 -7
  26. package/lib/bin/uploadArtifacts.d.ts +2 -0
  27. package/lib/bin/uploadArtifacts.js +82 -0
  28. package/lib/client.d.ts +76 -0
  29. package/lib/client.js +128 -53
  30. package/lib/config.d.ts +1 -0
  31. package/lib/config.js +2 -2
  32. package/lib/constants.d.ts +25 -0
  33. package/lib/constants.js +5 -1
  34. package/lib/data-storage.d.ts +34 -0
  35. package/lib/data-storage.js +19 -9
  36. package/lib/junit-adapter/adapter.d.ts +9 -0
  37. package/lib/junit-adapter/csharp.d.ts +5 -0
  38. package/lib/junit-adapter/csharp.js +11 -1
  39. package/lib/junit-adapter/index.d.ts +3 -0
  40. package/lib/junit-adapter/java.d.ts +5 -0
  41. package/lib/junit-adapter/javascript.d.ts +4 -0
  42. package/lib/junit-adapter/python.d.ts +5 -0
  43. package/lib/junit-adapter/ruby.d.ts +4 -0
  44. package/lib/output.d.ts +11 -0
  45. package/lib/package.json +3 -1
  46. package/lib/pipe/bitbucket.d.ts +23 -0
  47. package/lib/pipe/bitbucket.js +19 -9
  48. package/lib/pipe/csv.d.ts +47 -0
  49. package/lib/pipe/csv.js +2 -2
  50. package/lib/pipe/debug.d.ts +29 -0
  51. package/lib/pipe/debug.js +108 -0
  52. package/lib/pipe/github.d.ts +30 -0
  53. package/lib/pipe/github.js +37 -5
  54. package/lib/pipe/gitlab.d.ts +23 -0
  55. package/lib/pipe/gitlab.js +2 -3
  56. package/lib/pipe/html.d.ts +35 -0
  57. package/lib/pipe/html.js +9 -4
  58. package/lib/pipe/index.d.ts +1 -0
  59. package/lib/pipe/index.js +20 -10
  60. package/lib/pipe/testomatio.d.ts +70 -0
  61. package/lib/pipe/testomatio.js +54 -39
  62. package/lib/reporter-functions.d.ts +34 -0
  63. package/lib/reporter-functions.js +17 -7
  64. package/lib/reporter.d.ts +232 -0
  65. package/lib/reporter.js +19 -33
  66. package/lib/services/artifacts.d.ts +33 -0
  67. package/lib/services/index.d.ts +9 -0
  68. package/lib/services/key-values.d.ts +27 -0
  69. package/lib/services/key-values.js +1 -1
  70. package/lib/services/logger.d.ts +64 -0
  71. package/lib/services/logger.js +1 -2
  72. package/lib/template/testomatio.hbs +651 -1366
  73. package/lib/uploader.d.ts +60 -0
  74. package/lib/uploader.js +312 -0
  75. package/lib/utils/pipe_utils.d.ts +41 -0
  76. package/lib/utils/pipe_utils.js +3 -5
  77. package/lib/utils/utils.d.ts +47 -0
  78. package/lib/utils/utils.js +99 -12
  79. package/lib/xmlReader.d.ts +92 -0
  80. package/lib/xmlReader.js +64 -25
  81. package/package.json +19 -13
  82. package/src/adapter/codecept.js +30 -26
  83. package/src/adapter/cypress-plugin/index.js +5 -5
  84. package/src/adapter/mocha.cjs +1 -1
  85. package/src/adapter/mocha.js +4 -4
  86. package/src/adapter/nightwatch.js +88 -0
  87. package/src/adapter/playwright.js +59 -31
  88. package/src/adapter/vitest.js +6 -6
  89. package/src/adapter/webdriver.js +42 -12
  90. package/src/bin/cli.js +303 -0
  91. package/src/bin/reportXml.js +19 -9
  92. package/src/bin/startTest.js +9 -4
  93. package/src/bin/uploadArtifacts.js +91 -0
  94. package/src/client.js +137 -57
  95. package/src/config.js +2 -2
  96. package/src/constants.js +5 -1
  97. package/src/data-storage.js +2 -2
  98. package/src/junit-adapter/csharp.js +13 -1
  99. package/src/pipe/bitbucket.js +2 -2
  100. package/src/pipe/csv.js +3 -3
  101. package/src/pipe/debug.js +104 -0
  102. package/src/pipe/github.js +3 -5
  103. package/src/pipe/gitlab.js +6 -7
  104. package/src/pipe/html.js +14 -7
  105. package/src/pipe/index.js +5 -7
  106. package/src/pipe/testomatio.js +75 -76
  107. package/src/reporter-functions.js +18 -7
  108. package/src/reporter.cjs_decprecated +21 -0
  109. package/src/reporter.js +20 -11
  110. package/src/services/key-values.js +1 -1
  111. package/src/services/logger.js +5 -4
  112. package/src/template/testomatio.hbs +651 -1366
  113. package/src/uploader.js +371 -0
  114. package/src/utils/pipe_utils.js +4 -12
  115. package/src/utils/utils.js +64 -15
  116. package/src/xmlReader.js +76 -26
  117. package/lib/adapter/jasmine/jasmine.js +0 -63
  118. package/lib/adapter/mocha/mocha.js +0 -125
  119. package/lib/fileUploader.js +0 -245
  120. package/lib/utils/chalk.js +0 -10
  121. package/src/fileUploader.js +0 -307
  122. package/src/reporter.cjs +0 -22
  123. package/src/utils/chalk.js +0 -13
@@ -0,0 +1,27 @@
1
+ export const keyValueStorage: KeyValueStorage;
2
+ declare class KeyValueStorage {
3
+ static "__#14@#instance": any;
4
+ /**
5
+ *
6
+ * @returns {KeyValueStorage}
7
+ */
8
+ static getInstance(): KeyValueStorage;
9
+ /**
10
+ * Stores key-value pair and passes it to reporter
11
+ * @param {{[key: string]: string}} keyValue - key-value pair(s) as object
12
+ * @param {*} context - full test title
13
+ */
14
+ put(keyValue: {
15
+ [key: string]: string;
16
+ }, context?: any): void;
17
+ /**
18
+ * Returns key-values pairs for the test as object
19
+ * @param {*} context testId or test context from test runner
20
+ * @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
21
+ */
22
+ get(context?: any): {
23
+ [key: string]: string;
24
+ } | {};
25
+ #private;
26
+ }
27
+ export {};
@@ -21,7 +21,7 @@ class KeyValueStorage {
21
21
  }
22
22
  /**
23
23
  * Stores key-value pair and passes it to reporter
24
- * @param {{key: string}} keyValue - key-value pair(s) as object
24
+ * @param {{[key: string]: string}} keyValue - key-value pair(s) as object
25
25
  * @param {*} context - full test title
26
26
  */
27
27
  put(keyValue, context = null) {
@@ -0,0 +1,64 @@
1
+ export const logger: Logger;
2
+ /**
3
+ * Logger allows to intercept logs from any logger (console.log, tracer, pino, etc)
4
+ * and save in the testomatio reporter.
5
+ * Supports different syntaxes to satisfy any user preferences.
6
+ */
7
+ declare class Logger {
8
+ static "__#12@#instance": any;
9
+ /**
10
+ *
11
+ * @returns {Logger}
12
+ */
13
+ static getInstance(): Logger;
14
+ logLevel: string;
15
+ /**
16
+ * Allows you to define a step inside a test. Step name is attached to the report and
17
+ * helps to understand the test flow.
18
+ * @param {*} strings
19
+ * @param {...any} values
20
+ */
21
+ step(strings: any, ...values: any[]): void;
22
+ /**
23
+ *
24
+ * @param {string} context testId or test context from test runner
25
+ * @returns {string[]}
26
+ */
27
+ getLogs(context: string): string[];
28
+ /**
29
+ * Tagget template literal. Allows to use different syntaxes:
30
+ * 1. Tagget template: log`text ${someVar}`
31
+ * 2. Standard: log(`text ${someVar}`)
32
+ * 3. Standard with multiple arguments: log('text', someVar)
33
+ */
34
+ _templateLiteralLog(strings: any, ...args: any[]): void;
35
+ assert(...args: any[]): void;
36
+ debug(...args: any[]): void;
37
+ error(...args: any[]): void;
38
+ info(...args: any[]): void;
39
+ log(...args: any[]): void;
40
+ trace(...args: any[]): void;
41
+ warn(...args: any[]): void;
42
+ /**
43
+ * Intercepts user logger messages.
44
+ * When call this method, Logger start to control the user logger
45
+ * @param {*} userLogger
46
+ */
47
+ intercept(userLogger: any): void;
48
+ stopInterception(): void;
49
+ /**
50
+ * Allows to configure logger. Make sure you do it before the logger usage in your code.
51
+ *
52
+ * @param {Object} [config={}] - The configuration object.
53
+ * @param {string} [config.logLevel] - The desired log level. Valid values are 'DEBUG', 'INFO', 'WARN', and 'ERROR'.
54
+ * @param {boolean} [config.prettyObjects] - Specifies whether to enable pretty printing of objects.
55
+ * @returns {void}
56
+ */
57
+ configure(config?: {
58
+ logLevel?: string;
59
+ prettyObjects?: boolean;
60
+ }): void;
61
+ prettyObjects: boolean;
62
+ #private;
63
+ }
64
+ export {};
@@ -90,7 +90,6 @@ class Logger {
90
90
  }
91
91
  else {
92
92
  try {
93
- // eslint-disable-next-line no-unused-expressions
94
93
  this.prettyObjects ? logs.push(JSON.stringify(arg, null, 2)) : logs.push(JSON.stringify(arg));
95
94
  }
96
95
  catch (e) {
@@ -119,7 +118,7 @@ class Logger {
119
118
  current +
120
119
  // strings are splitted by args when use tagged template, thus we add arg after each string
121
120
  // it looks like: `string1 arg1 string2 arg2 string3`
122
- (args[index] !== undefined // eslint-disable-line no-nested-ternary
121
+ (args[index] !== undefined
123
122
  ? typeof args[index] === 'string'
124
123
  ? args[index] // add arg as it is
125
124
  : this.#stringifyLogs(args[index]) // stringify arg