Failing JS unit tests should fail the build
Description
Environment
None
relates to
Activity
Show:
Sean Flanigan 6 November 2017 at 05:58
Pull request: https://github.com/zanata/zanata-platform/pull/608
Ready for Release
Details
Details
Assignee
Sean Flanigan
Sean FlaniganReporter
Sean Flanigan
Sean FlaniganLabels
Tested Version/s
None
Components
Fix versions
Affects versions
Priority

More fields
Time tracking
More fields
Time trackingCreated 6 November 2017 at 04:28
Updated 27 June 2018 at 02:14
Resolved 6 November 2017 at 06:36
According to the build log, master build #301 had a failing storybook test (later fixed by https://github.com/zanata/zanata-platform/commit/a874be9a93da0e1d1a294c60d0913df0363651a6) but was still considered a successful build.
You can trigger a similar test failure by adding this:
expect("THIS SHOULD FAIL").toEqual("something else")
to one of the tests, eg
server/zanata-frontend/src/frontend/app/components/DraggableVersionPanels/DraggableVersionPanels.test.js
Our Jenkinsfile builds use the option
maven.test.failure.ignore
because we want Maven to log and continue after failing JUnit tests, allowing Jenkins to handle them, but the javascript tests are not currently producing JUnit XML files, thus Jenkins doesn't notice the failures.Ultimately, it would be best to have Jest output a file format which Jenkins can parse (perhaps by switching to the Jenkins XUnit Plugin, or perhaps by having Jest output junit.xml), but for now we should just ensure that failing tests actually fail the build.