P
P
plrov2019-10-08 16:39:51
Angular
plrov, 2019-10-08 16:39:51

How to include TypeScript for Sypress if the latter is in a subdirectory?

There is an application in Angular, Protractor was replaced with Cypress, and it was shoved into a e2efolder (the config for it is in the same place, in the folder).
tsconfig.e2e.jsonCypress (extends root).

{
    "extends": "../tsconfig.json",
    "compilerOptions": {
        "sourceMap": false,
        "outDir": "../dist/out-tsc",
        "types": [
            "cypress",
            "node"
        ]
    },
    "include": [
        "**/*.ts"
    ]
}

cypress.json
{
    "baseUrl": "http://localhost:4201",
    "fileServerFolder": ".",
    "fixturesFolder": "./src/fixtures",
    "integrationFolder": "./src/integration",
    "pluginsFile": "./src/plugins/index",
    "supportFile": false,
    "video": false,
    "videosFolder": "./dist/cypress/videos",
    "screenshotsFolder": "./dist/cypress/screenshots",
    "chromeWebSecurity": false,
    "env": {
        "tsConfig": "./tsconfig.e2e.json"
    }
}

When run through ng(for example npm run e2e:single, which corresponds to the command ng e2e) - the tests are running.
angular.json
...
"e2e": {
          "builder": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "e2e/cypress.json",
            "tsConfig": "e2e/tsconfig.e2e.json"
          }
        }
...

When using npm run cypress(corresponds to command cypress open --project ./e2e) - error:
ERROR TS18002: The 'files' list in config file 'tsconfig.json' is empty.

Where to dig? After all, the tsconfig.e2e.jsonincludes are specified instead of the files array.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question