Skip to content

Instantly share code, notes, and snippets.

@DrPep
Last active March 18, 2019 00:02
Show Gist options
  • Save DrPep/05955fe8b51735fd0b7ddbf72198b8a4 to your computer and use it in GitHub Desktop.
Save DrPep/05955fe8b51735fd0b7ddbf72198b8a4 to your computer and use it in GitHub Desktop.

Revisions

  1. DrPep revised this gist Mar 18, 2019. 1 changed file with 13 additions and 19 deletions.
    32 changes: 13 additions & 19 deletions codecept.conf.js
    Original file line number Diff line number Diff line change
    @@ -1,48 +1,42 @@
    const { spawn } = require('child-process-promise')
    const { spawn } = require('child_process')
    const waitOn = require('wait-on')
    let childProcess
    let subProcess

    exports.config = {
    tests: './test/tests/*_test.js',
    output: './output',
    helpers: {
    Puppeteer: {
    url: 'http://localhost:8080',
    show: true
    show: false,
    chrome: {
    "args": ["--no-sandbox", "--disable-setuid-sandbox", "--single-process"]
    }
    }
    },
    include: {
    I: './test/support/steps_file.js'
    },

    bootstrap: function (done) {
    let promise = spawn('./node_modules/.bin/vue-cli-service', ['serve'])
    childProcess = promise.childProcess

    console.log('[spawn] childProcess.pid: ', childProcess.pid)
    childProcess.stdout.on('data', function (data) {
    console.log('[spawn] stdout: ', data.toString())
    });

    subProcess = spawn('./node_modules/.bin/http-server', ['./dist'], {
    detached: true
    })

    waitOn({resources: ['http://localhost:8080']})
    .then(done)
    .catch(function (err) {
    handleError(err)
    console.log('[spawn] Error starting server')
    done()
    });

    promise.then(function () {
    console.log('[spawn] done!')
    }).catch(function (err) {
    console.error('[spawn] ERROR: ', err)
    });
    },

    teardown: function (done) {
    childProcess.kill('SIGTERM')
    subProcess.kill()
    done()
    },

    mocha: {},
    name: 'APP NAME'
    name: '<APP NAME GOES HERE>'
    }
  2. DrPep renamed this gist Mar 3, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. DrPep created this gist Mar 3, 2019.
    48 changes: 48 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    const { spawn } = require('child-process-promise')
    const waitOn = require('wait-on')
    let childProcess

    exports.config = {
    tests: './test/tests/*_test.js',
    output: './output',
    helpers: {
    Puppeteer: {
    url: 'http://localhost:8080',
    show: true
    }
    },
    include: {
    I: './test/support/steps_file.js'
    },

    bootstrap: function (done) {
    let promise = spawn('./node_modules/.bin/vue-cli-service', ['serve'])
    childProcess = promise.childProcess

    console.log('[spawn] childProcess.pid: ', childProcess.pid)
    childProcess.stdout.on('data', function (data) {
    console.log('[spawn] stdout: ', data.toString())
    });

    waitOn({resources: ['http://localhost:8080']})
    .then(done)
    .catch(function (err) {
    handleError(err)
    done()
    });

    promise.then(function () {
    console.log('[spawn] done!')
    }).catch(function (err) {
    console.error('[spawn] ERROR: ', err)
    });
    },

    teardown: function (done) {
    childProcess.kill('SIGTERM')
    done()
    },

    mocha: {},
    name: 'APP NAME'
    }