Skip to content

mock date example does not work with mockdate v3 #49

Description

@theinterned

Thanks you for the great recipe for mocking dates https://github.com/DevExpress/testcafe-examples/tree/master/examples/mock-date

I was able to get it to work using mockdate@v2.0.5. But the subsequent mockdate@v3x breaks.

mockdate@v3x moves the package to typescript and it looks like the build target has changed from UMD to CJS.

Attempting to load this CJS module via clientScripts({ module: 'mockdate' }) (as in the example) results in an error:

1) - Error in fixture.beforeEach hook -
      An error occurred in the 'mockdate' module injected into the tested page.
      Make sure that this module can be executed in the browser environment.
      
      Error details:
      ReferenceError: exports is not defined

If there is a way to wrap this CJS module so that the mock-date example continues to work please let me know and I'd be happy to open a PR to update the example.

Otherwise, I would be happy to open a PR to update the README to specify using mockdate@v2.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions