Hi All , iam trying to run the typescript examples...
# pact-js
c
Hi All , iam trying to run the typescript examples from the pact repo, I get the error below nyc --check-coverage --reporter=html --reporter=text-summary mocha test/*.spec.ts TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
when I fix the errors making changes to package.json and tsconfig.json , nothing runs , Iam using node 20
is there any version dependency for running the examples?
m
have you run
npm i
? We execute them on CI so they definitely run
c
yes I did
it forces me to add type: module to package , and es6 targets to tsconfig
I also need to append mocharc.json
m
what do you mean by “it forces you”?
c
I keep getting ERR_Unknown file , module cannot be imported , exports out of scope errors
I fixed all these errors from google
then nothing runs
just get err null
m
what command are you running?
c
npm install and then npm run test
👍 1
m
Just checked locally, works for me on a clean build:
what does
git status
show?
c
I have copied the typescript folder into my current project and running it there
m
ah! It’s probably requiring other configuration from the root of the Pact JS project
c
oh can that be done separately?
m
Looks like you need the
.nycrc
file
c
do u mean from the main pact-js folder?
m
yep
I’ve just pushed it up into the example folder so it’s not “self-contained”
c
ok ta let me pull it
👍 1
thanks it works now🎉
🙌 1