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

au jest task passes when it should fail/throw error/exit 1 #1052

Closed
michaelw85 opened this issue Feb 18, 2019 · 0 comments · Fixed by #1053
Closed

au jest task passes when it should fail/throw error/exit 1 #1052

michaelw85 opened this issue Feb 18, 2019 · 0 comments · Fixed by #1053

Comments

@michaelw85
Copy link
Contributor

I'm submitting a bug report

  • Library Version:
    Local aurelia-cli v1.0.0-beta.12

Please tell us about your environment:

  • Operating System:
    Azure Pipelines Hosted VS2017 image (Windows Server 2016)

  • Node Version:
    10.14.2

  • NPM Version:
    6.5.0

  • Browser:
    N/A

  • Language:
    TS (Bug probably lang independent)

  • Loader/bundler:
    Webpack (Bug probably occurs for any)

Current behavior:
When running au jest with a failing test cli resolves as if it passed.
Problem is located here: Line 16

if(result.numFailedTests || result.numFailedTestSuites) {
// Never takes this path because result does not contain numFailedTests
// numFailedTests is inside a results key within result
...
} else {
  cb()
}

result console.log:

{ globalConfig:
   { bail: false,
     changedFilesWithAncestor: false,
     //.....
  },
  results:
   { numFailedTestSuites: 0,
     numFailedTests: 0,
     numPassedTestSuites: 4,
     numPassedTests: 10,
     // ....

Possible solution:

// Use object destructuring to access results
jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => {
// Use results here instead of result.
}
  • What is the expected behavior?
    If a test fails the task should fail.

  • What is the motivation / use case for changing the behavior?
    Azure build pipeline proceeds while tests are failing, a unit test build step should fail when there are failing tests.

michaelw85 added a commit to michaelw85/cli that referenced this issue Feb 18, 2019
Callback always resolved successfully even when test failed
Incorrect data was accessed in result data to determine failure

Closes aurelia#1052
michaelw85 added a commit to michaelw85/cli that referenced this issue Feb 18, 2019
Callback always resolved successfully even when test failed
Incorrect data was accessed in result data to determine failure

Closes aurelia#1052
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

Successfully merging a pull request may close this issue.

1 participant