Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors during tests run #1098

Closed
mmatteo23 opened this issue Jan 9, 2023 · 1 comment · Fixed by #1101
Closed

Errors during tests run #1098

mmatteo23 opened this issue Jan 9, 2023 · 1 comment · Fixed by #1101
Labels
bug Something isn't working

Comments

@mmatteo23
Copy link
Contributor

Bug severity
2

Describe the bug
When you clone the repo and run the tests some of them fail.

To Reproduce
Steps to reproduce the behaviour:

  1. git clone git@github.com:uport-project/veramo.git
  2. cd veramo
  3. yarn install
  4. yarn bootstrap
  5. yarn build
  6. yarn test

Expected behaviour
All tests should pass.

Details
This is my yarn test output:

yarn run v1.22.19
$ jest --config=jest.config.json
 PASS  packages/credential-w3c/src/__tests__/message-handler.test.ts (16.435 s)
 PASS  packages/data-store-json/src/__tests__/data-store-orm-json.test.ts (6.931 s)
(node:1280) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1281) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  packages/data-store/src/__tests__/data-store-orm.test.ts (27.641 s)
(node:1287) V8: /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ganache/dist/node/0.js:2 Linking failure in asm.js: Unexpected stdlib member
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  packages/utils/src/__tests__/credential-utils.test.ts (6.009 s)
(node:1305) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 FAIL  packages/did-provider-ion/__tests__/ion-did-provider.test.ts (36.979 s)
  ● @veramo/did-provider-ion › should add key

    TypeError: Failed to parse URL from /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/argon2-browser/dist/argon2.wasm



  ● @veramo/did-provider-ion › should add key

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      54 |   })
      55 |
    > 56 |   it('should add key', async () => {
         |   ^
      57 |     // This DID is known in ION, hence no anchoring
      58 |     const identifier: IIdentifier = await agent.didManagerCreate(existingDidConfig(false, 'did1-test2', PRIVATE_DID1_KEY_HEX))
      59 |     expect(identifier.alias).toEqual('did:ion:EiCprjAMfWpp7zYXDZV2TGNDV6U4AEBN2Jr6sVsuzL7qhA')

      at packages/did-provider-ion/__tests__/ion-did-provider.test.ts:56:3
      at Object.<anonymous> (packages/did-provider-ion/__tests__/ion-did-provider.test.ts:40:1)

  ● @veramo/did-provider-ion › should remove identifier

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      167 |   })
      168 |
    > 169 |   it('should remove identifier', async () => {
          |   ^
      170 |     const identifier: IIdentifier = await agent.didManagerCreate(existingDidConfig(false, 'remove-test', PRIVATE_DID4_KEY_HEX))
      171 |
      172 |     expect(identifier).toBeDefined()

      at packages/did-provider-ion/__tests__/ion-did-provider.test.ts:169:3
      at Object.<anonymous> (packages/did-provider-ion/__tests__/ion-did-provider.test.ts:40:1)

 PASS  packages/did-resolver/src/__tests__/integration.test.ts (9.104 s)
 PASS  packages/did-comm/src/__tests__/trust-ping-message-handler.test.ts (12.728 s)
 PASS  packages/kms-local/src/__tests__/kms-local.test.ts
 PASS  packages/did-comm/src/__tests__/message-handler.test.ts
 PASS  packages/data-store/src/__tests__/entities.test.ts
 PASS  packages/did-jwt/src/__tests__/message-handler.test.ts
 PASS  packages/credential-w3c/src/__tests__/action-handler.test.ts
 PASS  packages/did-jwt/src/__tests__/didkey.test.ts
 PASS  packages/credential-ld/src/__tests__/context.loader.test.ts
 PASS  packages/did-provider-ion/__tests__/functions.test.ts
 PASS  packages/did-resolver/src/__tests__/resolver.test.ts
 PASS  packages/kms-local/src/__tests__/secret-box.test.ts
 PASS  packages/selective-disclosure/src/__tests__/validate-presentation.test.ts
 PASS  packages/utils/src/__tests__/utils.test.ts
 PASS  packages/message-handler/src/__tests__/default.test.ts
 PASS  packages/did-provider-ion/__tests__/canonicalizer.test.ts
 PASS  packages/url-handler/src/__tests__/message-handler.test.ts
 PASS  packages/key-manager/src/__tests__/abstract-key-store.test.ts
 PASS  packages/did-provider-ethr/src/__tests__/identity-provider.test.ts
 PASS  packages/credential-w3c/src/__tests__/credentialStatus.test.ts
 PASS  packages/core/src/__tests__/agent.subscriber.test.ts
 PASS  packages/core/src/__tests__/agent.test.ts
 PASS  packages/utils/src/__tests__/encodings.test.ts
 PASS  packages/utils/src/__tests__/did-utils.test.ts
 PASS  packages/cli/src/__tests__/default.test.ts
 PASS  packages/credential-status/src/__tests__/credential-status.test.ts
 PASS  packages/key-manager/src/__tests__/default.test.ts
 PASS  packages/did-manager/src/__tests__/default.test.ts
 FAIL  packages/did-comm/src/__tests__/packing.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  packages/credential-ld/src/__tests__/issue-verify-flow.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  packages/credential-w3c/src/__tests__/issue-verify-flow.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  __tests__/initial.migration.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

(node:1287) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
 PASS  __tests__/localJsonStoreAgent.test.ts (138.632 s)
 PASS  __tests__/localMemoryStoreAgent.test.ts (140.485 s)
 PASS  __tests__/localAgent.test.ts (170.325 s)
 PASS  __tests__/restAgent.test.ts (221.773 s)

Summary of all failing tests
 FAIL  packages/did-provider-ion/__tests__/ion-did-provider.test.ts (36.979 s)
  ● @veramo/did-provider-ion › should add key

    TypeError: Failed to parse URL from /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/argon2-browser/dist/argon2.wasm



  ● @veramo/did-provider-ion › should add key

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      54 |   })
      55 |
    > 56 |   it('should add key', async () => {
         |   ^
      57 |     // This DID is known in ION, hence no anchoring
      58 |     const identifier: IIdentifier = await agent.didManagerCreate(existingDidConfig(false, 'did1-test2', PRIVATE_DID1_KEY_HEX))
      59 |     expect(identifier.alias).toEqual('did:ion:EiCprjAMfWpp7zYXDZV2TGNDV6U4AEBN2Jr6sVsuzL7qhA')

      at packages/did-provider-ion/__tests__/ion-did-provider.test.ts:56:3
      at Object.<anonymous> (packages/did-provider-ion/__tests__/ion-did-provider.test.ts:40:1)

  ● @veramo/did-provider-ion › should remove identifier

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      167 |   })
      168 |
    > 169 |   it('should remove identifier', async () => {
          |   ^
      170 |     const identifier: IIdentifier = await agent.didManagerCreate(existingDidConfig(false, 'remove-test', PRIVATE_DID4_KEY_HEX))
      171 |
      172 |     expect(identifier).toBeDefined()

      at packages/did-provider-ion/__tests__/ion-did-provider.test.ts:169:3
      at Object.<anonymous> (packages/did-provider-ion/__tests__/ion-did-provider.test.ts:40:1)

 FAIL  packages/did-comm/src/__tests__/packing.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  packages/credential-ld/src/__tests__/issue-verify-flow.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  packages/credential-w3c/src/__tests__/issue-verify-flow.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)

 FAIL  __tests__/initial.migration.test.ts
  ● Test suite failed to run

    /home/matteo/GithubRepositories/temp-pr/test_repo/veramo/node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:1
    ReferenceError: Buffer is not defined

      at Object.<anonymous> (node_modules/ky-universal/node_modules/node-fetch/src/utils/form-data.js:7:24)


Test Suites: 5 failed, 36 passed, 41 total
Tests:       2 failed, 1 skipped, 12 todo, 739 passed, 754 total
Snapshots:   0 total
Time:        222.204 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Additional context
Nothing.

Versions:

  • Yarn version: 1.22.19
  • Node Version: v18.12.1
  • Operating System: Ubuntu 22.04.1 LTS on WSL
@mmatteo23 mmatteo23 added the bug Something isn't working label Jan 9, 2023
@mirceanis
Copy link
Member

I've been trying to debug this issue as I'm seeing the same results on my machine.

So far, I've narrowed down the ReferenceError: Buffer is not defined error to a failure of yarn, who is not processing the resolutions properties of packages and seems to completely skip the packages defined there.
We use the resolutions package to replace the @digitalbazaar dependencies with their @digitalcredentials forks, that are usable on react-native and browser environments.

I'm not sure what causes the timeouts in the did-ion-provider tests, as it only seems to happen on certain machines, but the same tests run on CI pass without issue.

As for the wasm file error, I'm still working on that. It looks like another dependency resolution issue.

We'll very likely move to pnpm instead of yarn since it seems to work much better and enforces some dependency hygiene on our packages as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants