For running my Node.js tests (which require Java) I used this configuriation:
version: 2.1
orbs:
node: circleci/node@4.7.0
jobs:
build_and_test:
docker:
- image: cimg/openjdk:17.0.2-node
resource_class: large
steps:
- checkout
- run: java --version
- run: node --version
- node/install-packages:
pkg-manager: npm
- run:
command: npm run test
name: Run tests
workflows:
validation:
jobs:
- build_and_test
As you can see I use the language variant for the OpenJDK with Node. The version checks both succeed, so Java is actually available.
However, when I spawn a process in my tests to run Java, it fails:
const java = child_process.spawn("java", parameters, spawnOptions);
if (!java.connected) {
resolve("Java not installed");
return;
}
Is there something special I have to consider when spawing processes in CircleCI or is something else required, which I haven't done yet?