const execa = require('execa')
const chalk = require('chalk')
const { kill } = require('cross-port-killer')
const settings = require('../../settings/core')

const env = Object.create(process.env)
env.BROWSER = 'none'
const startServer = execa.shell('npm run dist-server', {
  env
})

startServer.on('exit', () => {
  kill(settings.build.distServerPort || process.env.PORT)
})

startServer.stdout.on('data', data => {
  console.log(data.toString())
  if (data.toString().indexOf('Server is running at') >= 0) {
    console.log(chalk.cyan('Server is started, ready to run tests.\n'))
    const testCmd = execa.shell('npm run e2e', {
      stdio: 'inherit'
    })
    testCmd.on('exit', () => {
      startServer.kill()
    })
  }
})

@@ -262,16 +262,19 @@
 t-server
+ -s
 ', %7B%0A  e
@@ -318,16 +318,36 @@
 %0A  kill(
+process.env.PORT %7C%7C 
 settings
@@ -371,28 +371,8 @@
 Port
- %7C%7C process.env.PORT
 )%0A%7D)

fix details