How to add Jasmine settings to a “standalone” Jasmine setup (one using SpecRunner.html)


How to add Jasmine settings to a “standalone” Jasmine setup (one using SpecRunner.html)



There are lots of examples online on how to set up a standalone jasmine tests in a SpecRunner.html file, like so:


<!doctype html>
<html>
<head>
<title>Jasmine Spec Runner</title>
<link rel="stylesheet" href="bower_components/jasmine/lib/jasmine-core/jasmine.css">
</head>
<body>
<script src="bower_components/jasmine/lib/jasmine-core/jasmine.js"></script>
<script src="bower_components/jasmine/lib/jasmine-core/jasmine-html.js"></script>

<!-- include source files here... -->
<!-- include spec files here... -->



With this kind of setup, how would I configure Jasmine settings, like those found in the node.js or gulp setup? I'm talking about things like random: false, setting a random seed, and other settings that aren't runner-specific.


random: false




1 Answer
1



It looks like the settings are passed in through URL params, when requesting the page. I discovered some of these through the "options" box, which appears at the top right of the page:



screenshot of options box on the default SpecRunnter.html page



Here's a list of the params I was able to find (I'm not sure if this is all of them):


random=true


throwFailures=true


failFast=true


seed=87816



And here's an example request, with the above settings:


GET localhost:8080/SpecRunner.html?random=true&throwFailures=true&failFast=true&seed=87816






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

Moria Casán

How to make file upload 'Required' in Contact Form 7?