Closed Mause closed 5 months ago
Thanks for the bug report. I've published version 1.2.1
Would you mind trying it @Mause?
Looks good now, thanks for the quick fix!
For posterity, would you mind telling me how to reproduce the error? Including node/next versions, and whether you're using turbo.
Thanks a million.
Just updated to 1.2.1
and it seems that jest
didn't like this change. Haven't checked out yet but felt as giving a warning here 😉
Thank you @SferaDev. Can you tell us more about your setup, including versions?
Sure:
"jest": "^29.7.0",
"@vercel/analytics": "^1.2.1",
"@types/jest": "^29.5.12",
"@types/react": "^18.2.56",
"react": "^18.2.0",
"next": "^14.1.0",
"@swc/core": "^1.4.2",
"@swc/jest": "^0.2.36",
Error:
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Using @swc/jest
as transform for ESM support.
Was working fine in 1.2.0 (and versions prior to that), tests stopped passing with automated workflow to update to 1.2.1
Thank you @SferaDev. I've enhanced our Next.js app and added tests, trying to reproduce this. But no luck (jest/swc have no issue parsing files). Would you mind checking https://github.com/vercel/analytics/pull/134/ and telling me how to reproduce it?
Hey @feugy, sure! Steps to repro in #134
# Install deps ignoring pnpm workspace and install ts-node to run `jest.config.ts`
pnpm --ignore-workspace install -D ts-node
pnpm test
# Tests will fail
pnpm --ignore-workspace install @vercel/analytics@1.2.0
pnpm test
# Tests will pass
Thanks for the help @SferaDev.
I could reproduce and fix it, by exporting CJS code when running on Node. however it's a bit unfair, since the docs says that we could either use CJS or ESM. I guess it's a nasty combination of jest, ts-node and node.
I'm waiting for an approver, and I'll release this.
I've released 1.2.2, please try and let me know
It's unclear if this was an intentional change?
You can see the files being missing here: https://app.renovatebot.com/package-diff?name=@vercel%2fanalytics&from=1.1.3&to=1.2.0
They are still referenced in the package.json file as well: