'Run Typescript + Cypress E2E tests over BrowserStack

I am trying to run cypress E2E test case(written in typescript) on BrowserStack.

Library details:-

"typescript": "~4.2.4",
"cypress": "9.5.0",
"browserstack-cypress-cli": "1.14.0"

I have provided all details of browserstack.json according to documentation. But I got error

Running:  info.spec.ts                                                          (NaN of undefined)

Oops...we found an error preparing this test file:

  > src\integration\TEST\info.spec.ts

The error was:

Error: Webpack Compilation Error
./src/integration/TEST/info.spec.ts
Module build failed (from C:/Windows/cypress_package/9.5.4/node_modules/@cypress/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js):
Error: error while parsing tsconfig.json
    at handle (C:\Windows\cypress_package\9.5.4\node_modules\@cypress\webpack-preprocessor\dist\index.js:180:23)
    at finalCallback (C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:257:39)
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:306:14
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:304:22
    at Compiler.emitRecords (C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:499:39)
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:298:10
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:485:14
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:482:27
    at C:\Windows\cypress_package\9.5.4\node_modules\neo-async\async.js:2818:7
    at done (C:\Windows\cypress_package\9.5.4\node_modules\neo-async\async.js:3522:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Windows\cypress_package\9.5.4\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Windows\cypress_package\9.5.4\node_modules\webpack\lib\Compiler.js:464:33
    at C:\Windows\cypress_package\9.5.4\node_modules\graceful-fs\graceful-fs.js:143:16
    at C:\Windows\cypress_package\9.5.4\node_modules\graceful-fs\graceful-fs.js:61:14
    at FSReqCallback.oncomplete (fs.js:156:23)


Solution 1:[1]

You can check if you have added the base URL in tsconfig.json

Also, do try running it on your local machine once without BrowserStack

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Inderjeet Saluja