0

we have recently just killed all our e2e tests in Teamcity (ooops) by upgrading node version.

I'm sure this is something we are able to sort out, BUT it has highlighted that Teamcity isn't set up right (or something else is a miss).

As I say all tests fail but that build step just says it exits with code 0 and carries on building successfully.

[15:53:13][Step 4/6] 51 specs, 51 failures
[15:53:13][Step 4/6] Finished in 106.981 seconds
[15:53:13][Step 4/6] 
[15:53:13][Step 4/6] closing code: null
[15:53:13][Step 4/6] Process exited with code 0

we are using protractor for the tests and running them using command line runner in the build step.

npm run teamcity-e2e

Sorry if this is quite vague, but hopefully it will mean something to someone and they can point me in the right direction :)

cheers..

-- Edit after more investigation --

I now know the problem is with my node script I created (teamcity-e2e.js) ...

const exec = require('child_process').exec;

const server = exec('live-server ./dist --port=3000 --no-browser');
const tests = exec('npm run e2e');

tests.stdout.on('data', function(data) {
  console.log(data);
});
tests.stderr.on('data', function(data) {
  console.log(data);
});
tests.on('close', function(code) {
  console.log('closing code: ' + code);
  exec('taskkill /PID ' + server.pid + ' /T /F');
});

Though I don't know what the problem is so still after help please anyone ;)

dazziep
  • 245
  • 1
  • 4
  • 16

1 Answers1

2

awesome I've fixed it :)

the quick and simple answer was my node script wasn't actually returning an exit code DOH :)

here is my fixed solution...

const exec = require('child_process').exec;

const server = exec('npm run server:test');
const tests = exec('npm run e2e');

tests.stdout.on('data', function(data) {
  console.log(data);
});
tests.stderr.on('data', function(data) {
  console.log(data);
});
tests.on('close', function(code) {
  console.log('closing code: ' + code);
  exec('taskkill /PID ' + server.pid + ' /T /F');
  process.exit(code); //here's the bad boy ;)
});
dazziep
  • 245
  • 1
  • 4
  • 16