Created
July 24, 2015 01:38
-
-
Save r4j4h/69321ec3f7a9f73a4dcc to your computer and use it in GitHub Desktop.
Sketch of a SpecRunner to help demonstrate how to potentially test a Riot application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Jasmine Spec Runner v<%= jasmineVersion %></title> | |
<link rel="shortcut icon" type="image/png" href="lib/jasmine-<%= jasmineVersion %>/jasmine_favicon.png"> | |
<link rel="stylesheet" href="lib/jasmine-<%= jasmineVersion %>/jasmine.css"> | |
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine.js"></script> | |
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine-html.js"></script> | |
<script src="lib/jasmine-<%= jasmineVersion %>/boot.js"></script> | |
<!-- include source files here (any dependencies (riot, moment.js, etc) and compiled tags)... --> | |
<script src="src/Player.js"></script> | |
<script src="src/Song.js"></script> | |
<!-- include spec files here... (files that exercise tests by stubbing DOM and using riot.mount and then messing with result or something) --> | |
<script src="spec/SpecHelper.js"></script> | |
<script src="spec/PlayerSpec.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> | |
<!-- | |
Now, this is obviously html, and you probably want it dynamic so you don't have to maintain it. Well, you could use templates or find/replace to put them, or generate this file dynamically. | |
What I tend to do is make it a .php file and iterate the directory or use a dependency resolver that returns me an ordered array of filenames in the right spots. I then stamp a runner out by going `php SpecRunner.php > SpecRunner.html`. In that fashion it could work with Ruby and Sprockets, Python, whatever. | |
Also, we can provide plugins or premade templates that do these things and feed into the expected output for other build systems. (Grunt, gulp, broccoli, etc) | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually I didn't have the sample I wanted handy so I Grabbed this from https://github.com/jasmine/jasmine/blob/master/grunt/templates/SpecRunner.html.jst - oops but I think the variable substitutions aside it works.
The HTML comments are what I added/modified.