Skip to content

test: add tests for output.inlineScript function#1266

Merged
colinaaa merged 3 commits intomainfrom
chore/add-tests-inline-scripts-fn
Jul 10, 2025
Merged

test: add tests for output.inlineScript function#1266
colinaaa merged 3 commits intomainfrom
chore/add-tests-inline-scripts-fn

Conversation

@gaoachao
Copy link
Copy Markdown
Collaborator

@gaoachao gaoachao commented Jul 10, 2025

Summary

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Summary by CodeRabbit

  • Tests

    • Added a new test case to verify support for function-based values in the inlineScripts option within the configuration.
    • Enhanced test coverage for multiple entry points and plugin options.
  • Chores

    • Introduced a new empty changeset file for tracking future updates.

@gaoachao gaoachao requested a review from colinaaa as a code owner July 10, 2025 09:22
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: 88e0c9c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

A new empty changeset file was added. Additionally, a test suite for the plugin-react package was extended with a test case to verify the behavior of the output.inlineScripts option when provided as a function, including checks for plugin inclusion and configuration.

Changes

File(s) Change Summary
.changeset/free-kids-appear.md Added an empty changeset file with only front matter delimiters.
packages/rspeedy/plugin-react/test/config.test.ts Added a test for output.inlineScripts as a function; updated imports to include a plugin type.

Poem

A changeset appears, so quiet and neat,
And tests for scripts that inline or repeat.
With plugins checked and configs in tow,
The code hops forward—onward we go!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

 ERROR  Cannot resolve version $@rspack/core in overrides. The direct dependencies don't have dependency "@rspack/core".
For help, run: pnpm help install


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60095d7 and 88e0c9c.

📒 Files selected for processing (2)
  • .changeset/free-kids-appear.md (1 hunks)
  • packages/rspeedy/plugin-react/test/config.test.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/rspeedy/plugin-react/test/config.test.ts (1)
packages/rspeedy/plugin-react/src/pluginReactLynx.ts (1)
  • pluginReactLynx (324-434)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: CodeQL Analyze (javascript-typescript)
  • GitHub Check: CodeQL Analyze (actions)
🔇 Additional comments (3)
.changeset/free-kids-appear.md (1)

1-4: LGTM! Empty changeset is appropriate for test additions.

The empty changeset file is correctly structured and appropriate for this PR since adding tests typically doesn't require a version bump.

packages/rspeedy/plugin-react/test/config.test.ts (2)

12-15: LGTM! Import addition is correct.

The import statement properly includes the LynxEncodePlugin type needed for the new test case.


544-600: Excellent test coverage for output.inlineScripts function behavior.

This test comprehensively verifies the behavior when output.inlineScripts is provided as a function:

  1. ✅ Correctly tests that the function is passed to LynxEncodePlugin
  2. ✅ Verifies the function logic is preserved using toString() and snapshot matching
  3. ✅ Checks that ReactWebpackPlugin has firstScreenSyncTiming set to 'jsReady'
  4. ✅ Uses appropriate entry configurations with mixed import arrays and strings

The test follows the existing patterns in the file and provides good coverage for this specific functionality.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jul 10, 2025

CodSpeed Performance Report

Merging #1266 will not alter performance

Comparing chore/add-tests-inline-scripts-fn (88e0c9c) with main (60095d7)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link
Copy Markdown

relativeci bot commented Jul 10, 2025

Web Explorer

#2823 Bundle Size — 294.21KiB (0%).

88e0c9c(current) vs 60095d7 main#2821(baseline)

Bundle metrics  Change 1 change
                 Current
#2823
     Baseline
#2821
No change  Initial JS 139.86KiB 139.86KiB
No change  Initial CSS 31.88KiB 31.88KiB
Change  Cache Invalidation 0% 86.15%
No change  Chunks 4 4
No change  Assets 5 5
Change  Modules 205(+0.49%) 204
No change  Duplicate Modules 17 17
No change  Duplicate Code 4.26% 4.26%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#2823
     Baseline
#2821
No change  JS 220.19KiB 220.19KiB
No change  Other 42.14KiB 42.14KiB
No change  CSS 31.88KiB 31.88KiB

Bundle analysis reportBranch chore/add-tests-inline-scripts-f...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Jul 10, 2025

React Example

#2832 Bundle Size — 234.12KiB (0%).

88e0c9c(current) vs 60095d7 main#2830(baseline)

Bundle metrics  no changes
                 Current
#2832
     Baseline
#2830
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 153 153
No change  Duplicate Modules 61 61
No change  Duplicate Code 45.85% 45.85%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#2832
     Baseline
#2830
No change  IMG 145.76KiB 145.76KiB
No change  Other 88.37KiB 88.37KiB

Bundle analysis reportBranch chore/add-tests-inline-scripts-f...Project dashboard


Generated by RelativeCIDocumentationReport issue

@colinaaa colinaaa changed the title chore: add tests for output.inlineScript function test: add tests for output.inlineScript function Jul 10, 2025
@colinaaa colinaaa added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit 9f34a90 Jul 10, 2025
46 checks passed
@colinaaa colinaaa deleted the chore/add-tests-inline-scripts-fn branch July 10, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants