Home > other >  CircleCI angular test fails
CircleCI angular test fails

Time:06-05

I'm trying to configure CircleCI for CI/CD of an angular application. I am running tests on CircleCI but it always fails with the error in the picture I have attached. I'm kind of stuck since I haven't worked with CirleCI before. Can somebody help me out by taking a look at this? Or should I provide any other information that should be taken into account as well?

Thanks in advance.

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~pretest: [email protected]
npm info lifecycle [email protected]~test: [email protected]

> [email protected] test /home/circleci/project
> ng test --no-watch --no-progress --browsers=ChromeHeadlessCI

/home/circleci/project/node_modules/@angular/cli/bin/ng.js:35
  );
  ^
SyntaxError: Unexpected token )
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

npm info lifecycle [email protected]~test: Failed to exec test script
npm ERR! Linux 5.13.0-1023-aws
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.10.1
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `ng test --no-watch --no-progress --browsers=ChromeHeadlessCI`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script 'ng test --no-watch --no-progress --browsers=ChromeHeadlessCI'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the store-frontend package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng test --no-watch --no-progress --browsers=ChromeHeadlessCI
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs store-frontend
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls store-frontend
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/circleci/.npm/_logs/2022-06-03T13_46_32_311Z-debug.log


Exited with code exit status 1

Here is my config.yml

version: 2.1

orbs: 
  node: circleci/[email protected]
  browser-tools: circleci/[email protected]
jobs:
  build:
    docker:
      - image: circleci/node:7.10.1-browsers
    steps:
      - checkout
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          - v1-dependencies-
      - run: npm install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - run: npm run test

CodePudding user response:

Looks like there's a bad syntax in your ng.js script:

/home/circleci/project/node_modules/@angular/cli/bin/ng.js:35
  );
  ^
SyntaxError: Unexpected token )
  • Related