Cannot test "async" even when set it to node version 8

I keep getting this error:

> coinplan@0.0.0 test /home/circleci/coinplan
> mocha "src/server/test/**/*.js" --exit
	mocha.beforeEach(async () => {
SyntaxError: Unexpected token (

This is my config.yml file

version: 2
        version: 8.2.0
          COINPLAN_DB_HOST: localhost
          COINPLAN_DB_PORT: 5432
          COINPLAN_TOKEN_SECRET: circle
          COINPLAN_SERVER_PORT: 3000

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at
        version: 9.6
          COINPLAN_DB_TEST_DATABASE: circle_ci_test
          COINPLAN_DB_PASSWORD: test
          COINPLAN_DB_USER: test

    working_directory: ~/coinplan

      - checkout

      # Download and cache dependencies
      - restore_cache:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - save_cache:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: npm run test
      - run: npm run lint

Please supply your config as a formatted block of text, not an image. Images are not compatible with clipboards, search engines and screen-readers, and so make it harder to help you. More info here.

Ideally, format your exception as code as well. There are several unformatted lines in your post. The code formatting tool looks like </> in the toolbar.

Thank you for your review. I updated the text. Could you please take a look?

I don’t use Node. However, I’d guess that the parser doesn’t recognise the construct you’ve used, and I’d wonder if you’re using an earlier version of the Node binary. Try --version or similar to check the version you’re using. You can get an SSH session on a failed build to try some things at the console.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.