Skip to content

Conversation

Copy link

Copilot AI commented Oct 23, 2025

Summary

This PR adds comprehensive unit tests to all 10 Rust plugins that were previously missing test coverage, bringing the repository to 100% plugin test coverage.

Changes

Added unit tests to the following plugins:

  • compress: Tests for compression algorithms, default configurations, and options deserialization
  • dsv: Tests for CSV/TSV parsing, file type detection, and plugin configuration
  • image: Tests for image processing options, DOM mode, and filter configuration
  • mdx: Tests for MDX file detection, JSX runtime options, and plugin initialization
  • modular-import: Tests for plugin name and options deserialization
  • strip: Tests for code stripping patterns, regex creation, and AST manipulation
  • url: Tests for URL handling, file operations, and asset configuration
  • wasm: Tests for WASM helper constants and plugin initialization
  • worker: Tests for Web Worker patterns, regex matching, and worker configuration
  • yaml: Tests for YAML file detection, document parsing, and JavaScript conversion

Testing Approach

All tests follow the existing patterns established by plugins like virtual, auto-import, and react-components:

  • Tests are placed in #[cfg(test)] modules at the end of each lib.rs file
  • Focus on core functionality: plugin creation, configuration parsing, and key utility functions
  • Use simple assertions with mock data for easy maintenance
  • All 42 new tests pass successfully

Test Coverage

Before this PR:

  • 5 plugins with tests (auto-import, icons, react-components, svgr, virtual)
  • 10 plugins without tests

After this PR:

  • 15 plugins with tests
  • 0 plugins without tests

Statistics

  • 10 files modified
  • 435 lines of test code added
  • 42 new tests passing
  • 0 breaking changes

All tests can be run with cargo test --workspace --lib

Original prompt

给所有的 rust 插件添加单元测试


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

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.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Add unit tests for all Rust plugins 给所有的 Rust 插件添加单元测试 / Add unit tests to all Rust plugins Oct 23, 2025
Copilot AI requested a review from Maidang1 October 23, 2025 16:45
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