Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven build won't fail when karma test fails #613

Closed
xiangzhimeng opened this issue Jun 18, 2017 · 12 comments
Closed

Maven build won't fail when karma test fails #613

xiangzhimeng opened this issue Jun 18, 2017 · 12 comments

Comments

@xiangzhimeng
Copy link

By default if karma test fail the maven build should fail right? But my maven build was successful even if I made the karma test failed.

@eirslett
Copy link
Owner

It will fail the build if your karma tests fail. You might have set up the configuration wrong somehow.

@xiangzhimeng
Copy link
Author

Thank you for the quick response. I tried to run a failed java junit test, it caused the maven build to fail. but karma test fail still will not make the maven build to fail.

tests karma

this is my karma set up

@cgaege
Copy link

cgaege commented Jun 26, 2017

I'm running into the same problem. Maven build status is success although a karma test failed.

pom.xml

<execution>
	<id>javascript tests</id>
	<goals>
		<goal>karma</goal>
	</goals>
</execution>

Maven console output:

`[ERROR] There are test failures.
Failed to run task: 'karma start karma.conf.js' failed.
com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'karma start karma.conf.js' failed.
at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63)
at com.github.eirslett.maven.plugins.frontend.mojo.KarmaRunMojo.execute(KarmaRunMojo.java:32)
at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29)
at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
... 24 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
... 27 more

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:45 min
[INFO] Finished at: 2017-06-26T11:37:41+02:00
[INFO] Final Memory: 13M/241M
[INFO] --------`

@eirslett
Copy link
Owner

Are you using a recent version of Maven?

@cgaege
Copy link

cgaege commented Jun 26, 2017

Maven version is 3.3.9

@eirslett
Copy link
Owner

Can you try git cloning this repository, do some fiddling with https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/example%20project/src/test/javascript/squareSpec.js so the test fails? (maybe replace 9 with 8 in the source code)

The expected result then would be that the whole build fails?

@hansanghoon
Copy link

Also experiencing similar problem. I'm using create-react-app and configured to run npm test. I purposely put fail test, but build success. I saw somewhere to use haltOnFailure but that does nothing.

<plugin>
	<groupId>com.github.eirslett</groupId>
	<artifactId>frontend-maven-plugin</artifactId>
	<version>1.4</version>
	<configuration>
		<workingDirectory>src/main/app</workingDirectory>
		<installDirectory>.mvn</installDirectory>
		<environmentVariables>
			<CI>true</CI>
		</environmentVariables>
		<check>
			<haltOnFailure>true</haltOnFailure>
		</check>
	</configuration>
	<executions>
		<execution>
			<id>Install Node and NPM</id>
			<goals>
				<goal>install-node-and-npm</goal>
			</goals>
			<configuration>
				<nodeVersion>v6.10.3</nodeVersion>
			</configuration>
		</execution>

		<execution>
			<id>npm install</id>
			<goals>
				<goal>npm</goal>
			</goals>
			<configuration>
				<arguments>install</arguments>
			</configuration>
		</execution>

		<execution>
			<id>npm test</id>
			<goals>
				<goal>npm</goal>
			</goals>
			<phase>test</phase>
			<configuration>
				<arguments>test</arguments>
			</configuration>
		</execution>

		<execution>
			<id>npm run build</id>
			<goals>
				<goal>npm</goal>
			</goals>
			<configuration>
				<arguments>run build</arguments>
			</configuration>
		</execution>
	</executions>
</plugin>
2017-06-27 10:53:36.896  INFO 63491 --- [       Thread-6] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- frontend-maven-plugin:1.4:npm (npm test) @ ====deleted==== ---
[INFO] Running 'npm test' in ===path deleted===
[INFO] 
[INFO] > app@0.2.0 test ===path deleted===
[INFO] > react-scripts test --env=jsdom
[INFO] 
[ERROR]  FAIL  src/modules/contactus/ContactUs.test.js
[ERROR]   ● contains 8 people
[ERROR] 
[ERROR]     expect(received).toHaveLength(length)
[ERROR]     
[ERROR]     Expected value to have length:
[ERROR]       9
[ERROR]     Received:
===deleted===
[ERROR]     received.length:
[ERROR]       8
[ERROR]       
[ERROR]       at Object.<anonymous>.it (src/modules/contactus/ContactUs.test.js:12:44)
[ERROR]       at Promise.resolve.then.el (node_modules/p-map/index.js:42:16)
[ERROR]       at process._tickCallback (internal/process/next_tick.js:109:7)
[ERROR] 
[ERROR]  PASS  src/modules/App.test.js
[ERROR] 
[ERROR] Test Suites: 1 failed, 1 passed, 2 total
[ERROR] Tests:       1 failed, 3 passed, 4 total
[ERROR] Snapshots:   0 total
[ERROR] Time:        1.904s
[ERROR] Ran all test suites.
[ERROR] npm ERR! Test failed.  See above for more details.
[ERROR] There are test failures.
Failed to run task: 'npm test' failed.
com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'npm test' failed.
	at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63)
	at com.github.eirslett.maven.plugins.frontend.mojo.NpmMojo.execute(NpmMojo.java:62)
	at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
	at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
	at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29)
	at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
	... 24 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
	... 27 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.658 s
