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

Open
wants to merge 6 commits into
base: the-one
Choose a base branch
from
Open

Issue 620 add stryker #75

wants to merge 6 commits into from

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

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.
.gitignore Added entry for .stryker-tmp directory to exclude temporary files from Git tracking.
.nycrc.json Expanded the include array to include TypeScript files from src/locales/*.ts.
package.json Organised dependencies, added new ones for functionality, 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.
src/helper/language.ts Removed an unnecessary comma in the import statement for improved syntax clarity.
src/routes/include-default.ts Removed an unnecessary comma after the import statement to conform with JavaScript standards.
stryker.config.json Introduced configuration for Stryker with settings for mutation testing, reporters, and command runners.
test/helper/middleware-loader.ts Simplified error handling by removing unused dependencies and refining assertions in tests.
tsconfig.json Added .stryker-tmp/**/*.ts to include array to allow TypeScript to compile temporary test files.

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! 🐇✨


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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

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?

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