0

In Visual Studio, right-click on a .ts file and "Run JS Tests", only the tests in the .ts file run and are counted in the total.

"Run JS Tests" at the folder level or project level and both the tests in the .ts and .js files are run and counted in the total.

Chutzpah.json settings:

{
    "Framework": "jasmine",
    "TypeScriptCodeGenTarget": "ES5",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "RootReferencePathMode": "SettingsFileDirectory",
    "Compile": {
        "Mode": "External",
        "Extensions": [ ".ts" ],
        "ExtensionsWithNoOutput": [ ".d.ts" ]
    },
    "Tests": [
        { "Path": "Specs"}
    ]
}
Sean Allred
  • 3,558
  • 3
  • 32
  • 71
DG_Tor
  • 23
  • 2

2 Answers2

1

I had the same issue. All my tests are written in TypeScript, so my *.ts files define what tests exist. I had solved it by including only *.ts files.

{
    "Tests": [ { "Path": "Specs", "Includes": [ "*.ts" ] } ],

    "Compile": {
        "Mode": "External",
        "Extensions": [ ".ts" ],
        "ExtensionsWithNoOutput": [ ".d.ts" ]
    }
}

Works like a charm.

Martin
  • 5,714
  • 2
  • 21
  • 41
0

Without seeing your full project it is hard to know for sure but something along the following should help achieve this. If you need to include some .js files you can change the exclude patterns accordingly.

```

{
"Framework": "jasmine",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
    "Mode": "External",
    "Extensions": [ ".ts" ],
    "ExtensionsWithNoOutput": [ ".d.ts" ]
},
"References": [

    { "Excludes": ["*.js"]}
],
"Tests": [
    { "Path": "Specs", "Excludes": ["*.js"]}
]
}

```

Matthew Manela
  • 16,572
  • 3
  • 64
  • 66
  • Excluding the .js files doesn't appear to help. I'll also mention the TypeScript tests are testing code in plain .js files. Looking at that logically, I don't know why it would matter especially when running tests at the file level only runs the tests in the TypeScript file but runs them all when doing the same at the folder level. – DG_Tor May 20 '15 at 20:37