Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout in beforeEach #52

Open
viraptor opened this issue Feb 14, 2018 · 1 comment
Open

Timeout in beforeEach #52

viraptor opened this issue Feb 14, 2018 · 1 comment

Comments

@viraptor
Copy link

I'm trying to run the tests for a number of service. Unfortunately the first test always fails with:

1) ping "before each" hook for "replies pong to user":
  Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

This happens for the first test only - the rest of them pass correctly.
The tests are run under docker based on node:4, with hubot-test-helper between 1.5.1 and latest.

Strangely, this works just fine on local machines and then fails on a buildkite agent. Same container, same versions of dependencies.

The test is just a very simple ping:

expect = require('chai').expect

Helper = require('hubot-test-helper')
helper = new Helper('./../scripts/ping.coffee')

describe 'ping', ->
  room = null

  beforeEach ->
    # Set up the room before running the test
    room = helper.createRoom()

  afterEach ->
    # Tear it down after the test to free up the listener.
    room.destroy()

  context 'user says ping to hubot', ->
    beforeEach ->
      room.user.say 'alice', 'hubot PING'
      room.user.say 'bob',   'hubot PING'

    it 'replies pong to user', ->
      expect(room.messages).to.eql [
        ['alice', 'hubot PING']
        ['bob',   'hubot PING']
        ['hubot', 'PONG']
        ['hubot', 'PONG']
      ]

Any ideas where to look for solutions / what to try are welcome.

@viraptor
Copy link
Author

The issue is resolved by creating each helper only for each specific script, not for the script directory. I don't understand why though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant