Skip to content

How do I resolve duplicate Test IDs when using Mocha?

Duplicate Test IDs can occur when running the check-tests script with Mocha, especially if multiple tests in a file lack existing Testomatio IDs.

  1. Identify Duplicate IDs: Run the script npx check-tests mocha 'src/specs/**/*.tests.ts' --typescript --update-ids and check for any import errors indicating duplicate IDs.
  2. Manually Remove Duplicate IDs: Open the test files and manually search for the duplicate IDs. Remove the IDs from both tests that have the same ID.
  3. Rerun the Script: After removing the duplicate IDs, rerun the script to generate new, unique Testomatio IDs for the tests.
  • If you have made changes to the check-tests script to address this issue, consider testing them thoroughly before submitting a pull request.