[INFO] Finished at: 2017-06-27T10:53:40+09:00
[INFO] Final Memory: 29M/699M
[INFO] ------------------------------------------------------------------------

➜ mvn --version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T04:39:06+09:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"

@cgaege
Copy link

cgaege commented Jun 27, 2017

I cloned this repository and changed squareSpec.js to provoke a build failure:
expect(square(3)).toBe(8); // provoke a build failure

The failed karma test is recognized during the build but it doesn't lead to a maven build failure.

[INFO] [INFO] Running 'karma start src/test/javascript/karma.conf.ci.js' in C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] Executing command line [C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe, C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node_modules\karma\bin\karma, start, src/test/javascript/karma.conf.ci.js]
[INFO] [INFO] �[32m27 06 2017 09:09:29.611:INFO [karma]: �[39mKarma v1.3.0 server started at http://localhost:9876/
[INFO] [INFO] �[32m27 06 2017 09:09:29.617:INFO [launcher]: �[39mLaunching browser PhantomJS with unlimited concurrency
[INFO] [INFO] �[32m27 06 2017 09:09:29.628:INFO [launcher]: �[39mStarting browser PhantomJS
[INFO] [INFO] �[32m27 06 2017 09:09:32.023:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: �[39mConnected on socket /#l4rhW7GzQLDTZjGeAAAA with id 45572805
[INFO] [INFO] PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
[INFO] [INFO] �[1A�[2KPhantomJS 2.1.1 (Windows 8 0.0.0) The square function should square a number FAILED
[INFO] [INFO] Expected 9 to be 8.
[INFO] [INFO] src/test/javascript/squareSpec.js:3:31
[INFO] [INFO] loaded@http://localhost:9876/context.js:151:17
[INFO] [INFO] PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 1 of 1 (1 FAILED) (0 secs / 0.007 secs)
[INFO] [INFO] �[1A�[2KPhantomJS 2.1.1 (Windows 8 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.004 secs / 0.007 secs)
[INFO] [ERROR] There are test failures.
[INFO] Failed to run task: 'karma start src/test/javascript/karma.conf.ci.js' failed.
[INFO] com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'karma start src/test/javascript/karma.conf.ci.js' failed.
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.KarmaRunMojo.execute(KarmaRunMojo.java:32)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[INFO] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:606)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
[INFO] ... 24 more
[INFO] Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
[INFO] at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
[INFO] ... 27 more
[INFO] [INFO]
[INFO] [INFO] --- frontend-maven-plugin:1.5-SNAPSHOT:npm (npm-pre-integration-test) @ example ---
[INFO] [DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@60b99e4c]
[INFO] [DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm' with basic configurator -->
[INFO] [DEBUG] (f) arguments = run pre-test
[INFO] [DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[INFO] [DEBUG] (f) project = MavenProject: com.github.eirslett:example:0 @ C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\pom.xml
[INFO] [DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@24b80637
[INFO] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@2da017b6
[INFO] [DEBUG] (f) skipTests = false
[INFO] [DEBUG] (f) testFailureIgnore = false
[INFO] [DEBUG] (f) workingDirectory = C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm {execution: npm-pre-integration-test}
[INFO] [DEBUG] -- end configuration --
[INFO] [INFO] Running 'npm run pre-test' in C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] Executing command line [C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe, C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js, run, pre-test]
[INFO] [INFO]
[INFO] [INFO] > example@0.0.1 pre-test C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [INFO] > echo pre-integration-test-success
[INFO] [INFO]
[INFO] [INFO] pre-integration-test-success
[INFO] [DEBUG] Exit value 0
[INFO] [INFO]
[INFO] [INFO] --- frontend-maven-plugin:1.5-SNAPSHOT:npm (npm-integration-test-failSafeTest) @ example ---
[INFO] [DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@60b99e4c]
[INFO] [DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm' with basic configurator -->
[INFO] [DEBUG] (f) arguments = run test
[INFO] [DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[INFO] [DEBUG] (f) project = MavenProject: com.github.eirslett:example:0 @ C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\pom.xml
[INFO] [DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@24b80637
[INFO] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@2da017b6
[INFO] [DEBUG] (f) skipTests = false
[INFO] [DEBUG] (f) testFailureIgnore = true
[INFO] [DEBUG] (f) workingDirectory = C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm {execution: npm-integration-test-failSafeTest}
[INFO] [DEBUG] -- end configuration --
[INFO] [INFO] Running 'npm run test' in C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] Executing command line [C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe, C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js, run, test]
[INFO] [INFO]
[INFO] [INFO] > example@0.0.1 test C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [INFO] > return 1
[INFO] [INFO]
[INFO] [ERROR] Der Befehl "return" ist entweder falsch geschrieben oder
[INFO] [ERROR] konnte nicht gefunden werden.
[INFO] [ERROR]
[INFO] [ERROR] npm ERR! Windows_NT 10.0.14393
[INFO] [ERROR] npm ERR! argv "C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe" "C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js" "run" "test"
[INFO] [ERROR] npm ERR! node v4.6.0
[INFO] [ERROR] npm ERR! npm v2.15.9
[INFO] [ERROR] npm ERR! code ELIFECYCLE
[INFO] [ERROR] npm ERR! example@0.0.1 test: return 1
[INFO] [ERROR] npm ERR! Exit status 1
[INFO] [ERROR] npm ERR!
[INFO] [ERROR] npm ERR! Failed at the example@0.0.1 test script 'return 1'.
[INFO] [ERROR] npm ERR! This is most likely a problem with the example package,
[INFO] [ERROR] npm ERR! not with npm itself.
[INFO] [ERROR] npm ERR! Tell the author that this fails on your system:
[INFO] [ERROR] npm ERR! return 1
[INFO] [ERROR] npm ERR! You can get information on how to open an issue for this project with:
[INFO] [ERROR] npm ERR! npm bugs example
[INFO] [ERROR] npm ERR! Or if that isn't available, you can get their info via:
[INFO] [ERROR] npm ERR!
[INFO] [ERROR] npm ERR! npm owner ls example
[INFO] [ERROR] npm ERR! There is likely additional logging output above.
[INFO] [ERROR]
[INFO] [ERROR] npm ERR! Please include the following file with any support request:
[INFO] [ERROR] npm ERR! C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\npm-debug.log
[INFO] [ERROR] There are test failures.
[INFO] Failed to run task: 'npm run test' failed.
[INFO] com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'npm run test' failed.
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.NpmMojo.execute(NpmMojo.java:62)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[INFO] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:606)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
[INFO] ... 24 more
[INFO] Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
[INFO] at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
[INFO] ... 27 more
[INFO] [INFO]
[INFO] [INFO] --- frontend-maven-plugin:1.5-SNAPSHOT:npm (npm-integration-test-failOnError) @ example ---
[INFO] [DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@60b99e4c]
[INFO] [DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm' with basic configurator -->
[INFO] [DEBUG] (f) arguments = run test
[INFO] [DEBUG] (f) failOnError = false
[INFO] [DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[INFO] [DEBUG] (f) project = MavenProject: com.github.eirslett:example:0 @ C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\pom.xml
[INFO] [DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@24b80637
[INFO] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@2da017b6
[INFO] [DEBUG] (f) skipTests = false
[INFO] [DEBUG] (f) testFailureIgnore = false
[INFO] [DEBUG] (f) workingDirectory = C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm {execution: npm-integration-test-failOnError}
[INFO] [DEBUG] -- end configuration --
[INFO] [INFO] Running 'npm run test' in C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] Executing command line [C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe, C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js, run, test]
[INFO] [INFO]
[INFO] [INFO] > example@0.0.1 test C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [INFO] > return 1
[INFO] [INFO]
[INFO] [ERROR] Der Befehl "return" ist entweder falsch geschrieben oder
[INFO] [ERROR] konnte nicht gefunden werden.
[INFO] [ERROR]
[INFO] [ERROR] npm ERR! Windows_NT 10.0.14393
[INFO] [ERROR] npm ERR! argv "C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe" "C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js" "run" "test"
[INFO] [ERROR] npm ERR! node v4.6.0
[INFO] [ERROR] npm ERR! npm v2.15.9
[INFO] [ERROR] npm ERR! code ELIFECYCLE
[INFO] [ERROR] npm ERR! example@0.0.1 test: return 1
[INFO] [ERROR] npm ERR! Exit status 1
[INFO] [ERROR] npm ERR!
[INFO] [ERROR] npm ERR! Failed at the example@0.0.1 test script 'return 1'.
[INFO] [ERROR] npm ERR! This is most likely a problem with the example package,
[INFO] [ERROR] npm ERR! not with npm itself.
[INFO] [ERROR] npm ERR! Tell the author that this fails on your system:
[INFO] [ERROR] npm ERR! return 1
[INFO] [ERROR] npm ERR! You can get information on how to open an issue for this project with:
[INFO] [ERROR] npm ERR! npm bugs example
[INFO] [ERROR] npm ERR! Or if that isn't available, you can get their info via:
[INFO] [ERROR] npm ERR!
[INFO] [ERROR] npm ERR! npm owner ls example
[INFO] [ERROR] npm ERR! There is likely additional logging output above.
[INFO] [ERROR]
[INFO] [ERROR] npm ERR! Please include the following file with any support request:
[INFO] [ERROR] npm ERR! C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\npm-debug.log
[INFO] [ERROR] There are test failures.
[INFO] Failed to run task: 'npm run test' failed.
[INFO] com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'npm run test' failed.
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.NpmMojo.execute(NpmMojo.java:62)
[INFO] at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[INFO] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:606)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
[INFO] ... 24 more
[INFO] Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO] at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
[INFO] at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
[INFO] at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
[INFO] ... 27 more
[INFO] [INFO]
[INFO] [INFO] --- frontend-maven-plugin:1.5-SNAPSHOT:npm (npm-post-integration-test) @ example ---
[INFO] [DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@60b99e4c]
[INFO] [DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm' with basic configurator -->
[INFO] [DEBUG] (f) arguments = run post-test
[INFO] [DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[INFO] [DEBUG] (f) project = MavenProject: com.github.eirslett:example:0 @ C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\pom.xml
[INFO] [DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@24b80637
[INFO] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@2da017b6
[INFO] [DEBUG] (f) skipTests = false
[INFO] [DEBUG] (f) testFailureIgnore = true
[INFO] [DEBUG] (f) workingDirectory = C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.5-SNAPSHOT:npm {execution: npm-post-integration-test}
[INFO] [DEBUG] -- end configuration --
[INFO] [INFO] testFailureIgnore property is ignored in non test phases
[INFO] [INFO] Running 'npm run post-test' in C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [DEBUG] Executing command line [C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node.exe, C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project\node\node_modules\npm\bin\npm-cli.js, run, post-test]
[INFO] [INFO]
[INFO] [INFO] > example@0.0.1 post-test C:\tmp\frontend-maven-plugin\frontend-maven-plugin\target\it\example project
[INFO] [INFO] > echo post-integration-test-success
[INFO] [INFO]
[INFO] [INFO] post-integration-test-success
[INFO] [DEBUG] Exit value 0
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 04:01 min
[INFO] [INFO] Finished at: 2017-06-27T09:09:38+02:00
[INFO] [INFO] Final Memory: 11M/241M
[INFO] [INFO] ------------------------------------------------------------------------

@batmat
Copy link

batmat commented Jun 27, 2017

Isn't this because failOnError has a default value of false?

BTW, I'm considering filing this as a dedicated issue to at least discuss this. This seems like a pretty dangerous default? I mean, who would want his build to not fail by default and be aware of it when something goes wrong?

I'm genuinely curious if there's a rationale behind this, or this is just because (which I could understand) this was initially like this and so it was decided to not change the behaviour?

@eirslett
Copy link
Owner

Wow, that's definitely a regression. Fail on error must be true by default, from the plugin's side.

@eirslett
Copy link
Owner

@jcarsique it appears some people are having problems with the plugin not failing as expected after this change: #572 How do you suggest it should be fixed so that your use case is still valid, but when people run karma tests, the build fails when unit tests fail?

@cgaege
Copy link

cgaege commented Jul 20, 2017

@eirslett Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants