Skip to content

TypeScript "exclude" conflicts with types resolution #10285

Closed
@letmaik

Description

@letmaik
  • VSCode Version: 1.4.0
  • OS Version: Win 10
  • TypeScript Version: 2.0 beta (also set with "typescript.tsdk": "./node_modules/typescript/lib")

Steps to Reproduce:

  1. Create project with /src and /test folders.
  2. Create tsconfig.json with:
{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "rootDir": "src/",
        "outDir": "lib/",
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "exclude": [
        "node_modules",
        "test"
    ]
}
  1. Run npm install --save @types/node
  2. Create /test/test.ts and import assert.

The assert import leads to "Cannot find module 'assert'".

The reason why I excluded test in tsconfig.json is that the tests should not become part of the lib/ folder. Also, I have a separate tsconfig.json in the test/ folder which gets used by mocha via mocha --require ./test/init.js test/**/*.ts:

{
    "compilerOptions": {
        "module": "commonjs",
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "exclude": [
        "node_modules"
    ]
}

The init.js file that is require'd by mocha contains:

require('ts-node').register({
    project: 'test/',
    disableWarnings: true,
    fast: true
})

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