Configuration could not be found in project when running ng test

configuration 'production' could not be found in project angular 7
ng serve --configuration
ng build --configuration not working
project does not support the build target
ng serve project could not be found in workspace.
an unhandled exception occurred: workspace config file cannot be loaded
property is not allowed angular json
angular default project

I have just upgraded to Angular 6 but now our Jenkins build is failing.

It is running this command:

ng test -c karma.conf.cli.js

But the error is:

Configuration 'karma.conf.cli.js' could not be found in project 'projectname'

However, the file in question exists in the root of the project. This command was running fine on Angular 5. Any ideas? Thanks

FYI I can reproduce the error by running the same command on the build server. We have also just upgraded Node.js to v8.11.2 (latest LTS)


In the version 6 of Angular Cli the options for the commands has changed, instead use -c, you should use --karma-config or --configuration. You can see all options here.

ng xi18n: Configuration 'xx' could not be found in project 'YYY , ng xi18n: Configuration 'xx' could not be found in project 'YYY' #11879 --​version npm WARN npm npm does not support Node.js v10.1.0 npm WARN npm You "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main​": Execute the following instruction: ng xi18n --configuration=fr  If you run ng test <pojectName> you will run test for project. If you run ng test without projectName than it will execute for all projects, but still this execution will be for each project independent. So ng test will run command from angular.json .projects["projectName"].architect.test with options provided.


I tried many and the one worked for me is as below. In your angular.json file add configuration section under test below.

    "test": {
      "builder": "@angular-devkit/build-angular:karma",
      "options": {
         ....
      },
      "configurations": {  // this will hold a different configuration
        "jenkins": {
          "karmaConfig": "./karma.conf.ci.js"
        }
      }
    },

And then while running the test use this configuration with --configuration jenkins options. So the final command will be

ng test --configuration jenkins

It will pick karma.conf.ci.js as configuration file as it set in the configuration section in angular cli configuration file and run unit test using that configuration file.

Configuration could not be found in project when running ng test , In the version 6 of Angular Cli the options for the commands has changed, instead use -c , you should use --karma-config or --configuration . Then run ng serve --configuration=staging. Observed behavior. Configuration 'staging' could not be found in project 'myProject'. With ng build it works though ( no


I had the same issue in Jenkins after Angular 6 and I solved by replacing:

ng test --single-run --browsers ChromeHeadless -cc 

with:

ng test --watch=false --browsers ChromeHeadless --code-coverage

Configuration 'production' could not be found in project 'my-lib , If you are still using version 6.0. x (or lower) you will want to use the --prod flag when building your library. And the command should be ng build --configuration=production . under the architect section look for "configurations", if you don't have any. ok if i use "ng serve --configuration=dev" command means its also taking more time – Vignesh Sep 4 '18 at 4:35 No, it shouldn't take more time. The prod environment has extra steps to minify, uglify and optimize the code for production.


Angular workspace configuration, I have just upgraded to Angular 6 but now our Jenkins build is failing. It is running this command: ng test -c karma.conf.cli.js But the error is: Configuration  Takes the name of the project, as specified in the projects section of the angular.json workspace configuration file. When a project name is not supplied, it will execute for all projects. When a project name is not supplied, it will execute for all projects.


ng test, Note that the projects section of the configuration file does not correspond exactly builds and supplies additional test-running defaults for the ng test command. $ ng test The test command requires to be run in an Angular project, but a project definition could not be found. The command "ng test" exited with 1. $ ng e2e The e2e command requires to be run in an Angular project, but a project definition could not be found.


Angular CLI, json workspace configuration file. When a project name is not supplied, it will execute for all projects. Arguments. Argument, Description. <  Angular CLI Error: The serve command requires to be run in an Angular project, but a project definition could not be found. Asked 1 year, 3 months ago. Viewed 282k times. When running the terminal commands ng server or ng serve --live-reload=true, I'm getting this issue: The serve command requires to be run in an Angular project, but a project