Skip to content

fix(aries-connector): upgrade aries to credo#4153

Draft
oGranny wants to merge 1 commit intohyperledger-cacti:mainfrom
oGranny:fix-aries-connector/upgrade-aries-to-credo
Draft

fix(aries-connector): upgrade aries to credo#4153
oGranny wants to merge 1 commit intohyperledger-cacti:mainfrom
oGranny:fix-aries-connector/upgrade-aries-to-credo

Conversation

@oGranny
Copy link

@oGranny oGranny commented Mar 18, 2026

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Fixes #4090

During validation, I observed that the newer Credo packages are built for a NodeNext/ESM environment and are not compatible with the repository’s current CommonJS-based TypeScript and Jest configuration.

@LordKubaya, @RafaelAPB Could you please advise on the preferred next step?

@LordKubaya
Copy link
Contributor

LordKubaya commented Mar 18, 2026

@oGranny Hello, thanks for your contribution.

I haven't found any information on the new credo packages being incompatible with the CommonJS-based TypeScript. Also, I didn't find out about that Jest incompatibility. Could you provide references to that information?

@oGranny
Copy link
Author

oGranny commented Mar 19, 2026

Hello @LordKubaya,

Jest is currently CJS-oriented, while the Credo packages are ESM-first (.mjs entrypoints, credo-ts/askar, credo-ts/core, credo-ts/didcomm). In that context, Jest tries to execute ESM from node_modules as CJS and fails (shown below)

output when i run the tests:
FAIL  packages/cactus-plugin-ledger-connector-aries/src/test/typescript/integration/aries-setup-and-connections.test.ts
  Test suite failed to run

  Jest encountered an unexpected token

  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.

  Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

  By default "node_modules" folder is ignored by transformers.

  Here's what you can do:
  • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
  • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
  • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
  • If you need a custom transformation specify a "transform" option in your config.
  • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

  You'll find more details and examples of these config options in the docs:
  https://jestjs.io/docs/configuration
  For information about custom transformations, see:
  https://jestjs.io/docs/code-transformation

  Details:

  /home/user/cacti/node_modules/.store/@credo-ts-askar-virtual-595c4027f4/package/build/index.mjs:1
  ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { AskarModuleConfig, AskarMultiWalletDatabaseScheme } from "./AskarModuleConfig.mjs";
                                                                                    ^^^^^^

  SyntaxError: Cannot use import statement outside a module

    6 | import * as path from "node:path";
    7 | import * as os from "node:os";
  >  8 | import { AskarModule, transformSeedToPrivateJwk } from "@credo-ts/askar";
      | ^
    9 | import {
    10 |   Agent,
    11 |   InitConfig,

    at Runtime.createScriptFromCode (node_modules/.store/jest-runtime-npm-29.7.0-120fa64128/package/build/index.js:1505:14)
    at Object.<anonymous> (packages/cactus-plugin-ledger-connector-aries/src/main/typescript/plugin-ledger-connector-aries.ts:8:1)
    at Object.<anonymous> (packages/cactus-plugin-ledger-connector-aries/src/main/typescript/public-api.ts:3:1)
    at Object.<anonymous> (packages/cactus-plugin-ledger-connector-aries/src/test/typescript/integration/aries-setup-and-connections.test.ts:41:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        2.052 s
Ran all test suites matching /packages\/cactus-plugin-ledger-connector-aries\/src\/test\/typescript\/integration\/aries-setup-and-connections.test.ts/i.

credo-ts/askar, credo-ts/core and credo-ts/didcomm exports only build/index.mjs.

Jest docs ESM support is still experimental and requires ESM-aware config, including running Node with --experimental-vm-modules https://jestjs.io/docs/ecmascript-modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(aries-connector): Upgrade Aries connector to Credo packages

2 participants