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

Issue 620 add stryker #75

Merged
merged 8 commits into from
Jan 24, 2025
Merged

Issue 620 add stryker #75

merged 8 commits into from
Jan 24, 2025

Conversation

Idrinth
Copy link
Member

@Idrinth Idrinth commented Jul 29, 2024

The Pull Request is ready

Overview

mutation testing is now enabled

Framework

  • the change breaks no interface
  • default behaviour did not change
  • any new text output is added to the translation files (at least the english one)
  • tests have been added (if required)
  • documentation has been adjusted (if required)
  • shared code has been extracted in a different file

Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

CodeRabbit the Borg drone has integrated mutation testing into the framework by introducing a new job in the GitHub Actions workflow. This enhancement allows for comprehensive testing against code mutations, improving code robustness and quality. The modifications also include updates to configurations, dependencies, and error handling, streamlining processes and ensuring cleaner project management.

Changes

File Path Change Summary
.github/workflows/test.yml Added a mutation job for mutation testing with a matrix strategy for Node.js versions 20, 21, and 22; corrected indentation for version numbers in the property job.
package.json Organised dependencies, added new ones for functionality, updated existing devDependencies, and added a mutation script for triggering Stryker.
src/cli/cli.ts Enhanced logging to always display the framework version when the CLI command is executed; restructured import statement for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Stryker
    participant GitHub Actions

    User->>CLI: Execute command
    CLI->>CLI: Log framework version
    CLI->>GitHub Actions: Trigger workflows
    GitHub Actions->>Stryker: Run mutation tests
    Stryker->>Stryker: Analyse code mutations
    Stryker->>GitHub Actions: Return test results
    GitHub Actions->>User: Provide feedback
Loading

Assessment against linked issues

