Search code examples
unit-testingelectronava

Ava and permissions with docker volume folder on electron project


My project is contained from the following files with respective permissions:

-rw-r--r--   1 pcmagas pcmagas    761 Νοέ  20 18:08 .compilerc
-rw-rw-r--   1 pcmagas pcmagas   1034 Νοέ  23 19:11 docker-compose.yml
-rw-rw-r--   1 pcmagas pcmagas    334 Νοέ  20 22:32 docker-entrypoint.sh
-rw-rw-r--   1 pcmagas pcmagas    716 Νοέ  20 22:13 Dockerfile
-rw-rw-r--   1 pcmagas pcmagas     67 Νοέ  23 22:53 .dockerignore
drwxrwxr-x   2 pcmagas pcmagas   4096 Δεκ  28 18:55 dummy_src
-rw-r--r--   1 pcmagas pcmagas    216 Νοέ  20 18:05 .eslintrc
drwxrwxr-x   9 pcmagas pcmagas   4096 Δεκ  31 14:34 .git
-rw-r--r--   1 pcmagas pcmagas     35 Νοέ  23 22:53 .gitignore
-rw-rw-r--   1 pcmagas pcmagas    127 Νοέ  23 19:06 .gitmodules
drwxrwxr-x 686 pcmagas pcmagas  36864 Δεκ  31 14:34 node_modules
-rw-rw-r--   1 pcmagas pcmagas   1598 Δεκ  31 14:34 package.json
-rw-rw-r--   1 pcmagas pcmagas 308707 Δεκ  31 14:34 package-lock.json
drwxrwxr-x   4 pcmagas pcmagas   4096 Δεκ  30 17:58 src
drwxrwxr-x   3 pcmagas pcmagas   4096 Νοέ  23 19:06 submodules
drwxrwxr-x   2 pcmagas pcmagas   4096 Δεκ   9 15:38 test
-rw-rw-r--   1 pcmagas pcmagas    348 Δεκ   7 18:55 test.js
drwxr-xr-x   3 root    root      4096 Νοέ  23 19:13 volumes
drwxrwxr-x   2 pcmagas pcmagas   4096 Νοέ  23 21:43 .vscode

And inside test folder I have the following test file:

import test from ava;

test('true' t => { t.pass("Hardcoded passing test in order to make the ava run") });

And I have configured ava like that bases upon: https://spectrum.chat/?t=d5e89afe-9a3c-4222-a5c6-d6322eb5fcec) and the stackoverflow question: Ava split tests Into multiple files

"ava": {
    "files": [
      "./test",
      "!./volumes",
      "!./submodules"
    ],
    "sources": "./src/**/*.{js,jsx}"
  },

But when I run the tests I get the following error:

> custom_xmpp@1.0.0 test /home/pcmagas/Kwdikas/master_thesis/custom_xmpp
> ava


⠋ glob error { [Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__/helpers']
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path:
   '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__/helpers' }
glob error { [Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__']
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path:
   '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__' }
glob error { [Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/test/helpers']
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path:
   '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/test/helpers' }
⠙ ✖ Internal errorglob error { [Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/test']
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path:
   '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/test' }


  ✖ Internal error
  Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__/helpers'
  Error: EACCES: permission denied, scandir '/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/volumes/openfire/__tests__/helpers'
      at handlePaths (/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/node_modules/ava/lib/ava-files.js:13:18)
      at AvaFiles.findTestHelpers (/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/node_modules/ava/lib/ava-files.js:144:10)
      at emittedRun.then.then.precompilation (/home/pcmagas/Kwdikas/master_thesis/custom_xmpp/node_modules/ava/api.js:151:9)

npm ERR! Test failed.  See above for more details.

What I have done wrong?


Solution

  • Unfortunately AVA also looks for helper files. You currently can't configure these directory patterns. However if you disable AVA's compilation of test and helper files the problem should go away. See https://github.com/avajs/ava/blob/master/docs/recipes/babel.md#disable-avas-babel-pipeline.