Open codehan-de opened 5 years ago
You could try to use the npm mojo, and npm run-script etc
instead?
You could try to use the npm mojo, and
npm run-script etc
instead?
Can you be more precise? How should my current configuration be adjusted?
<execution>
<id>run karma tests</id>
<goals>
<goal>npm</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>run-script run-tests-via-angular</arguments>
</configuration>
</execution>
package.json:
{
"scripts": {
"run-scripts-via-angular": "angular-ci some-karma-command"
}
}
<execution> <id>run karma tests</id> <goals> <goal>npm</goal> </goals> <phase>test</phase> <configuration> <arguments>run-script run-tests-via-angular</arguments> </configuration> </execution>
package.json:
{ "scripts": { "run-scripts-via-angular": "angular-ci some-karma-command" } }
It does not work that way either. Still the same error.
What happens then, if you run npm run-script run-scripts-via-angular
directly on the command line (without maven?)
Maybe this works: angular/angular-cli#10703 (comment)
If I do: ng test --karma-config karma.conf.js this error message occurs:
[ERROR] Project 'karma.conf.js' does not support the 'test' target. [ERROR] Error: Project 'karma.conf.js' does not support the 'test' target.
<execution>
<id>test</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run test --karma-config karma.conf.js</arguments>
</configuration>
</execution>
The new angular Client needs project name if you override the default karma configuration. so you've to run test like this:
ng test my-app --karma-config karma.conf.ci.js
So to run the same command using npm we would need command like this:
npm test -- my-app --karma-config karma.conf.ci.js
[Notice: I added --
after npm test
command, because it allows us to include package specific arguments (here it is --karma-config) ]
<execution>
<id>run karma tests</id>
<goals>
<goal>npm</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>test -- my-app --karma-config karma.conf.ci.js</arguments>
</configuration>
</execution>
When I run mvn install within an Angular project, I get the following error messages when executing the unit tests:
And some lines below
I use the frontend-maven-plugin in the version 1.7.6 and have it inserted like this in my pom.xml.
My karma.conf.js looks like this:
My karma.conf.ci.js like this:
I use the following versions of the packages:
Angular: "@ angular-devkit / build-angular": "^0.12.4", "@angular / cli": "^7.3.9", "@angle / compiler-cli": "7.2.0", "@angular / core": "7.2.0", "@ angular-devkit / architect": "^0.13.9", "@ angular-devkit / build-optimizer": "^0.13.9", "@ angular-devkit / build-webpack": "^0.13.9", "@ angular-devkit / core": "^7.3.9",
Karma "karma": "^1.7.1", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.4.3", "karma-firefox-launcher": "^1.0.1", "karma-jasmine": "^1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "karma-phantomjs-launcher": "^1.0.4", "karma mocha reporter": "^2.2.5", "karma-webpack": "^3.0.5",
Jasmine "@ types / jasmine": "2.5.45", "jasmine-core": "^2.99.1", "jasmine-spec-reporter": "~4.1.0",
Java Java version: 1.8.0_201
Maven Apache Maven 3.6.1
Operating system MacOS Mojave (Version 10.14.5)
IDE Visual Studio Code
What am I doing wrong?