Why async () transform to async function () in Jest tests?

Viewed 767

My jest test case is similar to:

test('should update state.focus', async () => {
  let component = getComponent()
  component.setState({focus: true})
  expect(component.state().focus).toEqual(true)
  component.instance().handleBlur()

  await expect(component.state().focus).toEqual(false)
})

This works fine in local dev environment. However it fails on bamboo giving the following error:

test('should update state.focus', async function () {
                                  ^^^^^
SyntaxError: missing ) after argument list

  at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
  at handle (node_modules/worker-farm/lib/child/index.js:41:8)
  at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:47:3)
  at emitTwo (events.js:106:13)

I am using jest - 20.0.3 and babel-jest 20.0.3

1 Answers
Related