app icon indicating copy to clipboard operation
app copied to clipboard

Playwright typscript parse error

Open tikolakin opened this issue 1 year ago • 1 comments

Describe the bug It seems, that recently check-tests started to fail and I no longer able to import all tests due to a parsing error that thrown by babel. Probably something has changed and typescript files are not longer correctly parsed. Note: the test files that currently fail - were already imported to testomatio without issue.

To Reproduce

cross-env TESTOMATIO_PREPEND_DIR="automated" check-tests -- Playwright "**/*.int.ts" -d tests --typescript --no-detached --update-ids --no-empty

🤩 Tests checker by Testomat.io v0.8.24
Error parsing /User/tiko/code/project/tests/connection/popup.int.ts:
SyntaxError: Unexpected token, expected "from" (4:12)
    at constructor (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:353:19)
    at Parser.raise (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:3277:19)
    at Parser.unexpected (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:3297:16)
    at Parser.expectContextual (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:3580:12)
    at Parser.parseImportSpecifiersAndAfter (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:13695:10)
    at Parser.parseImport (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:13687:17)
    at Parser.parseStatementContent (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:12347:27)
    at Parser.parseStatementLike (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:12239:17)
    at Parser.parseModuleItem (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:12216:17)
    at Parser.parseBlockOrModuleBlockBody (/User/tiko/code/project/node_modules/@babel/parser/lib/index.js:12796:36) {
  code: 'BABEL_PARSER_SYNTAX_ERROR',
  reasonCode: 'UnexpectedToken',
  loc: Position { line: 4, column: 12, index: 157 },
  pos: 157
}

Test file example image Note: I can't find what is special about this file, it's a valid TS syntax, no compilation errors. Parsing error happens to other files but not all files.

Error is thrown here image

Additional context I am not quite sure if you will be able to reproduce it, as it's unclear why a pretty much valid ts file throws an error and pretty much the same file - doesn't have parsing errors. I think the best course of actions is to review what config babel uses and if it maybe not picking up the project settings.

tikolakin avatar May 09 '24 11:05 tikolakin

@olexandr13 do you have any findings so far? TY

tikolakin avatar May 13 '24 11:05 tikolakin

Invalid command cross-env TESTOMATIO_PREPEND_DIR="automated" check-tests -- Playwright "**/*.int.ts" -d tests --typescript --no-detached --update-ids --no-empty should be cross-env TESTOMATIO_PREPEND_DIR="automated" npx check-tests Playwright "**/*.int.ts" -d tests --typescript --no-detached --update-ids --no-empty

tikolakin avatar May 18 '24 10:05 tikolakin