hi,
below is my package.json script section
"test": "cd ./app/ && mocha --timeout 15000",
"build": "cd ./app && pm2 start app.js",
and below is my bitbucket-pipelines.yml file
image: node:10.15.1
pipelines: default:
- step: caches: - node
script: # Modify the commands below to build your repository.
- yarn
- yarn build
- yarn test
my pm2 has successfully configured on bitbucket pipelines
and this is below test fail which works seamlessly on my local machine with pm2 :
can we investigate on same and provide with solution on same .
how do i check whether my server is running or not and proceed with other end to end features testing like login mechanism
@matt_baker its been a while since this was posted. Did you manage to get pm2 working? Make sure that the command to start your app via pm2 and the tests happen within the same step.
I tried running an extremely minimal express.js app with pm2, and didn't run into any issues:
bitbucket-pipelines.yml
image: node:8.15.1-jessie
pipelines:
default:
- step:
script:
- npm install -g pm2
- npm install
- pm2 start server.js
- curl http://localhost:3000
server.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send("Hello World!");
});
const port = 3000;
const server = app.listen(port, () => {
console.log(`Listening on http://localhost:${port}`);
});
package.json
{
"name": "nodejs-pm2-express",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/ggatus/nodejs-pm2-express.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"homepage": "https://bitbucket.org/ggatus/nodejs-pm2-express#readme",
"dependencies": {
"express": "^4.16.4"
}
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.