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

Provider tests shows result as passed even when it did not find contract file #402

Closed
5 tasks
heerasinghknp opened this issue Aug 19, 2022 · 5 comments · Fixed by #403
Closed
5 tasks

Provider tests shows result as passed even when it did not find contract file #402

heerasinghknp opened this issue Aug 19, 2022 · 5 comments · Fixed by #403
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@heerasinghknp
Copy link

Thank you for reporting a bug! We appreciate it very much. Issues are a big input into the priorities for Pact-JS development

All italic text in this template is safe to remove before submitting

Thanks again!

Software versions

Please provide at least OS and version of pact-js

  • OS: MacBook Pro (16-inch, 2021)
  • Consumer Pact library: Pact JS "version": "10.0.1"
  • Provider Pact library: e.g. pact-jvm-provider-maven_2.11 v 3.3.8
  • Node Version: node --version

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
  • I have set my log level to debug and attached a log file showing the complete request/response cycle
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Expected behaviour

when you run provider tests and it does not find the contract file, should throw an error and failed the test run.

Actual behaviour

I am using jest with pact-js and found when I try to run provider tests which has a wrong mapping with consumer contract file or contract file does not exist.
It still shows Test Suites and Tests as passed.

Steps to reproduce

Just delete the contract files and run the provider tests

How can someone else reproduce this bug?
Just delete the contract files and run the provider tests

For extra bonus points and internet karma, provide a repository, gist or reproducible code snippet so that we can test the problem.
Code sample: https://codeshare.io/j0EEQM

We recommend forking the project and modifying a relevant example in the examples folder

Relevant log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link to a gist).

@heerasinghknp heerasinghknp added the bug Indicates an unexpected problem or unintended behavior label Aug 19, 2022
@TimothyJones-DD
Copy link

How are you invoking the provider tests?

@mefellows
Copy link
Member

I checked the other day, it's definitely a bug - if the URL doesn't exist it just carries on.

@TimothyJones
Copy link
Contributor

Weird. The opposite problem is reported here #397 - probably an inconsistency

@mefellows
Copy link
Member

Yes, because they are two different sources. One is a dynamic check from the broker, and the core is deliberately erroring if nothing is found. In this case, we should have an option to allow users to "not fail if nothing found".

The URL is a direct pact source. That seems like it should just simply error if the file doesn't exist. We have some validation in this module (that is clearly not working correctly), but ultimately that should be checked in the core.

@TimothyJones
Copy link
Contributor

Ahh, makes sense.

@mefellows mefellows transferred this issue from pact-foundation/pact-js Aug 21, 2022
@mefellows mefellows transferred this issue from pact-foundation/pact-reference Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants