Nightwatch tests don't exit step upon success

Hey all, I’m running into an issue in which my test step in my pipeline is running indefinitely until timeout regardless of termination of the step. If tests pass, the step should succeed and move on, but that doesn’t happen and it just hangs once things are done.

Here’s my gitlab-ci file:

  - project: 'foo/definition'
    file: 'build.yml'

  - build
  - test

  extends: .build_image

  stage: test
    - cd /code
    - yarn run test --tag wip
    - exit 0

The test step is running tests within Nightwatch, an end-to-end testing framework. I’ve even included exit 0 at the end of the script section, but that doesn’t work.

Anyone have ideas of why this is happening and how to solve it?

I found the answer. We were importing an unused dependency that called spawnSync which spins up a child process. That child process handles SIGTERMs and doesn’t actually close until the process has fully closed; this explains why the step was not terminating even after an exit 0. We had to remove the dependency, and all was fixed.