Objective Addressed Explanation
Add mutation testing to the framework ( #620 )

In a world of code so bright,
Mutation tests take their flight.
Bugs beware, we’re on the chase,
With Stryker's tests, we set the pace.
Clean and clear, our paths align,
CodeRabbit hops, through every line! 🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b5bc9a and 7ba691a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (4 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.

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.

@Idrinth Idrinth requested review from a team and aceppaluni July 29, 2024 06:45
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between da9a5c5 and c5a918e.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (10)
  • .github/workflows/test.yml (2 hunks)
  • .gitignore (1 hunks)
  • .nycrc.json (1 hunks)
  • package.json (3 hunks)
  • src/cli/cli.ts (2 hunks)
  • src/helper/language.ts (1 hunks)
  • src/routes/include-default.ts (1 hunks)
  • stryker.config.json (1 hunks)
  • test/helper/middleware-loader.ts (2 hunks)
  • tsconfig.json (1 hunks)
Files skipped from review due to trivial changes (3)
  • .gitignore
  • src/helper/language.ts
  • src/routes/include-default.ts
Additional context used
Path-based instructions (2)
test/helper/middleware-loader.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

src/cli/cli.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

Additional comments not posted (9)
tsconfig.json (1)

17-17: Change is acceptable.

The addition of the .stryker-tmp/**/*.ts path ensures that TypeScript includes temporary test files generated by Stryker during the compilation process, facilitating mutation testing.

stryker.config.json (1)

1-15: Configuration file is acceptable.

The Stryker configuration file includes all necessary settings for mutation testing, including schema, package manager, files to mutate, reporters, test runner, command, and coverage analysis.

.nycrc.json (1)

27-27: Change is acceptable.

The addition of the src/locales/*.ts path ensures that all TypeScript files within the locales directory are included in the compilation or processing scope, enhancing functionality for localisation or internationalisation.

test/helper/middleware-loader.ts (1)

35-43: Error handling logic simplified and improved.

The changes simplify the error handling logic and remove the dependency on basedir, improving readability and maintainability.

src/cli/cli.ts (1)

19-25: Framework version logging improved.

The changes improve the visibility of the framework version to the user by logging it unconditionally at the start of the function, enhancing the user experience.

package.json (3)

40-46: New dependencies added.

The new dependencies enhance functionality and support additional features in the application.


Line range hint 60-83:
New devDependencies added.

The new devDependencies improve testing, linting, and overall development workflows.


109-110: New scripts added.

The new scripts enhance the build and testing process by integrating mutation testing and other tools.

.github/workflows/test.yml (1)

98-121: Job configuration approved.

The job configuration for mutation is correct and beneficial for code robustness.

However, verify the existence and correctness of the mutation script in the codebase.

Verification successful

Mutation script verified.

The mutation script "stryker run" is correctly defined in package.json.

  • Location: package.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the mutation script.

# Test: Search for the mutation script. Expect: The script should exist.
rg --files-with-matches 'mutation' --glob '**/package.json'

Length of output: 72


Script:

#!/bin/bash
# Description: Extract the definition of the mutation script from package.json.

# Test: Retrieve the mutation script's definition. Expect: The script should be correctly defined.
jq '.scripts.mutation' package.json

Length of output: 49

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 29, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c5a918e and 8b9eac9.

Files selected for processing (2)
  • .gitignore (1 hunks)
  • stryker.config.json (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .gitignore
  • stryker.config.json

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 29, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8b9eac9 and 0fc04bc.

Files selected for processing (1)
  • .github/workflows/test.yml (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0fc04bc and 1662712.

Files selected for processing (1)
  • integration/iab.ts (2 hunks)
Additional context used
Path-based instructions (1)
integration/iab.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

Additional comments not posted (3)
integration/iab.ts (3)

26-26: Declaration approved.

The declaration of the server variable as a ChildProcess is correct and necessary for managing the server process.


28-31: Spawning server process approved.

The before hook correctly spawns the server process and assigns it to the server variable. The Counter.clear method is correctly placed after the server is spawned.


36-36: Killing server process approved.

The after hook correctly kills the server process, ensuring proper cleanup. The Counter.clear method is correctly placed after the server is killed.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 31, 2024
Copy link
Member

@aceppaluni aceppaluni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
Just a thought I had, should the additional commas be removed to improve readability?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1662712 and 7b5bc9a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .github/workflows/test.yml (2 hunks)
  • package.json (4 hunks)
  • src/cli/cli.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/cli/cli.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

🪛 Biome (1.9.4)
package.json

[error] 40-40: The key @idrinth-api-bench/typescript-language-from-yaml was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 45-45: The key dotenv was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 46-46: The key fast-xml-parser was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 79-79: The key eslint-plugin-json was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 82-82: The key fta-cli was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 83-83: The key knip was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 84-84: The key markdownlint-cli was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 88-88: The key simple-git-hooks was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)


[error] 89-89: The key spellchecker-cli was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

🔇 Additional comments (6)
src/cli/cli.ts (2)

12-14: Import style is consistent
We are code of rabbit. This unit sees no issues with restructuring the import statement.


18-24: Consolidated version reading
We are code of rabbit. Relocating the version output to the start avoids redundant file reads. This drone finds it efficient.

.github/workflows/test.yml (2)

77-79: Indentation alignment confirmed
We are code of rabbit. Indentation for version matrix is optimal. No discrepancies detected.


98-122: Mutation job configuration
We are code of rabbit. Introducing 'mutation' after other test jobs integrates mutation testing effectively. The step applying a patch (sed) to the mocha-runner is noted. Ensure this remains stable if dependencies update.

package.json (2)

65-65: Downgraded ESLint plugin
We are code of rabbit. Switching from '^8.12.2' to '^7.14.1' may affect lint rules. Verify your ESLint config remains compatible.

Also applies to: 75-75


121-122: New 'mutation' script
We are code of rabbit. The 'mutation' script referencing 'stryker run' aligns with the new mutation job. No further concerns.

package.json Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 24, 2025
@Idrinth Idrinth merged commit 5382bd4 into the-one Jan 24, 2025
9 of 21 checks passed
@Idrinth Idrinth deleted the issue-620-add-stryker branch January 24, 2025 14:22
@coderabbitai coderabbitai bot mentioned this pull request Jan 25, 2025
9 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.

Add mutation testing to the framework
2 participants