Skip to content

esModuleInterop / typescript causes issues #109

@csi-lk

Description

@csi-lk

When setting the compilerOption esModuleInterop to true

Issue

Example test:

import percySnapshot from '@percy/testcafe';
fixture('Session').page('http://localhost:8080');

test('Session: Visual Regression', async (target) => {
   await percySnapshot(target, 'Session: Welcome');
});

(ignore type error with percySnapshot, covered in #108)

Gives me an error of:

   1) TypeError: testcafe_1.default is not a function

      Browser: Chrome 90.0.4430.212 / macOS 10.15.7

          8 |
          9 |import percySnapshot from '@percy/testcafe';
         10 |fixture('Session').page('http://localhost:8080');
         11 |
         12 |test('Session: Visual Regression', async target => {
       > 13 |  await percySnapshot(target, 'Session: Welcome');
         14 |});
         15 |

Workaround

import * as percySnapshot from '@percy/testcafe';

fixture('Session').page('http://localhost:8080');

test('Session: Visual Regression', async target => {
  await (percySnapshot as any)(target, 'Session: Welcome');
});

(replace the any with the type when fixed)

Futher Reading

DevExpress/testcafe#3983

https://stackoverflow.com/questions/56238356/understanding-esmoduleinterop-in-tsconfig-file

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions