When I use pact-js on my corporate laptop pact fil...
# pact-js
j
When I use pact-js on my corporate laptop pact file is not written to the disk although log says that it was written. I try to investigate the issue by checking sources but I get stuch in the chain of references. Can anyone give me some tips on how to investigate the issue?
m
Strange! What does the consumer test setup look like?
j
Copy code
const path = require('path');
const Pact = require('@pact-foundation/pact').Pact;

global.port = 8080;
global.provider = new Pact({
    cors: true,
    port: global.port,
    log: path.resolve(process.cwd(), 'logs', 'pact.log'),
    loglevel: 'debug',
    dir: path.resolve(process.cwd(), 'pacts'),
    spec: 2,
    pactfileWriteMode: 'update',
    consumer: 'hero-consumer',
    provider: 'hero-provider',
    host: '127.0.0.1'
});
👍 1
The cases is very strange
the same code works on my private laptop but not on corporate
👍 1
m
What does that log file contain? Can you please share the contents?
j
It is hard since access to my corporate laptop is restricted
what I can tell
is that on private laptop I have following entry
I, [2022-05-27T115408.407874 #28252] INFO -- : Updating pact for hero-provider at C:/projects/pact-js/pact-consumer/pacts/hero-consumer-hero-provider.json
and I don't see similar line on the other laptop
m
Really? How locked down is your machine?
j
super locked down, I work for bank
m
Like, you can install an nom package but you can't read a log file? How... Do you do any work?
😅 1
j
I can read
I can not use slack to send it to you
m
Right. Well thats going to make debugging this hard. Logs and she'll output are going to be the primary means here
I'd you can find a way to share that here or as a GitHub issue that would help
(I'm on mobile btw so was just trying to quickly see if I could help)
j
How about this 😀
m
And the terminal output? From that log I can't see any message saying the pact was written, so I think the test failed somewhere
j
Here you are
m
Thanks. Nothing stands out to me now sorry. We'll need a code base to reproduce I think. Ideally, a GH issue is raised with an example project that reproduces the issue, alongside that log file and full terminal output so we can properly assess
j
that will be hard
but maybe we manage to do this
any clues for now
My investigation points to ruby server that handle /pact request
but I have no idea which part of code is responsible for writing file to disk
can you point me to such file?
or if I am wrong to the place where I can check on my own what is going on ?
m
Not sure either sorry.
j
Thanks a lot for help
m
np
sorry, I wish I could have spotted it for you!
j
we I will continue and try to rise the issue if I fail
👍 1