Skip to content

Exclude test files from compilation but include for plugin processing #605

@ernieturner

Description

@ernieturner

My tsconfig file currently looks like this

{
    "compilerOptions": {
        "alwaysStrict": true,
        "noImplicitAny": true,
        "noImplicitThis": true,
        "strictNullChecks": true,
        "noUnusedParameters": true,
        "noEmitOnError": true,
        "noUnusedLocals": true,
        "declaration": false,
        "target": "es2015",
        "baseUrl": ".",
        "paths": {
            "*": [
                "src/*"
            ]
        },
        "moduleResolution": "node",
        "lib": ["es6", "dom"]
    },
    "exclude": [
        "node_modules",
        "dist",
        "**/tests/*.test.ts",
        "src/tests"
    ]
}

And my code is setup where my unit test files are located in a tests directory as a sibling of the source file, e.g.

/lib
   /tests
      Utils.test.ts
  Utils.ts

When I compile my code the current setup works find and ignores all unit test files during compilation. However, when I open the unit test files in Sublime with this configuration it can't find any of the global types that it should find from jasmine/karma/etc.

screen shot 2017-05-04 at 3 31 09 pm

If I remove the unit test file from the exclude list in tsconfig, then it all starts working again.

Is there a way to exclude files from TS compilation but still have the plugin process them correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions