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

Coverage fails on ES module imports in TS files #1604

Closed
wzoom opened this issue Jul 23, 2020 · 0 comments
Closed

Coverage fails on ES module imports in TS files #1604

wzoom opened this issue Jul 23, 2020 · 0 comments

Comments

@wzoom
Copy link

wzoom commented Jul 23, 2020

Describe the bug

Trying to run CLI coverage on TS codebase reports "Cannot use import statement outside a module" although TS is supported according to docs.

To Reproduce

$ graphql-inspector coverage src/gql/**/*.ts src/gql/schema.graphql 
Error: Unable to load from file "/Users/wzoom/.../src/gql/dao/convertAppFromApi.test.ts": Cannot use import statement outside a module
    at tryToLoadFromExport (/Users/wzoom/.config/yarn/global/node_modules/@graphql-tools/code-file-loader/index.cjs.js:143:15)
    at async CodeFileLoader.load (/Users/wzoom/.config/yarn/global/node_modules/@graphql-tools/code-file-loader/index.cjs.js:230:32)
    at async loadFile (/Users/wzoom/.config/yarn/global/node_modules/@graphql-tools/load/index.cjs.js:48:24)
    at async /Users/wzoom/.config/yarn/global/node_modules/@graphql-tools/load/index.cjs.js:425:24

All the TS files use standard ES2015 import syntax:
e.g. import convertAppFromApi from './convertAppFromApi';

Expected behavior

The coverage should be shown, the script should not fail.

Environment:

  • OS: macOS 10.15
  • @graphql-inspector/...: 2.1.0
  • graphql: 15.3.0
  • NodeJS: 14.6.0 (tried also 12.16.2)

Additional context

Related Issue:
ardatan/graphql-tools#913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant