Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from qunitjs:main #1

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open

[pull] main from qunitjs:main #1

wants to merge 52 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Aug 7, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

Add a bit more detail.
@pull pull bot added the ⤵️ pull label Aug 7, 2024
Krinkle and others added 28 commits August 7, 2024 23:57
== pushFailure ==

This was setting `actual: null` and, left expected unset/undefined.
In HtmlReporter this idom was recognised to mean "don't show values",
based on hasOwn for `expected`. This worked because QUnit.log() passes
the internal assert result object as-is.

In TAP output, this was not skipped because Test.js#logAssertion
copies the object for the testEnd.errors array, and in doing so forges
an `expected` property to exist no matter what, thus with an implied
value of undefined. The hasOwn checks in TapReporter thus always
evaluate to true.

This meant TAP output for pushFailure() calls not only showed
redundant actual/expected entries, but actively created confusion
by setting them to different values, drawing attention to a supposed
difference that has no meaning

> actual: null
> expected: undefined

Fix by changing pushFailure to omit both actual and expected,
and change the condition in both reporters to skip rendering of values
based on both being strictly equal to `undefined`, instead of based
on `hasOwn('expected')`.

== onUncaughtException / `QUnit.on('error')` ==

For uncaught errors, we already omitted both actual and undefined,
the HtmlReporter thus already skipped them (for the reason above),
but in TAP output they showed, for the same reason as above as:

> actual: undefined
> expected: undefined

Which, while not as actively confusing, is at least redundant.
This is naturally fixed by the same change, which now omits this.
Follows-up #1789, which applied
this to traces under uncaught errors. We now apply this clean up to
traces under assertion failures as well.

Closes #1795.
When projects use the recommended structure for the HTML test suite,
in which qunit.js is loaded at the end of the `<body>` we now render
the UI immediately instead of waiting for all source code and test
suites to load first, which can take a while in large projects.

Closes #1793.
Follows-up d8c2a3a. This felt like a hacky compromise and doesn't
quite feel right either way. Let's leave flowing as before for now.

What I did add is to expose the version and user agent as data
attributes, to empower other themes and plugins to play with this
and perhaps come up with a better design.
Follows-up 05e15ba, which made this into a factory function,
but that has the downside of making the QUnit object not defined in
one object literal, which makes a few other things reasier to reason
about.

In a way, it's more honest to say that start is the product of a
factory function, but I'd prefer to maintain the simplicity of an
uncoupled literal declaration the entire API, in particular in prep
for native ESM export (ref #1551).

I'll accept in return the internal responsiblity to not call start()
"incorrectly" (i.e. before it is ready). This responsibility does not
leak into, complicate, break, or otherwise change the public API, and
is mitigated by a runtime detection, for the benefit of future
contributors and maintainers to QUnit.
Avoid dumping the entire QUnit object.
Extracted from #1798 to minimize
the diff.
Node.js fetch() is non-experimental as of Node.js 18.0.0.

Test Plan:
* Run `node build/review-package.js 3.0.0-alpha.2`.
* This should download _temp/package.json and offer it for diffing.
* This should then download _temp/qunit.js and offer it for diffing.
Don't apply colors to the "ok 1" and "not ok 1" prefix. This has
the benefit of making the test names easier to visually extract
for developers.

It also increases compatibility with the popular `tap-parser`
package which doesn't parse TAP lines correctly otherwise, since
blocks like "not ok" must start on a new line, and with the color
code in front, they are technically either a continuation of the
previous block, or an ignored "Anything" line between two blocks.

https://github.com/tapjs/tapjs/tree/ccfea67fec/src/parser

https://testanything.org/tap-version-13-specification.html

Closes #1801.
> [BROWSERSTACK_DEVICE_DEPRECATION_WARNING] This is to inform you that we have
> decided to deprecate iPhone 8-12, effective 5 November 2024. For more details,
> please check our device deprecation policy FAQ
> https://www.browserstack.com/question/790
> https://www.browserstack.com/support/faq/automate/basics-automate/device-deprecation-policy
> . If you are still using this device, we strongly recommend you update your
> test script or risk your tests failing. For the current list of supported
> devices on BrowserStack, please check here
> https://www.browserstack.com/list-of-browsers-and-platforms/automate
Follows-up 06424ba. This ensures
reproducible builds for e.g. minor changes in Rollup or Babel.

Also remove the file trigger from `.github/workflows/reproducible.yaml`
which otherwise triggers on release commits and release branches,
because it seems GitHub interprets release branches/tags as creating
all files, and thus matching all files.

Exclude 3.0.0-alpha.3 because it still committed package-lock.json,
and contained older versions than the working copy I released it with.
* Improve and simplify test case naming.

* Inline the test case "expected" output for improved comprehension
  of the purpose of the test, and to make it easier to edit in the
  future. This was the last remnant of the expected/ directory that
  we used to use for cli-main.js as well. (The latter has mostly
  been moved to inline cases as well, plus many using the `.tap.txt`
  files for simple cases where what's being tested is all in the
  fixture file, and not in cli-main.js itself.)

* Use QUnit.test.each() to make the difference between the first
  two tests easier to spot. This isn't code de-duplication per-se,
  since I don't mind that much, but it's to clarify what's difference
  since they looked nearly the same.
The `paths` filter isn't just about commits that add or modify files,
GitHub seemingly also triggers this for any new tags and new branches
that inherit from existing commits/branches where these files already
exist, even if the new branch/tag does not add or modify these files
at all.

This seems like a bug, but is sufficiently annoying (especially on
older 2.x-related branches) that it's better to turn off in favour
of manual workflow_dispatch for the rare case where I want to test
this before a given commit is merged to main.
We need the function internally either way, for its internal features,
such as `undefOnly`.

Too widely used in the ecosystem. Not worth the effort for devs to
have change their code as part of upgrading QUnit, and possibly
stagnating on an older QUnit version over (if not in their own code,
but e.g. a plug-in).

See also:
* 82c4790: Remove `extend`.
* 335b040: Document removal of `extend`.
* eaa0dbe: Restore `assert.push` without deprecation.
Follows-up 91db92d, which recently fixed another part of the
`maxDepth` feature, but left the HTML still invalid.

Follows-up 47e3b99, which broke the HTML by mistakenly swapping
one of the double quotes for a single quote, thus leaving the anchor
element unclosed.
Copy link

coderabbitai bot commented Dec 5, 2024

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

* Fix huge color contrast issue with the dark red background
  behind similarly dark colors, especially in `.counts`.

* Remove white padding between test item edge and assert list
  assertion green/red shading. Instead, add some border-spacing
  to the assert item table.

* Adjust various colors slightly to comply with WCAG guidelines.
  https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast

* Fix broken `.qunit-test.pass .test-expected { color: #999; }`
  override which was only applicable to passing "todo" tests as no
  other passing tests have failing assertions under them. This was
  meant to mute the colors of these failures to avoid distraction.
  However the CSS cascade has changed over time such that these
  styles no longer applied.

  This is likely masked by the fact that passing tests (including
  passing todos) are collapsed by default, so there's very little
  attention to these anyway.

  Restore these overrides, and extend them to the "diff" and
  "source" lines as well.

Easy way to identify color usage:

```
$ git grep '#[0-9A-F][0-9A-F]*' src/core/qunit.css | sed 's/^.*\(#[0-9A-F]*\).*/\1/' | sort | uniq -c
```

Ref #1774.
Closes #1803.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant