I am running a client application(JS) using Node.js on port 8080. At same time, I am running an Express Server using Node.js at port 3030.
Integration tests are written in Jest and Selenium. To test app, on my local machine, I open three Powershell windows and run Integration tests. It works as expected and test case passes.
Server Folder (new Terminal)
npm install
npm run start (Express.js)
Client Folder (new Terminal)
npm install
npm run start
Client Folder (new Terminal)
npm run tests
In Azure Pipeline, I created YML for image 'window-latest', However it stuck at Server Start.
powershell:
display name: Server Start
npm install
npm run start
powershell:
display name: Client Start
npm install
npm run start | npm run test (Combined in package.json)
If I remove Server Start
in Azure Pipeline, test cases that do not need server pass.
Both projects are under one repository. I use cd command in Package.json to install and start server at server location.
start:server: "cd /server/dev/ && npm install && npm run start"
start:client: "npm install && npm run start"
test: "npm run start:server | npm run start:client | jest"
npm run test, works fine on my local machine, server & client runs and test cases pass(single terminal). On Azure Pipeline, I need to Cancel task manually because the Azure pipeline task never ends. After separating scripts(Powershell), I noticed pipeline stuck on Express.js Server Start(Tested by running single and combined npm commands in YAML).
Question: How can I start localhost Express Node.js server in Azure Pipeline before starting Client?