Git Product home page Git Product logo

Comments (12)

mefellows avatar mefellows commented on September 17, 2024

Hi @paneq, which version of Pact are you using? 2.0.x or previous? (it looks like the latest 2.0.x but just want to confirm).

Are you able to share your test code?

from pact-js.

paneq avatar paneq commented on September 17, 2024

@mefellows yes pact 2.0 . I invited you to access to https://github.com/arkency/react-example-pact/blob/master/src/App.test.js

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

Hi @paneq, I have been able to clone your repository and reproduced the issue. I'm not familiar enough in the React testing space to be able to diagnose the issue immediately. To my eye it looks good, I'll continue to investigate. Your feedback/efforts to get to the bottom would also be much appreciated.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

Hi @paneq, have you any update on this?

from pact-js.

lippea avatar lippea commented on September 17, 2024

For the first question, it's actually an error returned from addInteraction
The error is "{"isTrusted":false}". Not sure what does this mean.

from pact-js.

gcarling avatar gcarling commented on September 17, 2024

@lippea I am experiencing the { isTrusted: false } as well - if anyone has figured out what causes this, help would be greatly appreciated

from pact-js.

lippea avatar lippea commented on September 17, 2024

@gcarling sorry, couldn't help. I ended up not triggering the interaction from react component, but lower method send the request.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

That's probably the better way of testing it anyway - from the collaborating component. That being said, I'd still like to understand what's happening here.

from pact-js.

gcarling avatar gcarling commented on September 17, 2024

@paneq @lippea @mefellows I ended up solving this problem by, in my jestConfig, setting testEnvironment: 'node'. The issue was that because of jsdom setting window, pact was using the XMLHttpRequest from jsdom instead of the node http module, and changing this fixed my issue.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

Ah, thanks @gcarling - note that this is sort of documented already: https://github.com/pact-foundation/pact-js/#note-on-jest

We should make it more explicit (i'll update docs).

from pact-js.

gcarling avatar gcarling commented on September 17, 2024

Ahh wow yeah I did not see that before. I would suggest putting that in the README for the jest example at the top level: I went there but never scrolled down all the way on the main page. That would probably increase visibility for people in a similar situation.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

Have made the Jest section a bit clearer. Closing.

from pact-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.