Today I’ve published SharePoint.Jasmine on GitHub and NuGet which allows you to test your JavaScript code directly inside of a SharePoint App. By installing SharePoint.Jasmine into your project using
Install-Package SharePoint.Jasmine
All required artifacts for executing JavaScript UnitTests using Jasmine are automatically integrated into your App project. The updated App structure will look like the following
Most important is the actual test page located in Pages/tests
The index.aspx
file is responsible for loading the Jasmine Test-Runner, the specs and all the JavaScript source files you’re interested in. By default, I’ve added the Jasmine-Sample folder which gives you a rough introduction in how to write JavaScript unit tests using Jasmine. When installing the App and navigating to the Test-Runner-Site, you’ll receive the test results embedded in the default SharePoint MasterPage.
Keep on testing your code 🙂