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

build(plugin-keychain-memory): fix local imports broken due to .js extensions #3254

Closed
petermetz opened this issue May 10, 2024 · 0 comments · Fixed by #3255
Closed

build(plugin-keychain-memory): fix local imports broken due to .js extensions #3254

petermetz opened this issue May 10, 2024 · 0 comments · Fixed by #3255
Assignees
Labels
Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Keychain Tasks/bugs related to the Keychain plugin core interfaces or any of the implementations themselves. Tests Anything related to tests be that automatic or manual, integration or unit, etc.

Comments

@petermetz
Copy link
Contributor

Description

Reproduce by executing this on main:

yarn jest packages/cactus-plugin-keychain-memory/src/test/typescript/integration/api-surface.test.ts
and then watch it fail as such:

$ yarn jest packages/cactus-plugin-keychain-memory/src/test/typescript/integration/api-surface.test.ts
jest-haste-map: duplicate manual mock found: ConfigUtil
  The following files share their name; please delete one of them:
    * <rootDir>/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/__mocks__/ConfigUtil.ts
    * <rootDir>/packages/cactus-cmd-socketio-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.js

 FAIL  packages/cactus-plugin-keychain-memory/src/test/typescript/integration/api-surface.test.ts
  ● Test suite failed to run

    Cannot find module './default_service_pb.js' from 'packages/cactus-plugin-keychain-memory/src/main/typescript/generated/crpc/services/default_service_connect.ts'

    Require stack:
      packages/cactus-plugin-keychain-memory/src/main/typescript/generated/crpc/services/default_service_connect.ts
      packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts
      packages/cactus-plugin-keychain-memory/src/main/typescript/public-api.ts
      packages/cactus-plugin-keychain-memory/src/test/typescript/integration/api-surface.test.ts

      13 | // @ts-nocheck
      14 |
    > 15 | import { DeleteKeychainEntryV1Request, GetKeychainEntryV1Request, GetPrometheusMetricsV1Response, HasKeychainEntryV1Request, SetKeychainEntryV1Request } from "./default_service_pb.js";
         | ^
      16 | import { DeleteKeychainEntryResponseV1PB } from "../models/delete_keychain_entry_response_v1_pb_pb.js";
      17 | import { Empty, MethodKind } from "@bufbuild/protobuf";
      18 | import { GetKeychainEntryResponseV1PB } from "../models/get_keychain_entry_response_v1_pb_pb.js";

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (packages/cactus-plugin-keychain-memory/src/main/typescript/generated/crpc/services/default_service_connect.ts:15:1)
      at Object.<anonymous> (packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts:26:1)
      at Object.<anonymous> (packages/cactus-plugin-keychain-memory/src/main/typescript/public-api.ts:4:1)
      at Object.<anonymous> (packages/cactus-plugin-keychain-memory/src/test/typescript/integration/api-surface.test.ts:1:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.61 s
Ran all test suites matching /packages\/cactus-plugin-keychain-memory\/src\/test\/typescript\/integration\/api-surface.test.ts/i.

Acceptance Criteria

  1. Fix the generated code which appears to be importing .js extension files OR fix the Jest config whichever turns out to be the solution that doesn't add more tech. debt.
@petermetz petermetz self-assigned this May 10, 2024
petermetz added a commit to petermetz/cacti that referenced this issue May 10, 2024
Found the solution and a long discussion about it here:
kulshekhar/ts-jest#1057

TLDR: The Jest resolver needs a little extra information/tweak to the
config so that it can correctly handle the .js imports.

Specifically this comment provided the solution which I made here:
kulshekhar/ts-jest#1057 (comment)

Fixes hyperledger-cacti#3254

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz added Keychain Tasks/bugs related to the Keychain plugin core interfaces or any of the implementations themselves. Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Tests Anything related to tests be that automatic or manual, integration or unit, etc. labels May 10, 2024
petermetz added a commit to petermetz/cacti that referenced this issue May 16, 2024
Found the solution and a long discussion about it here:
kulshekhar/ts-jest#1057

TLDR: The Jest resolver needs a little extra information/tweak to the
config so that it can correctly handle the .js imports.

Specifically this comment provided the solution which I made here:
kulshekhar/ts-jest#1057 (comment)

Fixes hyperledger-cacti#3254

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue May 16, 2024
Found the solution and a long discussion about it here:
kulshekhar/ts-jest#1057

TLDR: The Jest resolver needs a little extra information/tweak to the
config so that it can correctly handle the .js imports.

Specifically this comment provided the solution which I made here:
kulshekhar/ts-jest#1057 (comment)

Fixes hyperledger-cacti#3254

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this issue May 16, 2024
Found the solution and a long discussion about it here:
kulshekhar/ts-jest#1057

TLDR: The Jest resolver needs a little extra information/tweak to the
config so that it can correctly handle the .js imports.

Specifically this comment provided the solution which I made here:
kulshekhar/ts-jest#1057 (comment)

Fixes #3254

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@github-project-automation github-project-automation bot moved this from In review to Done in Cacti_Scrum_Project_v2_Release May 16, 2024
sandeepnRES pushed a commit to sandeepnRES/cacti that referenced this issue Jul 30, 2024
Found the solution and a long discussion about it here:
kulshekhar/ts-jest#1057

TLDR: The Jest resolver needs a little extra information/tweak to the
config so that it can correctly handle the .js imports.

Specifically this comment provided the solution which I made here:
kulshekhar/ts-jest#1057 (comment)

Fixes hyperledger-cacti#3254

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Keychain Tasks/bugs related to the Keychain plugin core interfaces or any of the implementations themselves. Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant