0
votes

We are trying to figure out a approach for UI testing and felt chutzpah will be a nice option. I wrote jasmine tests using typescript and requirejs. Chutzpah is able to detect the sample tests which doesn't import any external modules. But when i try it with importing external modules to be tested, chutzpah doesn't seems to detect the tests in test explorer. This is my repo link: https://github.com/NareshNow/UItesting.git

This is my chutzpah json file:

"Framework": "jasmine",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"AMDBaseUrl": "../Compiledmodules/Tests",
"AMDAppDirectory": "../Compiledmodules",
"TestFileTimeout": 600000,
"EnableCodeCoverage": false,
"References": [

{
  "Path": "../Scripts/require.js",
  "IsTestFrameworkFile": true
},
{
  "Path": "../Scripts/AMDconfig.js",
  "IsTestFrameworkFile": true
}
],
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"SourceDirectory": "../Typescripts",
"OutDirectory": "../Compiledmodules"
},
"Tests": [
{
"Path": "../Typescripts",
"Includes": [ ".ts" ]
},
{
"Path": "../Compiledmodules",
"Includes": [".js"]
}
]
}

I have tried the suggestions from a lot of earlier questions on the similar issue for the last 5 days, and nothing seemed to work. It feels to me like something simple is missing. You can find the tests , chutzpah.json in the TypescripKit folder in the repo. Any help would be so greatly appreciated. Thank you!

1

1 Answers

0
votes

I finally got it working. Didn't get time to post here. Here's what was the issue. I was targeting ES2015 in my tsconfig.json. ES2015 doesn't convert the typescript classes to a function, instead it uses class keyword itself. So, the way i accessed it in my jasmine tests was suitable for ES5 and also I was declaring variables before the describe block starts in my jasmine tests. This made chutzpah not recognize them as tests. So, Once I changed the target to ES5 and declared the variables inside the describe , chutzpah was able to detect the tests.