nightwatch: Mocha Runner Doesn't Support Global beforeEach & afterEach (v 0.8.3)

As the below result shown, global before and after blocks ran properly, but beforeEach and afterEach blocks did not run (no console log out). It is nice if we can support it even global is not in Mocha style.

test.js

describe('google describe', function() {
    after(function(client, done) {
        client.end(function() {
            done()
        })
    })

    it('google it', function(client) {
        client
            .url('http://www.google.com')
            .pause(3000)
    })
})

globalsModule.js

module.exports = {

    before : function(done) {
        console.log('global before')
        done()
    },

    beforeEach : function(client, done) {
        // below line didn't run
        console.log('global beforeEach')
        done()
    },

    after : function(done) {
        console.log('global after')
        done()
    },

    afterEach : function(client, done) {
        // below line didn't run
        console.log('global afterEach')
        done()
    }
};

Result

global before
Starting selenium server... started - PID:  7932


  google describe
    √ google it (7943ms)


  1 passing (9s)

global after

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 8
  • Comments: 20 (1 by maintainers)

Most upvoted comments

Wow. This project is dead. 2 years for basic functionality that exists in a whole bunch of other frameworks and the functionality is not there.