rtfeldman / rtfeldman/node-test-runner

Question about the behavior related to duplicate descriptions error and automatic description level added with the module name?

Open
#493 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
140
Forks
83
Avg merge
8h 25m
Merged PRs (30d)
5

Description

When the error for duplicate descriptions was introduced, it was in part to get rid of potential copy-paste descriptions for more useful failure messages.

In node-test-runner, all tests are aggregated with their module name prepended to each test description. As a result, potential copy pasted descriptions across test files are not detected. In elm-test-rs, we do not prepend the module name to the description, causing behavior differences such as tests failing in elm-test-rs with duplicate descriptions errors. Although annoying to fix, which would be improved with this PR, @avh4 acknowledged that "In all cases, the duplicate describe names were a mistake".

I must admit that initially my reason for this behavior change was not to catch duplicate descriptions. It was for two reasons, (1) because I didn't like having labels in the failure reports that were never set by the user themselves, especially knowing that it's easy to add a suite = describe "This.Module" [ allExposedTests... ], and (2) because it resulted in simpler code in the tests runner.

Now knowing that it has the following advantages:

  • be explicit about your tests descriptions
  • potentially catch copy-paste errors
  • simpler test runner code

would node-test-runner be willing to change that behavior at the next breaking update? Or are there other advantages than copy-paste commodity that I didn't saw making it worth staying as is?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked elm-test duplicate-description issue and PR, then compare the described behavior in node-test-runner with elm-test-rs. Clarify whether the next breaking update should stop prepending module names, identify the compatibility implications, and define the expected duplicate-description behavior before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.