mardi 27 février 2018

Angular Excluding External Tests

I have an Angular project in a Git repository, which has a Git Submodule which has its own Typescript tests (à la xyz.spec.ts). The Submodule is in /src/external/[submodules]

When I run npm test, I get an error that it cannot find mocha, etc, to run the tests for the submodule.

So after much googling and testing, I added
"exclude": ["external"] to my src/tsconfig.spec.json
and

"test": {
    "codeCoverage" : {
      "exclude" : ["src/external/**/*"]
    },
    ...
  }

to .angular-cli.json

Now when I test I get:

WARNING in ./src/external/api/src/api/models/index.spec.ts
Module build failed: Error: [path to repo]\src\external\api\src\api\models    \index.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property`.

How do I exclude a set of files from testing (and hopefully linting) correctly and still keep them for the build?

Aucun commentaire:

Enregistrer un commentaire