Reputation: 712
I'm inside of an Angular 8 project with Cypress version 4.2.0 and getting the following error when trying to import .ts
files
/.../cypress/integration/main.spec.ts:1
import { MOCK1, MOCK2, MOCK3 } from '../fixtures/mocks/index';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
My tsconfig.json
:
{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "ES6",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
Upvotes: 1
Views: 357
Reputation: 926
Looks like it is required sourceType": "module"
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
}
}
Reference link https://github.com/babel/babel-eslint#configuration
Upvotes: 1