I am new to JavaScript unit testing. I am trying to test typescript classes, and my tests are also written in typescript, which looks somewhat like this:
/// <reference path="../../typings/qunit/qunit.d.ts" /> import Utility1 = require("../utility");//This is script I want to test. test("utility_test",function() { ... var result = ...; var expected = ...; equal(result, expected, "Test failed"); })
I am using VS 2015 with an adapter for testing chutzpah, as shown here . To be clear, I installed this to expand to vs 2015: Chutzpah test run context menu extension and Chutzpah test adapter for test explorer , and also added Chutzpah NuGet package.
However, when I build my project, the test does not appear in the testers explorer. And when I tried to start the test from the context menu, it does not cope with this error: Error: Error: Called start() outside of a test context while already started .
Can someone please tell me where I am going wrong?
EDIT For anyone looking for a solution with require.js, this worked for me here. Now my Chutzpah.json looks like this:
{ "Framework": "qunit", "CodeCoverageExcludes": [ "*/require.config.js" ], "TestHarnessReferenceMode": "AMD", "TestHarnessLocationMode": "SettingsFileAdjacent", "TypeScriptModuleKind": "AMD", "AMDBaseUrl": "", "EnableTestFileBatching": true, "Compile": { "Mode": "External", "Extensions": [ ".ts" ], "ExtensionsWithNoOutput": [ ".d.ts" ] }, "References": [ { "Path": "require.js" }, { "Path": "require.config.js" }, ], "Tests": [ { "Path": "jsTests" } ] }