Open rolandjohann opened 1 year ago
is it possible to disable mutations with comments at JSX?
Yes, you can use // Stryker disable
comments. See https://stryker-mutator.io/docs/stryker-js/disable-mutants/#using-a--stryker-disable-comment for details.
(even better) is it possible to define rules at which context mutations should not apply?
Thanks in advance, and a big thanks to the Stryker OSS community for this tool π.
You're welcome :)
Context After introducing mutation tests at the backend with PIT we now move on to the frontend and are doing some PoCs on a small react TypeScript code base. At the component unit tests we discovered that some styling relevant JSX attributes will be mutated, which we don't care at the unit tests and affect the mutation score negatively. The comments to disable mutations for the next line are not working at JSX - even if, the component implementation would be polluted with comments to ignore certain things.
Questions
Our current approach would be to don't mutate
*.{jsx,tsx}
to prevent JSX attribute literas from being mutated. We are happy to get feedback, also from others how they incorporate mutation testing at a react implementation an their experience.Thanks in advance, and a big thanks to the Stryker OSS community for this tool π.
Stryker environment
```bash ββ @stryker-mutator/api@6.4.2 ββ @stryker-mutator/core@6.4.2 β ββ @stryker-mutator/api@6.4.2 β ββ @stryker-mutator/instrumenter@6.4.2 β ββ @stryker-mutator/util@6.4.2 ββ @stryker-mutator/instrumenter@6.4.2 β ββ @stryker-mutator/api@6.4.2 β ββ @stryker-mutator/util@6.4.2 ββ @stryker-mutator/jest-runner@6.4.2 β ββ @stryker-mutator/api@6.4.2 β ββ @stryker-mutator/util@6.4.2 ββ @stryker-mutator/typescript-checker@6.4.2 β ββ @stryker-mutator/api@6.4.2 β ββ @stryker-mutator/util@6.4.2 ββ @stryker-mutator/util@6.4.2 ```β― yarn list | grep stryker
``` ββ @happy-dom/jest-environment@9.9.2 β ββ @jest/environment@^29.4.0 β ββ @jest/fake-timers@^29.4.0 β ββ @jest/types@^29.4.0 β ββ jest-mock@^29.4.0 β ββ jest-util@^29.4.0 ββ @jest/console@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-util@^29.5.0 ββ @jest/core@29.5.0 β ββ @jest/console@^29.5.0 β ββ @jest/reporters@^29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/transform@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-changed-files@^29.5.0 β ββ jest-config@^29.5.0 β ββ jest-haste-map@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-regex-util@^29.4.3 β ββ jest-resolve-dependencies@^29.5.0 β ββ jest-resolve@^29.5.0 β ββ jest-runner@^29.5.0 β ββ jest-runtime@^29.5.0 β ββ jest-snapshot@^29.5.0 β ββ jest-util@^29.5.0 β ββ jest-validate@^29.5.0 β ββ jest-watcher@^29.5.0 ββ @jest/environment@29.5.0 β ββ @jest/fake-timers@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-mock@^29.5.0 ββ @jest/expect-utils@29.5.0 β ββ jest-get-type@^29.4.3 ββ @jest/expect@29.5.0 β ββ jest-snapshot@^29.5.0 ββ @jest/fake-timers@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-mock@^29.5.0 β ββ jest-util@^29.5.0 ββ @jest/globals@29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/expect@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-mock@^29.5.0 ββ @jest/reporters@29.5.0 β ββ @jest/console@^29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/transform@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-util@^29.5.0 β ββ jest-worker@^29.5.0 ββ @jest/schemas@29.4.3 ββ @jest/source-map@29.4.3 ββ @jest/test-result@29.5.0 β ββ @jest/console@^29.5.0 β ββ @jest/types@^29.5.0 ββ @jest/test-sequencer@29.5.0 β ββ @jest/test-result@^29.5.0 β ββ jest-haste-map@^29.5.0 ββ @jest/transform@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-haste-map@^29.5.0 β ββ jest-regex-util@^29.4.3 β ββ jest-util@^29.5.0 ββ @jest/types@29.5.0 β ββ @jest/schemas@^29.4.3 β ββ eslint-plugin-jest-dom@^4.0.2 β ββ eslint-plugin-jest@^26.9.0 β ββ @jest/transform@^29.3.1 β ββ @jest/types@27.5.1 β ββ jest-mock@^27.0.6 β ββ jest-mock@27.5.1 β β ββ @jest/types@^27.5.1 ββ @stryker-mutator/jest-runner@6.4.2 ββ @testing-library/jest-dom@5.16.5 β ββ @types/testing-library__jest-dom@^5.9.1 ββ @types/jest@29.5.1 ββ @types/testing-library__jest-dom@5.14.5 β ββ @types/jest@* ββ babel-jest@29.5.0 β ββ @jest/transform@^29.5.0 β ββ babel-preset-jest@^29.5.0 ββ babel-plugin-jest-hoist@29.5.0 ββ babel-preset-jest@29.5.0 β ββ babel-plugin-jest-hoist@^29.5.0 ββ eslint-plugin-jest-dom@4.0.3 ββ eslint-plugin-jest@26.9.0 β ββ @jest/expect-utils@^29.5.0 β ββ jest-get-type@^29.4.3 β ββ jest-matcher-utils@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-changed-files@29.5.0 ββ jest-circus@29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/expect@^29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-each@^29.5.0 β ββ jest-matcher-utils@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-runtime@^29.5.0 β ββ jest-snapshot@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-cli@29.5.0 β ββ @jest/core@^29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-config@^29.5.0 β ββ jest-util@^29.5.0 β ββ jest-validate@^29.5.0 ββ jest-config@29.5.0 β ββ @jest/test-sequencer@^29.5.0 β ββ @jest/types@^29.5.0 β ββ babel-jest@^29.5.0 β ββ jest-circus@^29.5.0 β ββ jest-environment-node@^29.5.0 β ββ jest-get-type@^29.4.3 β ββ jest-regex-util@^29.4.3 β ββ jest-resolve@^29.5.0 β ββ jest-runner@^29.5.0 β ββ jest-util@^29.5.0 β ββ jest-validate@^29.5.0 ββ jest-diff@29.5.0 β ββ jest-get-type@^29.4.3 ββ jest-docblock@29.4.3 ββ jest-each@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-get-type@^29.4.3 β ββ jest-util@^29.5.0 ββ jest-environment-jsdom@29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/fake-timers@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-mock@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-environment-node@29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/fake-timers@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-mock@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-get-type@29.4.3 ββ jest-haste-map@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-regex-util@^29.4.3 β ββ jest-util@^29.5.0 β ββ jest-worker@^29.5.0 ββ jest-leak-detector@29.5.0 β ββ jest-get-type@^29.4.3 ββ jest-matcher-utils@29.5.0 β ββ jest-diff@^29.5.0 β ββ jest-get-type@^29.4.3 ββ jest-message-util@29.5.0 β ββ @jest/types@^29.5.0 ββ jest-mock@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-pnp-resolver@1.2.3 ββ jest-regex-util@29.4.3 ββ jest-resolve-dependencies@29.5.0 β ββ jest-regex-util@^29.4.3 β ββ jest-snapshot@^29.5.0 ββ jest-resolve@29.5.0 β ββ jest-haste-map@^29.5.0 β ββ jest-pnp-resolver@^1.2.2 β ββ jest-util@^29.5.0 β ββ jest-validate@^29.5.0 ββ jest-runner@29.5.0 β ββ @jest/console@^29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/transform@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-docblock@^29.4.3 β ββ jest-environment-node@^29.5.0 β ββ jest-haste-map@^29.5.0 β ββ jest-leak-detector@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-resolve@^29.5.0 β ββ jest-runtime@^29.5.0 β ββ jest-util@^29.5.0 β ββ jest-watcher@^29.5.0 β ββ jest-worker@^29.5.0 ββ jest-runtime@29.5.0 β ββ @jest/environment@^29.5.0 β ββ @jest/fake-timers@^29.5.0 β ββ @jest/globals@^29.5.0 β ββ @jest/source-map@^29.4.3 β ββ @jest/test-result@^29.5.0 β ββ @jest/transform@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-haste-map@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-mock@^29.5.0 β ββ jest-regex-util@^29.4.3 β ββ jest-resolve@^29.5.0 β ββ jest-snapshot@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-snapshot@29.5.0 β ββ @jest/expect-utils@^29.5.0 β ββ @jest/transform@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-diff@^29.5.0 β ββ jest-get-type@^29.4.3 β ββ jest-matcher-utils@^29.5.0 β ββ jest-message-util@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-util@29.5.0 β ββ @jest/types@^29.5.0 ββ jest-validate@29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-get-type@^29.4.3 ββ jest-watcher@29.5.0 β ββ @jest/test-result@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-util@^29.5.0 ββ jest-worker@29.5.0 β ββ jest-util@^29.5.0 ββ jest@29.5.0 β ββ @jest/core@^29.5.0 β ββ @jest/types@^29.5.0 β ββ jest-cli@^29.5.0 β ββ @jest/schemas@^29.4.3 ```β― yarn list | grep jest