@testomatio/reporter 2.0.1-beta.5-timestamp → 2.0.1-beta.6

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 (149) hide show
  1. package/README.md +1 -0
  2. package/lib/adapter/codecept.d.ts +2 -0
  3. package/lib/adapter/codecept.js +293 -335
  4. package/lib/adapter/cucumber/current.d.ts +14 -0
  5. package/lib/adapter/cucumber/current.js +195 -203
  6. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  7. package/lib/adapter/cucumber/legacy.js +130 -155
  8. package/lib/adapter/cucumber.d.ts +2 -0
  9. package/lib/adapter/cucumber.js +5 -16
  10. package/lib/adapter/cypress-plugin/index.d.ts +2 -0
  11. package/lib/adapter/cypress-plugin/index.js +91 -105
  12. package/lib/adapter/jasmine.d.ts +11 -0
  13. package/lib/adapter/jasmine.js +54 -53
  14. package/lib/adapter/jest.d.ts +13 -0
  15. package/lib/adapter/jest.js +97 -99
  16. package/lib/adapter/mocha.d.ts +2 -0
  17. package/lib/adapter/mocha.js +112 -141
  18. package/lib/adapter/nightwatch.d.ts +4 -0
  19. package/lib/adapter/nightwatch.js +80 -0
  20. package/lib/adapter/playwright.d.ts +14 -0
  21. package/lib/adapter/playwright.js +199 -231
  22. package/lib/adapter/vitest.d.ts +35 -0
  23. package/lib/adapter/vitest.js +150 -149
  24. package/lib/adapter/webdriver.d.ts +24 -0
  25. package/lib/adapter/webdriver.js +144 -121
  26. package/lib/bin/cli.d.ts +2 -0
  27. package/lib/bin/cli.js +229 -211
  28. package/lib/bin/reportXml.d.ts +2 -0
  29. package/lib/bin/reportXml.js +51 -52
  30. package/lib/bin/startTest.d.ts +2 -0
  31. package/lib/bin/startTest.js +83 -95
  32. package/lib/bin/uploadArtifacts.d.ts +2 -0
  33. package/lib/bin/uploadArtifacts.js +56 -61
  34. package/lib/client.d.ts +76 -0
  35. package/lib/client.js +429 -465
  36. package/lib/config.d.ts +1 -0
  37. package/lib/config.js +18 -23
  38. package/lib/constants.d.ts +25 -0
  39. package/lib/constants.js +50 -44
  40. package/lib/data-storage.d.ts +34 -0
  41. package/lib/data-storage.js +216 -188
  42. package/lib/junit-adapter/adapter.d.ts +9 -0
  43. package/lib/junit-adapter/adapter.js +17 -20
  44. package/lib/junit-adapter/csharp.d.ts +5 -0
  45. package/lib/junit-adapter/csharp.js +28 -14
  46. package/lib/junit-adapter/index.d.ts +3 -0
  47. package/lib/junit-adapter/index.js +27 -25
  48. package/lib/junit-adapter/java.d.ts +5 -0
  49. package/lib/junit-adapter/java.js +41 -53
  50. package/lib/junit-adapter/javascript.d.ts +4 -0
  51. package/lib/junit-adapter/javascript.js +30 -27
  52. package/lib/junit-adapter/python.d.ts +5 -0
  53. package/lib/junit-adapter/python.js +38 -37
  54. package/lib/junit-adapter/ruby.d.ts +4 -0
  55. package/lib/junit-adapter/ruby.js +11 -8
  56. package/lib/output.d.ts +11 -0
  57. package/lib/output.js +44 -52
  58. package/lib/package.json +3 -0
  59. package/lib/pipe/bitbucket.d.ts +25 -0
  60. package/lib/pipe/bitbucket.js +223 -230
  61. package/lib/pipe/csv.d.ts +47 -0
  62. package/lib/pipe/csv.js +113 -126
  63. package/lib/pipe/debug.d.ts +29 -0
  64. package/lib/pipe/debug.js +125 -99
  65. package/lib/pipe/github.d.ts +30 -0
  66. package/lib/pipe/github.js +218 -213
  67. package/lib/pipe/gitlab.d.ts +25 -0
  68. package/lib/pipe/gitlab.js +183 -206
  69. package/lib/pipe/html.d.ts +35 -0
  70. package/lib/pipe/html.js +258 -321
  71. package/lib/pipe/index.d.ts +1 -0
  72. package/lib/pipe/index.js +94 -66
  73. package/lib/pipe/testomatio.d.ts +71 -0
  74. package/lib/pipe/testomatio.js +429 -474
  75. package/lib/replay.d.ts +31 -0
  76. package/lib/replay.js +255 -0
  77. package/lib/reporter-functions.d.ts +34 -0
  78. package/lib/reporter-functions.js +28 -26
  79. package/lib/reporter.d.ts +232 -0
  80. package/lib/reporter.js +34 -29
  81. package/lib/services/artifacts.d.ts +33 -0
  82. package/lib/services/artifacts.js +55 -51
  83. package/lib/services/index.d.ts +9 -0
  84. package/lib/services/index.js +14 -12
  85. package/lib/services/key-values.d.ts +27 -0
  86. package/lib/services/key-values.js +56 -53
  87. package/lib/services/logger.d.ts +64 -0
  88. package/lib/services/logger.js +226 -245
  89. package/lib/template/testomatio.hbs +1026 -1366
  90. package/lib/uploader.d.ts +60 -0
  91. package/lib/uploader.js +295 -364
  92. package/lib/utils/pipe_utils.d.ts +41 -0
  93. package/lib/utils/pipe_utils.js +89 -85
  94. package/lib/utils/utils.d.ts +54 -0
  95. package/lib/utils/utils.js +398 -307
  96. package/lib/xmlReader.d.ts +92 -0
  97. package/lib/xmlReader.js +525 -532
  98. package/package.json +64 -21
  99. package/src/adapter/codecept.js +373 -0
  100. package/src/adapter/cucumber/current.js +228 -0
  101. package/src/adapter/cucumber/legacy.js +158 -0
  102. package/src/adapter/cucumber.js +4 -0
  103. package/src/adapter/cypress-plugin/index.js +110 -0
  104. package/src/adapter/jasmine.js +60 -0
  105. package/src/adapter/jest.js +107 -0
  106. package/src/adapter/mocha.cjs +2 -0
  107. package/src/adapter/mocha.js +156 -0
  108. package/src/adapter/nightwatch.js +88 -0
  109. package/src/adapter/playwright.js +254 -0
  110. package/src/adapter/vitest.js +183 -0
  111. package/src/adapter/webdriver.js +142 -0
  112. package/src/bin/cli.js +348 -0
  113. package/src/bin/reportXml.js +77 -0
  114. package/src/bin/startTest.js +124 -0
  115. package/src/bin/uploadArtifacts.js +91 -0
  116. package/src/client.js +515 -0
  117. package/src/config.js +30 -0
  118. package/src/constants.js +53 -0
  119. package/src/data-storage.js +204 -0
  120. package/src/junit-adapter/adapter.js +23 -0
  121. package/src/junit-adapter/csharp.js +28 -0
  122. package/src/junit-adapter/index.js +28 -0
  123. package/src/junit-adapter/java.js +58 -0
  124. package/src/junit-adapter/javascript.js +31 -0
  125. package/src/junit-adapter/python.js +42 -0
  126. package/src/junit-adapter/ruby.js +10 -0
  127. package/src/output.js +57 -0
  128. package/src/pipe/bitbucket.js +252 -0
  129. package/src/pipe/csv.js +140 -0
  130. package/src/pipe/debug.js +125 -0
  131. package/src/pipe/github.js +232 -0
  132. package/src/pipe/gitlab.js +247 -0
  133. package/src/pipe/html.js +373 -0
  134. package/src/pipe/index.js +71 -0
  135. package/src/pipe/testomatio.js +504 -0
  136. package/src/replay.js +262 -0
  137. package/src/reporter-functions.js +55 -0
  138. package/src/reporter.cjs_decprecated +21 -0
  139. package/src/reporter.js +33 -0
  140. package/src/services/artifacts.js +59 -0
  141. package/src/services/index.js +13 -0
  142. package/src/services/key-values.js +59 -0
  143. package/src/services/logger.js +315 -0
  144. package/src/template/emptyData.svg +23 -0
  145. package/src/template/testomatio.hbs +1081 -0
  146. package/src/uploader.js +376 -0
  147. package/src/utils/pipe_utils.js +119 -0
  148. package/src/utils/utils.js +416 -0
  149. package/src/xmlReader.js +614 -0
