testing-library / testing-library/dom-testing-library

have main detect node vs browser

Open
#507 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.3k
Forks
474
PR merge metrics
No merged PRs in 30d

Description

Describe the feature you'd like:

According to this comment: https://github.com/DevExpress/testcafe/issues/4176#issuecomment-523916838 it may be possible for dom testing library to detect if its being used in node or in a browser.

The feature I'm requesting is to have it use the UMD module if it's in the browser and if not the existing main.

Suggested implementation:

🤔

Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:

would not break anything, would just allow main to be used in the browser (via umd)

This will help w/ client script injection for testcafe testing library and make it a bit easier to inject DTL on the page.

Contributor guide

Open the contributing guide

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 package entry points referred to as main and UMD, along with how the library is selected in Node versus a browser. Confirm the expected browser and Node loading behavior, then verify that browser use selects the UMD module without breaking the existing main entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.