stryker-mutator / stryker-js

Mutation testing for JavaScript and friends
https://stryker-mutator.io
Apache License 2.0
2.58k stars 249 forks source link

StrykerJS gets access denied when scanning project workspace on files used by Docker container #3914

Open JesseDocken opened 1 year ago

JesseDocken commented 1 year ago

Summary

I'm attempting to configure StrykerJS in my work's application as a proof-of-concept to validate our existing unit test suite. Currently, we use Docker images to host the backend database and RabbitMQ instances, with the data files stored inside a directory within the project (ignored by Git, of course). I've marked the directory to be ignored by StrykerJS, but when I run Stryker via npx stryker run it returns the following error message:

15:14:41 (1169) INFO ConfigReader Using stryker.conf.json
15:14:41 (1169) INFO InputFileResolver Found 855 of 1504 file(s) to be mutated.
15:14:47 (1169) INFO Instrumenter Instrumented 855 source file(s) with 51884 mutant(s)
15:14:48 (1169) INFO ConcurrencyTokenProvider Creating 15 test runner process(es).
15:14:49 (1169) ERROR Stryker Unexpected error occurred while running Stryker [Error: EACCES: permission denied, scandir '/home/<username>/<repo>/container/mongodb/data/journal'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/home/<username>/<repo>/container/mongodb/data/journal'
}
15:14:49 (1169) INFO Stryker This might be a known problem with a solution documented in our troubleshooting guide.
15:14:49 (1169) INFO Stryker You can find it at https://stryker-mutator.io/docs/stryker-js/troubleshooting/
15:14:49 (1169) INFO Stryker Still having trouble figuring out what went wrong? Try `npx stryker run --fileLogLevel trace --logLevel debug` to get some more info.

This is with Stryker version 5.6.1; our app is currently limited to using NodeJS 14.15, so we're currently unable to use the latest version of Stryker.

Stryker config

{
  "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
  "_comment": "This config was generated using 'stryker init'. Please take a look at: https://stryker-mutator.io/docs/stryker-js/configuration/ for more information",
  "packageManager": "npm",
  "reporters": [
    "html",
    "clear-text",
    "progress"
  ],
  "testRunner": "mocha",
  "coverageAnalysis": "perTest",
  "mutate": [
    "app/**/*.js"
  ],
  "ignorePatterns": [
    ".circleci",
    ".docker",
    ".vscode",
    "container",
    "contrib",
    "data",
    "docs",
    "scripts"
  ],
  "mochaOptions": {
    "spec": [ "unit/**/*.spec.js" ]
  }
}

Test runner config

None.

Stryker environment

@stryker-mutator/core@5.6.1 @stryker-mutator/api@5.6.1 @stryker-mutator/instrumenter@5.6.1 @stryker-mutator/util@5.6.1 @stryker-mutator/mocha-runner@5.6.1

mocha@4.1.0

Test runner environment

npx mocha 'unit/**/*.js'

Your Environment

software version(s)
node 14.15.0
npm 6.14.8
Operating System Ubuntu 22.04

Add stryker.log

stryker.log

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.