Problems with async test written in babel


This is probably me doing a WTF, but I’m trying to update some tests of somebody else’s package that is written with babel. When adding waitForPromise calls it just breaks and I don’t understand why. I’ve minified it to this:

Works in coffeescript:

describe 'javascript-processor (coffee)', ->
  beforeEach ->
    waitsForPromise ->'sample2.js').then( (e) -> editor = e)

  describe 'method', ->
    it 'should have waited long enough', ->

Borked with babel:

'use babel';
describe('javascript-processor (babel)', function() {
  let editor = null;

  beforeEach(function() {
    waitsForPromise(function() {'sample2.js').then(function(e) {
        editor = e;

  describe('method', function() {
    it('should have waited long enough', function() {

The later gives me
TypeError: Cannot read property ‘then’ of undefined
at /Applications/

timeout: timed out after 5000 msec waiting for something to happen


You should return the promise in the waitsForPromise callback: return Coffeescript does this automatically for you, by returning the last expression in a function.


Of course! Thanks!