Skip to content

Tests with identical names in different blocks are merged as retry in UI #645

@DenysKuchma

Description

@DenysKuchma

When running Jest tests with Testomat.io Reporter, tests that have the same title in different describe blocks are merged in the UI: one test is shown as passed, the second one appears as a retry, and the total tests count is reduced by 1.

Environment:

  • Reporter version: 2.3.8
  • Runner: Jest
  • Node.js: any recent LTS (e.g. 18.x)
  • OS: Windows 10 + WSL (Ubuntu)

Command:

TESTOMATIO_URL=<url> \
TESTOMATIO=<project_token> \
TESTOMATIO_CREATE=1 \
npx jest

Example test file:

const StringUtils = require('../src/string-utils');

describe('@S_str StringUtils', () => {
  describe('capitalize', () => {
    it('should capitalize first letter', () => {
      expect(StringUtils.capitalize('hello')).toBe('Hello');
    });

    it('should handle empty string', () => {
      expect(StringUtils.capitalize('')).toBe('');
    });

    it('should handle single character', () => {
      expect(StringUtils.capitalize('a')).toBe('A');
    });
  });

  describe('reverse', () => {
    it('should reverse string', () => {
      expect(StringUtils.reverse('hello')).toBe('olleh');
    });

    it('should handle empty string', () => {
      expect(StringUtils.reverse('')).toBe('');
    });
  });

  describe('isPalindrome', () => {
    it('should return true for palindrome', () => {
      expect(StringUtils.isPalindrome('Racecar')).toBe(true);
    });

    it('should return false for non-palindrome', () => {
      expect(StringUtils.isPalindrome('hello')).toBe(false);
    });

    it('should ignore punctuation and case', () => {
      expect(StringUtils.isPalindrome('A man, a plan, a canal: Panama')).toBe(true);
    });
  });

  describe('truncate', () => {
    it('should truncate long string', () => {
      expect(StringUtils.truncate('Hello world', 5)).toBe('Hello...');
    });

    it('should return original string if under limit', () => {
      expect(StringUtils.truncate('Hi', 5)).toBe('Hi');
    });
  });
});

Jest output:

  • Tests: 20 passed, 20 total

Testomat.io UI:

  • Shows 19 tests total
  • One of the should handle empty string tests is displayed as 1 retry instead of a separate test.
Image

Actual result:

  • Tests with the same name but in different describe blocks are merged and treated as retries, reducing the total tests count.

Expected result:

  • Tests should be uniquely identified by full path, so two tests with the same title in different blocks are reported as two separate tests, not as a test with a retry.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions