Skip to content

[TestGru] Add unit test for lib/compiler/defaults/swc-defaults.ts #3

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

Open
wants to merge 1 commit into
base: gengu_test
Choose a base branch
from

Conversation

gru-agent[bot]
Copy link

@gru-agent gru-agent bot commented Nov 28, 2024

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
Manual gengu 1 Detail

Summary

This PR introduces a new test suite for the swcDefaultsFactory function, which is responsible for generating default SWC options based on TypeScript compiler options and a given configuration. The test suite is implemented using Vitest and includes the following test cases:

  1. Default SWC Options Generation: Verifies that the function correctly generates SWC options and CLI options when provided with specific TypeScript options and configuration.

  2. Handling Undefined Inputs: Ensures that the function can handle cases where both TypeScript options and configuration are undefined, returning appropriate default values.

  3. Windows Path Conversion: Tests the conversion of Windows-style paths to POSIX format in the cliOptions.outDir.

  4. Inline Source Map Handling: Checks the function's ability to handle the inlineSourceMap option in TypeScript options, ensuring it sets the sourceMaps option to 'inline'.

  5. Builder Options Override: Validates that CLI options can be overridden by builder options specified in the configuration, particularly for watch and sync options.

These tests aim to ensure the robustness and correctness of the swcDefaultsFactory function in various scenarios.

Coverage

The change in coverage value, such as: 0% -> 50%, indicates that the coverage was 0% before writing the tests and 50% after writing them.

https://web.dev/articles/ta-code-coverage

Type Change
lines 0% -> 100% 🔺
functions 0% -> 100% 🔺
statements 0% -> 100% 🔺
branches 0% -> 100% 🔺

Test Statuses

Status Change
passed 0 -> 5 🔺
failed 0 -> 0
skipped 0 -> 0

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Tip

You can @gru-agent rebase to rebase the PR.

Tip

You can @gru-agent redo to reset or rebase before redoing the PR.

Tip

To modify the test code yourself, click here Edit Test Code

@gru-agent gru-agent bot requested a review from gengu November 28, 2024 08:20
@gru-agent gru-agent bot mentioned this pull request Nov 28, 2024
3 tasks
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.

0 participants