@testomatio/reporter 0.5.0 → 0.5.1

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/Changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.5.1
2
+
3
+ * Fixed Cypress.io to report tests inside nested suites
4
+
1
5
  # 0.5.0
2
6
 
3
7
  * Added Cypress.io plugin
@@ -1,5 +1,5 @@
1
1
  const TRConstants = require('../../constants');
2
- const { parseTest } = require('../../util');
2
+ const { parseTest, parseSuite } = require('../../util');
3
3
  const TestomatClient = require('../../client');
4
4
 
5
5
  const testomatioReporter = on => {
@@ -19,8 +19,11 @@ const testomatioReporter = on => {
19
19
  const time = latestAttempt.duration;
20
20
  const error = latestAttempt.error;
21
21
 
22
- const title = test.title[1]; // [0] - spec title, [1] - test title
22
+ const title = test.title.pop();
23
+ const suiteTitle = test.title.pop();
24
+
23
25
  const testId = parseTest(title);
26
+ const suiteId = '';
24
27
 
25
28
  const screenshots = results.screenshots
26
29
  .filter(screenshot => screenshot.path.includes(title))
@@ -29,7 +32,7 @@ const testomatioReporter = on => {
29
32
 
30
33
  const state = test.state === 'passed' ? TRConstants.PASSED : TRConstants.FAILED;
31
34
 
32
- addSpecTestsPromises.push(client.addTestRun(testId, state, { title, time, error, files }));
35
+ addSpecTestsPromises.push(client.addTestRun(testId, state, { title, time, error, files, suite_title: suiteTitle, suite_id: suiteId }));
33
36
  }
34
37
 
35
38
  await Promise.all(addSpecTestsPromises);
package/lib/util.js CHANGED
@@ -14,6 +14,21 @@ const parseTest = testTitle => {
14
14
  return null;
15
15
  };
16
16
 
17
+ /**
18
+ * @param {String} suiteTitle - suite title
19
+ *
20
+ * @returns {String} suiteId
21
+ */
22
+ const parseSuite = suiteTitle => {
23
+ const captures = suiteTitle.match(/@S([\w\d]+)/);
24
+ if (captures) {
25
+ return captures[1];
26
+ }
27
+
28
+ return null;
29
+ };
30
+
31
+
17
32
  const ansiRegExp = () => {
18
33
  const pattern = [
19
34
  '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",