Immutable solution version
Doesn't work with Jest
Complete solution
Shows how to fix doesn't work with Jest. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
[dgraham (maintainer)]: If @planetscale/database fails to import under Jest with "unexpected token" parse errors, upgrade to the 1.9.0 release or newer: it ships a CommonJS build that Jest can parse.
Steps
- [dgraham (maintainer)]: If @planetscale/database fails to import under Jest with "unexpected token" parse errors, upgrade to the 1.9.0 release or newer: it ships a CommonJS build that Jest can parse.
When to use
You are seeing this: Reported in PlanetScale: Doesn't work with Jest. Use this skill when you run into "Doesn't work with Jest".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 1.9.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
In gh:planetscale/database-js#118 (https://github.com/planetscale/database-js/issues/118), the reporter ran into this: Reported in PlanetScale: Doesn't work with Jest. The verified resolution: [dgraham (maintainer)]: If @planetscale/database fails to import under Jest with "unexpected token" parse errors, upgrade to the 1.9.0 release or newer: it ships a CommonJS build that Jest can parse.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Sr0RSM_7WdGSyIU0e72HIA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Doesn't work with Jest <span>— Vectle</span></a>