Skip to content

Missing sourcemap warnings #249

@mbise1993

Description

@mbise1993

Checklist

  • I have read Caveats documentation and didn't find a solution for this problem there.

Bug description

Minor issue here - there are some missing sourcemap warnings logged to the console at the start of our test runs:

Sourcemap for "/Users/<user>/<repo>/node_modules/aws-sdk-client-mock-jest/dist/es/jest.js" points to missing source files
Sourcemap for "/Users/<user>/<repo>/node_modules/aws-sdk-client-mock-jest/dist/es/jestMatchers.js" points to missing source files
Sourcemap for "/Users/<user>/<repo>/node_modules/aws-sdk-client-mock-jest/dist/es/vitest.js" points to missing source files

It looks like the sourcemaps are being shipped with the package but they are pointing to source TypeScript files that don't get shipped.

Reproduction

Run any tests that use this library with Vitest (might work with Jest too, but I'm not sure if it logs sourcemap warnings)

Environment

  • Node version: 20.17.0
  • Testing lib and version: Vitest - 3.0.5
  • Typescript version: 5.6.2
  • AWS SDK v3 Client mock version: 4.1.0
  • AWS JS SDK libs and versions:
    • @aws-sdk/client-acm: 3.651.1
    • @aws-sdk/client-cloudwatch: 3.651.1
    • @aws-sdk/client-ecs: 3.651.1
    • @aws-sdk/credential-providers: 3.651.1

Activity

vubogovich

vubogovich commented on Feb 27, 2025

@vubogovich

@marioiliasi, thank you for a PR to inline source code. Another option could be to include src into npm package.
The following post-install script can be used as a temporary workaround (in package.json):

"postinstall": "(cd node_modules/aws-sdk-client-mock-jest/dist/es && sed -i -E -e 's|//# sourceMappingURL=[a-zA-Z]+\\.js\\.map||' jest.js jestMatchers.js vitest.js)"
anthonyma94

anthonyma94 commented on Mar 14, 2025

@anthonyma94

Hi, are you using TypeScript in your code? After I updated to vitest v2, I'm getting a TypeError for any extension methods:

import "aws-sdk-client-mock-jest/vitest";

const cognitoMock = mockClient(CognitoIdentityProviderClient);
expect(cognitoMock).toHaveReceivedCommand(AdminAddUserToGroupCommand);
// Property 'toHaveReceivedCommand' does not exist on type 'Assertion<AwsStub<ServiceInputTypes, ServiceOutputTypes, CognitoIdentityProviderClientResolvedConfig>>'
alexbaileyuk

alexbaileyuk commented on May 10, 2025

@alexbaileyuk

Also coming across this today. Would be great to get merged!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexbaileyuk@mbise1993@vubogovich@anthonyma94

        Issue actions

          Missing sourcemap warnings · Issue #249 · m-radzikowski/aws-sdk-client-mock