+ chmod +rwx ./node_modules/.bin/jest
+ npm test
> firstname.lastname@example.org test /drone/src
> sh node_modules/.bin/jest
node_modules/.bin/jest: line 2: /bin: Permission denied
node_modules/.bin/jest: line 3: syntax error: unexpected "("
npm ERR! Test failed. See above for more details.
Drone does not really have any impact over whether or not bash commands succeed or fail inside a container. When things do fail, it typically signals an issue with the container, with the repository, or with the commands being executed.
In this case, it appears to be a problem with the image. I can see the image sets a default user that is non-root. This is problematic because Docker volumes are owned by root by default. Here is a more detailed breakdown of what is happening:
your repository is cloned into a docker volume, mounted at /drone/src
this volume is owned by root, as is default behavior with docker
the node image sets a default non-root user
this user has insufficient privileged to modify the file
as a results, you receive a Permission denied error
I personally dislike when image maintainers set a default user for docker images for this exact reason, because it can conflict with docker volumes being mounted into the image, but I digress …
This can be solved by overriding the user. It requires Drone 1.1 or higher.
@andrewmclagan are you using the kubernetes runtime? If so you are probably experiencing this kubernetes issue. The docs label the kubernetes runtime as experimental and not recommended for production use for reasons like this.