Skip to content

start-server-and-test pre-push git hook #337

Description

@mikias-mohamed-sada
  • version: "^1.14.0"
  • platform: macOS Monterey 12.6
  • expected behavior: Close port on another terminal

I am trying to add a pre-push github hook that runs the following npm script from package.json

"scripts":{
     "start:api": "npm run config -- --environment=dev && nx run my-app:serve:development",
     "cypress:dev": "npm run config -- --environment=dev && npx nx e2e my-app-e2e",
     "pre-push-test": "start-server-and-test start:api cypress:dev"
 }

A problem arises when there is the port listening to the api server is opened on another terminal. Every time before pushing I need to make sure the port listening at 3333 is closed, if it is running on another terminal. Otherwise, I get an error along these lines after the commits are pushed.

 Error: write EPIPE
    at process.target._send (node:internal/child_process:866:20)
    at process.target.send (node:internal/child_process:739:19)
    at /Users/my-app/test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:27:31
    at new Promise (<anonymous>)
    at sendMessage (/Users/my-app/test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:19:38)
    at /Users/my-app/test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:60:27
    at Generator.next (<anonymous>)
    at fulfilled (/Users/my-app/test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'

Is there a way to avoid the above error?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions