Hello folks I get this error pact-core@13.15.0: F...
# pact-js
s
Hello folks I get this error pact-core@13.15.0: Failed to initialise native module for win32-x64: Error: No native build was found for platform=win32 arch=x64 runtime=node abi=108 uv=1 libc=glibc node=18.16.0
y
1. can you try the latest version of pact-js v12 2. prior to that, are your tests failing, or are you just seeing an error? a. can you run with
LOG_LEVEL=debug
s
Tests are failing. I have done debug log level now
with 12.0.0 I do not get the error but tests fail
The tests timeout
y
have the tests passed before?
s
No first time writing these set of tests
y
then please ask a decent question, we aren’t a general support helpdesk
s
Sir I have written several tests before they passed
tried today and they are failing
Anyways I will di in
y
No first time writing these set of tests
that implies it the first time?
unless its a typo and it is mean to say not. Can you share a reproducible example. could you let us know which version it passed in, if it did before (that exact test)
If you try and delete your node_modules and lockfile and reinstall, it should use an older version of pact-js-core - I am not sure if that may solve your issue, its a side effect of some changes we have been implementing. For full details you can see the projects changelogs
s
Did not work Yousaf
m
Can you please share the setup you’re having so we can help?
s
There is us not much of a setup really 1. Following dev dependencies
"@pact-foundation/pact": "^11.0.2", "@pact-foundation/pact-node": "^10.17.7",
and a consumer test
import { Matchers, Pact} from "@pact-foundation/pact"; import { term } from "@pact-foundation/pact/src/dsl/matchers"; import chai from 'chai'; import chaiHttp from 'chai-http'; import path from "path"; import { v4 as uuidv4 } from 'uuid'; const { expect } = chai; chai.use(chaiHttp); let provider: Pact; const dynamicUUID = uuidv4(); // Generate a dynamic UUID const dynamicPath =  term({ matcher: '.*', generate: '/anyguuuid' }); beforeAll(async () => {   jest.setTimeout(120000);   provider = new Pact({     consumer: 'proxy-api-secret-store-get',     provider: 'secret-store-for-proxy-api-get',     port: 50000,     log: path.resolve('logs', 'pact.log'),     dir: path.resolve('pacts'),     logLevel: 'debug',     pactfileWriteMode: 'overwrite'   });   await provider.setup(); }); beforeEach(() => {   return provider.addInteraction({     state: 'I get credentials',     uponReceiving: 'A Request for obtaining credentials',     withRequest: {       method: 'GET',       path: dynamicPath,       headers: {         'Content-Type': 'application/json',       }     },     willRespondWith: {       status: 200,       headers: {         'Content-Type': 'application/json',       },       body:  {         id: Matchers.term({           generate: "4f2fa219-c805-4781-937c-bf3296e93cc4",           matcher: '.*'         }),         details: Matchers.term({           generate: "some string",           matcher: '.*'         }),       },     },   }); }); it('Gets Credentials from Secret Store and Returns 200', (done) => {   chai     .request("http://127.0.0.1:49999")     .get('/'+dynamicUUID)     .set('Content-Type', 'application/json')     .end((err, res) => {       expect(res.status).to.equal(200);       expect(res.body).to.deep.equal({"id": "4f2fa219-c805-4781-937c-bf3296e93cc4", "details": "some string"})       done();     }); }); afterEach(() => {   return provider.verify(); }); afterAll(async () => {   await provider.finalize(); });
node version 18.6.0
m
I just ran that example locally and it fails, but in an expected way
Copy code
chai
    .request("<http://127.0.0.1:49999>") <- this needs to point to the same thing as `port` in the `Pact` setup
Please next time, create a github project that can be cloned so we can run it out of the box.
“@pact-foundation/pact-node”: “^10.17.7",
you shouldn’t need to add this as an explicit dependency
s
I am reinstalling node modules will keep you updated. I should have changed the port in setup my bad.
apologies mate. Still does not work. To my mind its pretty straight forward. It works for other repos where I have similar tests but node modules were installed much earlier than yesterday. I am now thinking all my previous tests will fail in the pipeline where I do a new npm install
m
Can you please see if this works: https://github.com/mefellows/20230711-pact-repro
P.S. the build passes on all key OS’s: https://github.com/mefellows/20230711-pact-repro/actions/runs/5519244766/jobs/10064255645 If you can make it fail in an unexpected way we can look into it
s
my bad man it has got something to do with how my repo is structured. meaning the dev repo
thanks 1
👍 1
apologies
🙌 1
👍 1
I updgraded to 12 in my old repos and they work just fine
grrrrreat 2
y
its ok! thanks for adding the additional context. Great to know your existing projects are working fine on pact-js 12 🚀 Interesting around how the dev project is structured. Would it happen to be a mono-repo, or using anything like pnpm?
s
Will update you soon