Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing javascript with Chutzpah and requirejs

I just wonder if there is a simple tutorial showing how to test javascript in visual studio with Chutzpah, require.js and jasmine.

Basically, i want to run the tests without using an .html file so that i can see the results in the vs test explorer.

like image 642
ppoliani Avatar asked Mar 27 '13 10:03

ppoliani


2 Answers

You can find some sample codes here: https://chutzpah.codeplex.com/SourceControl/latest#Samples/RequireJS/Jasmine/tests/base/base.jasmine.test.js

Please note if you want to use requirejs with Chutzpah and Jasmine, you need to set TestHarnessReferenceMode to AMD in chutzpah.json. Otherwise the tests won't be ran in browser.

{
    "Framework": "jasmine",
    "TestHarnessReferenceMode": "AMD",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "References": [
        { "Path": "require-2.1.8.js" },
        { "Path": "config.js" }
    ],
    "Tests": [
        { "Path": "tests" }
    ]
}
like image 184
Adamy Avatar answered Nov 05 '22 05:11

Adamy


Here's a pretty useful video to get you started with Chutzpah and Jasmine ...

http://www.youtube.com/watch?v=meJ94rAN7P8

I don't think if you add Require js it is going to make much difference to the demo in the video in terms of how you set things up.

like image 1
Matthew Blott Avatar answered Nov 05 '22 04:11

Matthew Blott