redconservatory
redconservatory

Reputation: 21924

Typescript with Jest and Jasmine (tests pass, tslint fails)

I have tests passing with jasmine (library tests) and jest (snapshot tests) by including this line at the top of my test files:

/// <reference path="../../node_modules/@types/jasmine/index.d.ts" />

// -> in my jest test files
/// <reference path="../../node_modules/@types/jest/index.d.ts" />

However when I run tslint I get Duplicate errors such as

ERROR in [at-loader] ./node_modules/@types/jest/index.d.ts:12:13
    TS2300: Duplicate identifier 'fdescribe'.

The problem is I cannot actually exclude the d.ts files for jasmine and jest as I need them for my tests, but I want to exclude them from my tslint...is there a way to configure this? I saw some issues but no real solution was posted.

Upvotes: 1

Views: 1843

Answers (1)

redconservatory
redconservatory

Reputation: 21924

Managed to get it working by telling my tsconfig to exclude my test files (which end in spec.tsx)

"exclude": [
    "node_modules",
    "**/*.spec.tsx",
    // ... etc

Upvotes: 1

Related Questions