forked from SmartDropLabs/smartdrop-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
22 lines (22 loc) · 1.26 KB
/
Copy pathjest.config.js
File metadata and controls
22 lines (22 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Several of @stellar/stellar-sdk's own dependencies (@noble/hashes,
// uint8array-extras, ...) publish ESM-only ("type": "module"). Node
// resolves these fine natively via package.json `exports`, but Jest's
// default config ignores all of node_modules for transformation, so it
// hits raw `import`/`export` syntax and fails with "Cannot use import
// statement outside a module" / "Unexpected token 'export'". Rather than
// naming each ESM-only package individually (fragile as the SDK's own
// dependencies change), un-ignore its whole private dependency tree so
// babel.config.js can transform whichever ones need it.
module.exports = {
// @noble/hashes, @noble/ed25519, and uint8array-extras (transitive
// dependencies of @stellar/stellar-sdk, some hoisted to the top level,
// some nested under the SDK's own node_modules) are ESM-only. Anchored at
// ^ deliberately: some of these live two node_modules/ segments deep
// (node_modules/@stellar/stellar-sdk/node_modules/@noble/...), and an
// unanchored lookahead gets re-tried starting from the *second*
// node_modules/ occurrence too, which defeats it. Anchoring makes the
// lookahead scan the whole path exactly once.
transformIgnorePatterns: [
"^(?!.*(@noble|uint8array-extras)).*node_modules.*",
],
};