Skip to content

verifier-core not working with Jest unit tests #16

@dmitrizagidulin

Description

@dmitrizagidulin

Currently, using verifier-core in Jest unit tests is failing with an error:

Jest encountered an unexpected token

    ~/code/DCC/learner-credential-wallet/node_modules/@digitalcredentials/verifier-core/dist/index.js:4
    export { verifyCredential, verifyPresentation } from './Verify.js';
    ^^^^^^

    SyntaxError: Unexpected token 'export'

      2 | import { VerifiablePresentation, PresentationError } from '../types/presentation';
      3 | import { Credential, CredentialError } from '../types/credential';
    > 4 | import * as verifierCore from '@digitalcredentials/verifier-core';
        | ^
      5 |
      6 | export type ResultLog = {
      7 |   id: string,

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
      at Object.<anonymous> (app/lib/validate.ts:4:1)
      at Object.<anonymous> (test/verifier-core.test.ts:1:1)

I suspect something is off with the package.json / export stuff.

See the currently failing unit test on PR openwallet-foundation-labs/learner-credential-wallet#810

See also the packaging error: https://publint.dev/@digitalcredentials/verifier-core@1.0.0-beta.7

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Ready for PR Review/re-test

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions