Jenkins pipeline doesn't recognise my Angular project

Discussão em 'Angular' iniciado por George Oneata, Outubro 20, 2024.

  1. I have a project with a more complex structure that I'm working on, like this: 'rootFolder/frontendParentFolder/actualAngularProject'

    I have a Jenkins job that tries to run the code coverage task for the angular project.

    The step that I have right now is like this:

    stage('Testing Front End') {
    steps {
    echo 'Running front end tests...'
    dir('frontendParentFolder/actualAngularProject') {
    sh 'ng test --code-coverage --watch=false'
    }
    }
    }


    The Jenkins job does checkout and build and other stuff, it obviously starts from the root of the project. When it gets to this step it says this ...

    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Testing Front End)
    [Pipeline] tool
    [Pipeline] envVarsForTool
    [Pipeline] tool
    [Pipeline] envVarsForTool
    [Pipeline] withEnv
    [Pipeline] {
    [Pipeline] echo
    Running front end tests...
    [Pipeline] dir
    Running in /home/jenkins/workspace/rootFolder/frontendParentFolder/actualAngularProject
    [Pipeline] {
    [Pipeline] sh
    [actualAngularProject] Running shell script
    + ng test --code-coverage --watch=false
    The test command requires to be run in an Angular project, but a project definition could not be found.
    [Pipeline] }
    [Pipeline] // dir
    [Pipeline] }
    [Pipeline] // withEnv
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // withEnv
    [Pipeline] }


    I tried also mentioning the name of the project like sh

    ng test actualAngularProject --code-coverage --watch=false

    But I still get the same thing.

    I tried to install the NPM plugin, but I didn't know how to use it and didn't find a proper example for it.

    I have:

    Jenkins ver. 2.222.3;
    Angular CLI: 8.3.18;
    Node: 12.13.0;
    OS: linux x64


    If I try to run the same command from CLI, it works. What could be the reason for this?

    Continue reading...

Compartilhe esta Página