In my work I have seen there is a test project for typescript project(with ts file app1.ts).It is using Chutzpah as test runner.In its config file it has reference path to the the js file generated by ts compiler(app1.js).In test project there is a file appTests.ts in which there is a import statement to import app1.ts.As per my knowledge both are doing same referencing to the same file,But what chutzpah runner is doing with this reference.
Asked
Active
Viewed 386 times
1 Answers
1
The chutzpah_reference is an old way to let Chutzpah know that your file is referencing another one just for testing. You would use this if you knew when building for real deployment you handled this differently. That said, you should not use this anymore and just make use of a Chutzpah.json file.

Matthew Manela
- 16,572
- 3
- 64
- 66
-
Thanks for reply.I am totally agree with you.I am using json file only.Below is the setting file i am using { "InheritFromParent": true, "AMDBaseUrl": "%OutputPath%/appTests", "AMDAppDirectory": "./", "References": [ {"Path": "%OutputPath%Client.js"}, ], "Tests" : [ { "Includes": [ "*Tests.ts"] } ], "Compile": { "Extensions": [".ts"], "ExtensionsWithNoOutput": [".d.ts"], "Mode": "External", "UseSourceMaps": true, "Paths": [ { "OutputPath": "%OutputPath%/appTests" } ] } } – Nanda Mar 30 '17 at 09:33
-
But my question is here i have reference path to js file Client.js which is the output generated js file of my client ts project.In my test file I am importing classes from client project by import {ClassName } from {path\Filename} which is also i can say referencing my client project ts file.I got the point that to access the class and methods of a ts file in another ts file we have to export and import.If we have already imported the file of client why we need to say to chutzpah again to reference – Nanda Mar 30 '17 at 09:45
-
I am not fully following your issue/question. Could you update the original question above with more details /examples to help me understand? – Matthew Manela Mar 31 '17 at 17:28
-
let me describe you my folder structure in file explorer **-- src->client.sln->something.csproj->app.ts and my test project is like **-- src-client.sln->test.csproj->apptest.ts my sln folder have one chutzpah.json and another in test project folder.I am integrating chutzpah with msbuild so i have written code to give the path of chutzpah.exe and execute chutzpah command to run tests inside a target. lets app.ts have one method showname(name:string){}; and i want to test it in my apptest.ts – Nanda Apr 06 '17 at 10:54
-
so in this scenario i am importing app.ts in apptest.ts like import * as Name from "../../app.ts" and using the method showname however i have seen projects following the same structure have given a reference path to the app.js which is the output generated by typescript compiler. so my question here is why we are giving reference path for app.js in chutzpah.json?? what chutzpah do with the reference scripts – Nanda Apr 06 '17 at 10:54