@@ -0,0 +1,9 @@
1
+ export default Adapter;
2
+ declare class Adapter {
3
+ constructor(opts: any);
4
+ opts: any;
5
+ getFilePath(t: any): any;
6
+ formatTest(t: any): any;
7
+ formatStack(t: any): any;
8
+ formatMessage(t: any): any;
9
+ }
@@ -1,23 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  class Adapter {
2
- constructor(opts) {
3
- this.opts = opts;
4
- }
5
-
6
- getFilePath(t) {
7
- return t.file;
8
- }
9
-
10
- formatTest(t) {
11
- return t;
12
- }
13
-
14
- formatStack(t) {
15
- return t.stack || '';
16
- }
17
-
18
- formatMessage(t) {
19
- return t.message;
20
- }
4
+ constructor(opts) {
5
+ this.opts = opts;
6
+ }
7
+ getFilePath(t) {
8
+ return t.file;
9
+ }
10
+ formatTest(t) {
11
+ return t;
12
+ }
13
+ formatStack(t) {
14
+ return t.stack || '';
15
+ }
16
+ formatMessage(t) {
17
+ return t.message;
18
+ }
21
19
  }
22
-
23
20
  module.exports = Adapter;
@@ -0,0 +1,5 @@
1
+ export default CSharpAdapter;
2
+ declare class CSharpAdapter extends Adapter {
3
+ getFilePath(t: any): string;
4
+ }
5
+ import Adapter from './adapter.js';
@@ -1,16 +1,30 @@
1
- const Adapter = require('./adapter');
2
-
3
- class CSharpAdapter extends Adapter {
4
- formatTest(t) {
5
- const title = t.title.replace(/\(.*?\)/, '').trim();
6
- const example = t.title.match(/\((.*?)\)/);
7
- if (example) t.example = { ...example[1].split(',') };
8
- const suite = t.suite_title.split('.');
9
- t.suite_title = suite.pop();
10
- t.file = suite.join('/');
11
- t.title = title.trim();
12
- return t;
13
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
8
+ class CSharpAdapter extends adapter_js_1.default {
9
+ formatTest(t) {
10
+ const title = t.title.replace(/\(.*?\)/, '').trim();
11
+ const example = t.title.match(/\((.*?)\)/);
12
+ if (example)
13
+ t.example = { ...example[1].split(',') };
14
+ const suite = t.suite_title.split('.');
15
+ t.suite_title = suite.pop();
16
+ t.file = namespaceToFileName(t.file);
17
+ t.title = title.trim();
18
+ return t;
19
+ }
20
+ getFilePath(t) {
21
+ const fileName = namespaceToFileName(t.file);
22
+ return fileName;
23
+ }
14
24
  }
15
-
16
25
  module.exports = CSharpAdapter;
26
+ function namespaceToFileName(fileName) {
27
+ const fileParts = fileName.split('.');
28
+ fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
29
+ return `${fileParts.join(path_1.default.sep)}.cs`;
30
+ }
@@ -0,0 +1,3 @@
1
+ export default AdapterFactory;
2
+ declare function AdapterFactory(lang: any, opts: any): Adapter;
3
+ import Adapter from './adapter.js';
@@ -1,28 +1,30 @@
1
- const Adapter = require('./adapter');
2
- const JavaScriptAdapter = require('./javascript');
3
- const JavaAdapter = require('./java');
4
- const PythonAdapter = require('./python');
5
- const RubyAdapter = require('./ruby');
6
- const CSharpAdapter = require('./csharp');
7
-
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
7
+ const javascript_js_1 = __importDefault(require("./javascript.js"));
8
+ const java_js_1 = __importDefault(require("./java.js"));
9
+ const python_js_1 = __importDefault(require("./python.js"));
10
+ const ruby_js_1 = __importDefault(require("./ruby.js"));
11
+ const csharp_js_1 = __importDefault(require("./csharp.js"));
8
12
  function AdapterFactory(lang, opts) {
9
- if (lang === 'java') {
10
- return new JavaAdapter(opts);
11
- }
12
- if (lang === 'js') {
13
- return new JavaScriptAdapter(opts);
14
- }
15
- if (lang === 'python') {
16
- return new PythonAdapter(opts);
17
- }
18
- if (lang === 'ruby') {
19
- return new RubyAdapter(opts);
20
- }
21
- if (lang === 'c#' || lang === 'csharp') {
22
- return new CSharpAdapter(opts);
23
- }
24
-
25
- return new Adapter(opts);
13
+ if (lang === 'java') {
14
+ return new java_js_1.default(opts);
15
+ }
16
+ if (lang === 'js') {
17
+ return new javascript_js_1.default(opts);
18
+ }
19
+ if (lang === 'python') {
20
+ return new python_js_1.default(opts);
21
+ }
22
+ if (lang === 'ruby') {
23
+ return new ruby_js_1.default(opts);
24
+ }
25
+ if (lang === 'c#' || lang === 'csharp') {
26
+ return new csharp_js_1.default(opts);
27
+ }
28
+ return new adapter_js_1.default(opts);
26
29
  }
27
-
28
30
  module.exports = AdapterFactory;
@@ -0,0 +1,5 @@
1
+ export default JavaAdapter;
2
+ declare class JavaAdapter extends Adapter {
3
+ getFilePath(t: any): string;
4
+ }
5
+ import Adapter from './adapter.js';
@@ -1,58 +1,46 @@
1
- const path = require('path');
2
- const Adapter = require('./adapter');
3
-
4
- class JavaAdapter extends Adapter {
5
- getFilePath(t) {
6
- const fileName = namespaceToFileName(t.suite_title);
7
- return this.opts.javaTests + path.sep + fileName;
8
- }
9
-
10
- formatTest(t) {
11
- const fileParts = t.suite_title.split('.');
12
-
13
- t.file = namespaceToFileName(t.suite_title);
14
- t.title = t.title.split('(')[0];
15
-
16
- // detect params
17
- const paramMatches = t.title.match(/\[(.*?)\]/g);
18
-
19
- if (paramMatches) {
20
- const params = paramMatches.map((_match, index) => `param${index + 1}`);
21
- if (params.length === 1) params[0] = 'param';
22
- let paramIndex = 0;
23
-
24
- t.title = t.title.replace(/: \[(.*?)\]/g, () => {
25
- if (params.length < 2) return `\${param}`;
26
- const paramName = params[paramIndex] || `param${paramIndex + 1}`;
27
- paramIndex++;
28
- return `\${${paramName}}`;
29
- });
30
- const example = {};
31
- paramMatches.forEach((match, index) => {
32
- example[params[index]] = match.replace(/[[\]]/g, '');
33
- });
34
- t.example = example;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
8
+ class JavaAdapter extends adapter_js_1.default {
9
+ getFilePath(t) {
10
+ const fileName = namespaceToFileName(t.suite_title);
11
+ return this.opts.javaTests + path_1.default.sep + fileName;
12
+ }
13
+ formatTest(t) {
14
+ const fileParts = t.suite_title.split('.');
15
+ t.file = namespaceToFileName(t.suite_title);
16
+ t.title = t.title.split('(')[0];
17
+ // detect params
18
+ const paramMatches = t.title.match(/\[(.*?)\]/g);
19
+ if (paramMatches) {
20
+ const params = paramMatches.map((_match, index) => `param${index + 1}`);
21
+ if (params.length === 1)
22
+ params[0] = 'param';
23
+ let paramIndex = 0;
24
+ t.title = t.title.replace(/: \[(.*?)\]/g, () => {
25
+ if (params.length < 2)
26
+ return `\${param}`;
27
+ const paramName = params[paramIndex] || `param${paramIndex + 1}`;
28
+ paramIndex++;
29
+ return `\${${paramName}}`;
30
+ });
31
+ const example = {};
32
+ paramMatches.forEach((match, index) => {
33
+ example[params[index]] = match.replace(/[[\]]/g, '');
34
+ });
35
+ t.example = example;
36
+ }
37
+ t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
38
+ return t;
35
39
  }
36
-
37
- t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
38
- return t;
39
- }
40
-
41
- // formatStack(t) {
42
- // const stack = super.formatStack(t);
43
-
44
- // const file = t.suite_title.split('.');
45
-
46
- // const fileLine = `at .*${file[file.length - 1]}\.java:(\\d+)` // eslint-disable-line no-useless-escape
47
- // const regexp = new RegExp(fileLine,"g")
48
- // return stack.replace(regexp, `${this.opts.javaTests}${path.sep}${namespaceToFileName(t.suite_title)}:$1:`);
49
- // }
50
40
  }
51
-
52
41
  function namespaceToFileName(fileName) {
53
- const fileParts = fileName.split('.');
54
- fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
55
- return `${fileParts.join(path.sep)}.java`;
42
+ const fileParts = fileName.split('.');
43
+ fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
44
+ return `${fileParts.join(path_1.default.sep)}.java`;
56
45
  }
57
-
58
46
  module.exports = JavaAdapter;
@@ -0,0 +1,4 @@
1
+ export default JavaScriptAdapter;
2
+ declare class JavaScriptAdapter extends Adapter {
3
+ }
4
+ import Adapter from './adapter.js';
@@ -1,30 +1,33 @@
1
- const createCallsiteRecord = require('callsite-record');
2
- const path = require('path');
3
- const Adapter = require('./adapter');
4
-
5
- class JavaScriptAdapter extends Adapter {
6
- formatStack(t) {
7
- let stack = super.formatStack(t);
8
-
9
- try {
10
- const error = new Error(stack.split('\n')[0]);
11
- error.stack = stack;
12
- const record = createCallsiteRecord({
13
- forError: error,
14
- });
15
- if (record && !record.filename.startsWith('http')) {
16
- stack += record.renderSync({
17
- stackFilter: frame =>
18
- frame.getFileName().indexOf(path.sep) > -1 &&
19
- frame.getFileName().indexOf('node_modules') < 0 &&
20
- frame.getFileName().indexOf('internal') < 0,
21
- });
22
- }
23
- return stack;
24
- } catch (err) {
25
- return stack;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const callsite_record_1 = __importDefault(require("callsite-record"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
9
+ class JavaScriptAdapter extends adapter_js_1.default {
10
+ formatStack(t) {
11
+ let stack = super.formatStack(t);
12
+ try {
13
+ const error = new Error(stack.split('\n')[0]);
14
+ error.stack = stack;
15
+ const record = (0, callsite_record_1.default)({
16
+ forError: error,
17
+ });
18
+ // @ts-ignore
19
+ if (record && !record.filename.startsWith('http')) {
20
+ stack += record.renderSync({
21
+ stackFilter: frame => frame.fileName?.indexOf(path_1.default.sep) > -1 &&
22
+ frame.fileName?.indexOf('node_modules') < 0 &&
23
+ frame.fileName?.indexOf('internal') < 0,
24
+ });
25
+ }
26
+ return stack;
27
+ }
28
+ catch (err) {
29
+ return stack;
30
+ }
26
31
  }
27
- }
28
32
  }
29
-
30
33
  module.exports = JavaScriptAdapter;
@@ -0,0 +1,5 @@
1
+ export default PythonAdapter;
2
+ declare class PythonAdapter extends Adapter {
3
+ getFilePath(t: any): string;
4
+ }
5
+ import Adapter from './adapter.js';
@@ -1,42 +1,43 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
- const Adapter = require('./adapter');
4
-
5
- class PythonAdapter extends Adapter {
6
- getFilePath(t) {
7
- let fileName = namespaceToFileName(t.suite_title, { checkFile: true });
8
- if (!fileName) fileName = namespaceToFileName(t.suite_title, { checkFile: false });
9
- return fileName;
10
- }
11
-
12
- formatTest(t) {
13
- const fileParts = t.suite_title.split('.');
14
- const example = t.title.match(/\[(.*)\]/)?.[1];
15
- if (example) t.example = { '#': example };
16
-
17
- t.file = namespaceToFileName(t.suite_title);
18
- t.title = t.title.split('[')[0];
19
- t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
20
- return t;
21
- }
22
-
23
- formatMessage(t) {
24
- return t.message.split('&#10;')[0];
25
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
9
+ class PythonAdapter extends adapter_js_1.default {
10
+ getFilePath(t) {
11
+ let fileName = namespaceToFileName(t.suite_title, { checkFile: true });
12
+ if (!fileName)
13
+ fileName = namespaceToFileName(t.suite_title, { checkFile: false });
14
+ return fileName;
15
+ }
16
+ formatTest(t) {
17
+ const fileParts = t.suite_title.split('.');
18
+ const example = t.title.match(/\[(.*)\]/)?.[1];
19
+ if (example)
20
+ t.example = { '#': example };
21
+ t.file = namespaceToFileName(t.suite_title);
22
+ t.title = t.title.split('[')[0];
23
+ t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
24
+ return t;
25
+ }
26
+ formatMessage(t) {
27
+ return t.message.split('&#10;')[0];
28
+ }
26
29
  }
27
-
28
30
  function namespaceToFileName(fileName, opts = {}) {
29
- const fileParts = fileName.split('.');
30
-
31
- while (fileParts.length > 0) {
32
- const file = `${fileParts.join(path.sep)}.py`;
33
- if (!opts.checkFile) return file;
34
- if (fs.existsSync(`${fileParts.join(path.sep)}.py`)) {
35
- return file;
31
+ const fileParts = fileName.split('.');
32
+ while (fileParts.length > 0) {
33
+ const file = `${fileParts.join(path_1.default.sep)}.py`;
34
+ if (!opts.checkFile)
35
+ return file;
36
+ if (fs_1.default.existsSync(`${fileParts.join(path_1.default.sep)}.py`)) {
37
+ return file;
38
+ }
39
+ fileParts.pop();
36
40
  }
37
- fileParts.pop();
38
- }
39
- return null;
41
+ return null;
40
42
  }
41
-
42
43
  module.exports = PythonAdapter;
@@ -0,0 +1,4 @@
1
+ export default RubyAdapter;
2
+ declare class RubyAdapter extends Adapter {
3
+ }
4
+ import Adapter from './adapter.js';
@@ -1,10 +1,13 @@
1
- const Adapter = require('./adapter');
2
-
3
- class RubyAdapter extends Adapter {
4
- formatStack(t) {
5
- const stack = super.formatStack(t);
6
- return stack.replace(/\[(.*?:.\d*)\]/g, '\n$1');
7
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const adapter_js_1 = __importDefault(require("./adapter.js"));
7
+ class RubyAdapter extends adapter_js_1.default {
8
+ formatStack(t) {
9
+ const stack = super.formatStack(t);
10
+ return stack.replace(/\[(.*?:.\d*)\]/g, '\n$1');
11
+ }
8
12
  }
9
-
10
13
  module.exports = RubyAdapter;
@@ -0,0 +1,11 @@
1
+ export default Output;
2
+ declare class Output {
3
+ constructor(opts?: {});
4
+ filterFn: any;
5
+ reset(): void;
6
+ log: any[];
7
+ start(): void;
8
+ push(line: any): void;
9
+ text(): string;
10
+ stop(): void;
11
+ }
package/lib/output.js CHANGED
@@ -1,57 +1,49 @@
1
- const { format } = require('util');
2
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const util_1 = require("util");
3
4
  const consoleLog = console.log;
4
5
  const consoleError = console.error;
5
-
6
- const formatArgs = args => format.apply(format, Array.prototype.slice.call(args));
7
-
6
+ const formatArgs = args => util_1.format.apply(util_1.format, Array.prototype.slice.call(args));
8
7
  class Output {
9
- constructor(opts = {}) {
10
- this.filterFn = opts.filterFn || (() => true);
11
- this.reset();
12
- }
13
-
14
- reset() {
15
- this.log = [];
16
- this.stop(); // resotre console log if it was overridden
17
- }
18
-
19
- start() {
20
- const { filterFn } = this;
21
- const self = this;
22
- console.log = (...args) => {
23
- const obj = {};
24
- Error.captureStackTrace(obj);
25
- const logString = formatArgs(args);
26
- if (filterFn(obj.stack)) {
27
- self.log.push(logString);
28
- }
29
- consoleLog(logString);
30
- };
31
-
32
- console.error = (...args) => {
33
- const obj = {};
34
- Error.captureStackTrace(obj);
35
- const logString = formatArgs(args);
36
- if (filterFn(obj.stack)) {
37
- self.log.push(logString);
38
- }
39
- consoleError(logString);
40
- };
41
- }
42
-
43
- push(line) {
44
- this.log.push(line);
45
- }
46
-
47
- text() {
48
- return this.log.join('\n');
49
- }
50
-
51
- stop() {
52
- console.log = consoleLog;
53
- console.error = consoleError;
54
- }
8
+ constructor(opts = {}) {
9
+ this.filterFn = opts.filterFn || (() => true);
10
+ this.reset();
11
+ }
12
+ reset() {
13
+ this.log = [];
14
+ this.stop(); // resotre console log if it was overridden
15
+ }
16
+ start() {
17
+ const { filterFn } = this;
18
+ const self = this;
19
+ console.log = (...args) => {
20
+ const obj = {};
21
+ Error.captureStackTrace(obj);
22
+ const logString = formatArgs(args);
23
+ if (filterFn(obj.stack)) {
24
+ self.log.push(logString);
25
+ }
26
+ consoleLog(logString);
27
+ };
28
+ console.error = (...args) => {
29
+ const obj = {};
30
+ Error.captureStackTrace(obj);
31
+ const logString = formatArgs(args);
32
+ if (filterFn(obj.stack)) {
33
+ self.log.push(logString);
34
+ }
35
+ consoleError(logString);
36
+ };
37
+ }
38
+ push(line) {
39
+ this.log.push(line);
40
+ }
41
+ text() {
42
+ return this.log.join('\n');
43
+ }
44
+ stop() {
45
+ console.log = consoleLog;
46
+ console.error = consoleError;
47
+ }
55
48
  }
56
-
57
49
  module.exports = Output;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @class BitbucketPipe
3
+ * @typedef {import('../../types/types.js').Pipe} Pipe
4
+ * @typedef {import('../../types/types.js').TestData} TestData
5
+ */
6
+ export class BitbucketPipe {
7
+ constructor(params: any, store?: {});
8
+ isEnabled: boolean;
9
+ ENV: NodeJS.ProcessEnv;
10
+ store: {};
11
+ tests: any[];
12
+ token: any;
13
+ hiddenCommentData: string;
14
+ client: Gaxios;
15
+ cleanLog(log: any): Promise<string>;
16
+ prepareRun(): Promise<void>;
17
+ createRun(): Promise<void>;
18
+ addTest(test: any): void;
19
+ finishRun(runParams: any): Promise<void>;
20
+ toString(): string;
21
+ updateRun(): void;
22
+ }
23
+ export type Pipe = import("../../types/types.js").Pipe;
24
+ export type TestData = import("../../types/types.js").TestData;
25
+ import { Gaxios } from 'gaxios';