Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mikias-mohamed-sada opened this issue Nov 25, 2022 · 0 comments
Open

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

mikias-mohamed-sada opened this issue Nov 25, 2022 · 0 comments

Comments

@mikias-mohamed-sada
Copy link

mikias-mohamed-sada commented Nov 25, 2022

  • 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant