I'm working on a Typescript Rest API with Express, that I run on a linux machine, and in one of my middleware in charge of uploading files, I create a folder in the public folder with a specific ID as a name.
It's working all fine until I run my tests with jest where I got this error :
EACCES: permission denied, mkdir './public/uploads/jobCVs/639c396892d8bf249f9c98c7'
From :
22 | const folderPath = `./public/uploads/jobCVs/${req.params.jobId.toString()}`;
> 23 | fs.mkdirSync(folderPath, { recursive: true });
This fs.mkdir right here.
I don't get why it is blocked just during my tests... and anyone know how to get the permission to allow the mkdir call even when running tests with jests ?
I tried solutions from this stackoverflow question : Error: EACCES: permission denied but still got the same error...
EDIT I'm working inside a Docker container, and launching the test command inside it resolved all access problems. I can do this like this but still don't get why it doesn't work locally (outside docker).