Skip to content

Optional chaining in source not working #33

@donkeyDau

Description

@donkeyDau

I've just started using AVA and can't get my tests run when an import source function uses optional chaining.

I get this error:

  Uncaught exception in service/__test__/business/entities/updateEntity/updateEntity.test.js

  /some/path/modules/lib/src/getGraphQlError.js:2
    const message = error?.response?.errors?.[0]?.message;
                          ^

  SyntaxError: Invalid or unexpected token

  › SyntaxError: Invalid or unexpected token
  › Object._compile (node_modules/pirates/lib/index.js:99:24)

My package.json looks like:

{
  "name": "test",
  "private": true,
  "ava": {
    "require": [
      "esm",
      "@babel/register"
    ],
    "babel": true
  },
  "devDependencies": {
    "@ava/babel": "2.0.0",
    "@babel/register": "7.15.3",
    "ava": "3.15.0",
    "esm": "3.2.25"
  }
}

I'm pretty sure I'm missing something obvious but I couldn't get a grip on it so far ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions