No further stages was ran after test

I'm running my ci/cd for React project with GitLab. When test stages passing it's just showing the waiting icon and then falling down with timeout error. Here is how my .gitlab-ci.yml look like.

image: node:latest

    stages:
        - test 
        - build
        - deploy

    cache:
      paths:
        - build/

    before_script:
        - apt-get update -qq && apt-get install -y -qq sshpass

    test:
        stage: test
        only:
        - master
        script:
            - npm install jest jest-pnp-resolver jest-resolve
            - npm run test

    install_dependencies:
      stage: build
      only:
      - master
      script:
        - npm install --unsafe-perm node-sass
        - npm install
        # sh -c "./node_modules/.bin/eslint --ignore-path \\\"components/**/*.{scss}\\\""
        - npm run build --prod
        - cp package.json build
      artifacts:
        paths:
          - build/

    build_stage:
        stage: deploy
        only: 
        - master
        script:
            - export SSHPASS=$FTP_PASS
            - sshpass -e scp -o stricthostkeychecking=no -r /builds/andreyshedko/agroproject-ui/build/* XXX:/var/www/zapas.tech
            - echo 'connected'
            - sshpass -e ssh -o stricthostkeychecking=no XXX -p 22 'sudo sh -c "cd /var/www/zapas.tech && npm install --production --unsafe-perm=true --allow-root"'
            - sshpass -e ssh -o stricthostkeychecking=no XXX -p 22 'sudo sh -c "cd /var/www/zapas.tech && export NODE_ENV=production"'
            - echo 'deployment done'