It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Angular 6 cli ng test command does nothing in pipelines build

I have an Angular 6 project built using the angular cli. I have the default configurations for everything and all my spec files are next to their components as per angular best practices. I followed the steps here to setup my pipeline: https://vxcompany.com/2018/10/01/bitbucket-pipelines-for-your-angular-6-apps/

The pipeline always succeeds but the ng test command doesn't do anything. I can run tests fine locally, just not on the pipeline. I also noticed that npm install is really fast, even the first time it was run before anything was cached it only took 30 seconds.

Pipeline file (our project is actually inside a folder called PushWeb inside this repo):

# You can use a Docker image from Docker Hub or your own container
# registry for your build environment.
image: atlassianlabs/docker-node-jdk-chrome-firefox

pipelines:
  default:
    - step:
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - cp -f /usr/share/zoneinfo/America/Toronto /etc/localtime # Change current time zone to Toronto Time zone
          - cd PushWeb
          - npm install
          - npm run test:ci

package.json

{
    "name": "test",
    "version": "0.0.0",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "test:ci": "ng test --watch=false"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "6.1.0",
        "@angular/cdk": "6.4.7",
        "@angular/common": "6.1.0",
        "@angular/compiler": "6.1.0",
        "@angular/core": "6.1.0",
        "@angular/forms": "6.1.0",
        "@angular/http": "6.1.0",
        "@angular/material": "6.4.7",
        "@angular/platform-browser": "6.1.0",
        "@angular/platform-browser-dynamic": "6.1.0",
        "@angular/router": "6.1.0",
        "@ngx-translate/core": "10.0.2",
        "@ngx-translate/http-loader": "3.0.1",
        "@types/jquery": "3.2.12",
        "angular-calendar": "0.26.1",
        "angular-draggable-droppable": "4.0.2",
        "core-js": "2.5.4",
        "croppie": "2.6.2",
        "date-fns": "1.29.0",
        "moment": "2.22.2",
        "ng2-daterangepicker": "2.0.12",
        "ramda": "0.25.0",
        "rxjs": "6.0.0",
        "zone.js": "0.8.26"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "0.7.0",
        "@angular/cli": "6.1.3",
        "@angular/compiler-cli": "6.1.0",
        "@angular/language-service": "6.1.0",
        "@types/jasmine": "2.8.6",
        "@types/jasminewd2": "2.0.3",
        "@types/node": "8.9.4",
        "codelyzer": "4.2.1",
        "jasmine-core": "2.99.1",
        "jasmine-spec-reporter": "4.2.1",
        "karma": "1.7.1",
        "karma-chrome-launcher": "2.2.0",
        "karma-coverage-istanbul-reporter": "2.0.0",
        "karma-jasmine": "1.1.1",
        "karma-jasmine-html-reporter": "0.2.2",
        "protractor": "5.3.0",
        "ts-node": "5.0.1",
        "tslint": "5.9.1",
        "typescript": "2.7.2"
    }
}

 Output of npm install in pipelines:

+ npm install

> node-sass@4.9.4 install /opt/atlassian/pipelines/agent/build/PushWeb/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.4/linux-x64-57_binding.node
Download complete
Binary saved to /opt/atlassian/pipelines/agent/build/PushWeb/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /root/.npm/node-sass/4.9.4/linux-x64-57_binding.node

> node-sass@4.9.4 postinstall /opt/atlassian/pipelines/agent/build/PushWeb/node_modules/node-sass
> node scripts/build.js
Binary found at /opt/atlassian/pipelines/agent/build/PushWeb/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1103 packages from 1311 contributors and audited 38332 packages in 48.333s
found 15 vulnerabilities (9 low, 6 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Output of npm run test:ci in pipelines (which takes <1s to run):

+ npm run test:ci
> portal@0.0.0 test:ci /opt/atlassian/pipelines/agent/build/PushWeb
> ng test --watch=false

Then it just goes straight into Build Teardown. Is there some step I'm missing?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,031 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you