Permalink
Browse files

Added Grunt, made JSHint fixes and removed old files

  • Loading branch information...
1 parent 66a8eed commit 7c3a1a6058b4528bad0c2042ca814498f6146c36 @valueof committed Apr 21, 2012
Showing with 64 additions and 1,790 deletions.
  1. +1 −0 .gitignore
  2. +0 −28 Makefile
  3. 0 README.markdown → README.md
  4. +0 −135 env/phantom/cli.js
  5. +0 −84 env/phantom/phantom.js
  6. +0 −133 env/web/web.css
  7. +0 −139 env/web/web.js
  8. +32 −0 grunt.js
  9. +0 −661 hiro.js
  10. +0 −8 jshint.json
  11. 0 {src → lib}/underscore.js
  12. +7 −0 package.json
  13. +2 −0 src/assert.js
  14. +2 −0 src/hiro.js
  15. +3 −1 src/sandbox.js
  16. +2 −0 src/suite.js
  17. +2 −0 src/test.js
  18. +0 −55 test.html
  19. +0 −543 test.js
  20. +2 −0 test/assert.js
  21. +3 −1 test/hiro.js
  22. +2 −0 test/sandbox.js
  23. +3 −1 test/suite.js
  24. +1 −1 test/test.html
  25. +2 −0 test/test.js
View
@@ -0,0 +1 @@
+node_modules/*
View
@@ -1,28 +0,0 @@
-lint:
- @echo "hiro.js"
- @jshint hiro.js --config jshint.json && echo "* OK"
- @echo
-
- @echo "web.js"
- @jshint env/web/web.js --config jshint.json && echo "* OK"
- @echo
-
- @echo "phantom.js"
- @jshint env/phantom/phantom.js --config jshint.json && echo "* OK"
- @echo
-
- @echo "phantom/cli.js"
- @jshint env/phantom/cli.js --config jshint.json && echo "* OK"
- @echo
-
- @echo "test.js"
- @jshint test.js --config jshint.json && echo "* OK"
- @echo
-
-
-serve:
- @python -m SimpleHTTPServer 7777
-
-
-test:
- @phantomjs env/phantom/cli.js
File renamed without changes.
View
@@ -1,135 +0,0 @@
-/*jshint globalstrict:true */
-/*global require:false, phantom:false, console:false */
-
-"use strict";
-
-var fs = require('fs');
-var page = require('webpage').create();
-var stdout = fs.open('/dev/stdout', 'w');
-var handlers = {};
-var tests = [];
-var startTime;
-
-function print(text) {
- stdout.write(text);
- stdout.flush();
-}
-
-function println(text) {
- print((text || '') + '\n');
-}
-
-function seventy(str) {
- return (new Array(70).join(str));
-}
-
-
-// Hiro handlers
-
-handlers['hiro.onStart'] = function () {
- startTime = new Date();
- println('Running all tests...');
-};
-
-handlers['hiro.onComplete'] = function () {
- println();
- println();
-
- var failures = [];
-
- function printFail(test) {
- println(seventy('='));
- println('FAIL: ' + test.name);
- println(seventy('-'));
- print('Assertion: ' + test.assertion);
- println(' (' + test.expected + ' != ' + test.result + ')');
- println();
- }
-
- function printTimeout(test) {
- println(seventy('='));
- println('ERROR: ' + test.name + ' timed out');
- println(seventy('-'));
- println();
- }
-
- for (var i = 0; i < tests.length; i++) {
- if (!tests[i].success) {
- failures.push(tests[i]);
-
- if (tests[i].timeout)
- printTimeout(tests[i]);
- else
- printFail(tests[i]);
- }
- }
-
- println(seventy('-'));
- println('Ran ' + tests.length + ' tests in ' + (new Date() - startTime) / 1000.0 + 's');
- println();
-
- if (failures.length)
- println('FAILED (failures=' + failures.length + ')');
- else
- println('OK');
-
- phantom.exit(failures.length ? 1 : 0);
-};
-
-handlers['test.onComplete'] = function (args) {
- if (!args || !args.success)
- return;
-
- tests.push(args);
- print('.');
-};
-
-handlers['test.onFailure'] = function (args) {
- tests.push(args);
- print('F');
-};
-
-handlers['test.onTimeout'] = function (args) {
- tests.push(args);
- print('E');
-};
-
-// Phantom events
-
-page.onInitialized = function () {
- page.evaluate(function () {
- window.haunted = true;
- });
-};
-
-page.onConsoleMessage = function (ev) {
- ev = JSON.parse(ev);
-
- if (handlers[ev.eventName])
- handlers[ev.eventName](ev.data);
-};
-
-
-// Parse arguments and open the page. Default value
-// works if you run `make serve`.
-
-(function (args) {
- var defpage = 'http://localhost:7777/test.html';
- var kwargs = {};
- var arg, url;
-
- for (var i = 0; i < args.length; i++) {
- arg = args[i].split('=');
- kwargs[arg[0]] = arg.length > 1 ? arg[1] : null;
- }
-
- url = kwargs.page || defpage;
- page.open(url, function (status) {
- if (status == 'fail') {
- console.log('FAILED to open page with URL: ' + url);
- phantom.exit(1);
- }
- });
-}(phantom.args));
-
-/* vim: set ts=2 sw=2 noexpandtab: */
@@ -1,84 +0,0 @@
-/*global hiro:false, console:false */
-
-(function () {
- "use strict";
-
- if (!window.haunted)
- return;
-
-
- // Wraps a Hiro listener and sends its return value
- // to the console for PhantomJS to receive.
-
- function bind(name, callback) {
- callback = callback || function () { return {}; };
-
- hiro.bind(name, function () {
- console.log(JSON.stringify({
- eventName: name,
- data: callback.apply({}, arguments)
- }));
- });
- }
-
-
- // Hiro events
-
- bind('hiro.onStart');
- bind('hiro.onComplete');
-
-
- // Suite specific events
-
- bind('suite.onStart', function (suite) {
- return { name: suite.name };
- });
-
- bind('suite.onComplete', function (suite, success) {
- return { name: suite.name, success: success };
- });
-
- bind('suite.onTimeout', function (suite) {
- return { name: suite.name };
- });
-
-
- // Test specific events
-
- bind('test.onStart', function (test) {
- return { name: test.toString() };
- });
-
- bind('test.onComplete', function (test, success) {
- if (!success)
- return; // test.onFailure will handle this case
-
- return {
- name: test.toString(),
- success: true,
- timeout: false
- };
- });
-
- bind('test.onFailure', function (test, report) {
- return {
- name: test.toString(),
- success: false,
- timeout: false,
- assertion: report.assertion,
- expected: report.expected,
- result: report.result,
- source: report.source
- };
- });
-
- bind('test.onTimeout', function (test) {
- return {
- name: test.toString(),
- success: false,
- timeout: true
- };
- });
-}());
-
-/* vim: set ts=2 sw=2 noexpandtab: */
View
@@ -1,133 +0,0 @@
-body {
- background-color: #eee;
- font-family: Verdana, Arial, Serif;
- margin: 0;
- padding: 0;
- text-align: center;
- font-size: 10pt;
-}
-
-a:hover {
- color: #900020;
-}
-
-h1 {
- margin: 50px auto;
- margin-bottom: 10px;
- padding: 0 0 5px 7px;
- border-bottom: solid 1px #ddd;
- width: 600px;
- text-align: left;
- font-size: 90%;
- font-weight: bold;
- color: #ccc;
- text-transform: uppercase;
- text-shadow: #fff 0px 1px 0px;
-}
-
-h1 span {
- text-shadow: none;
- color: #eee;
-}
-
-div#footer {
- margin: 50px 0;
- font-size: 90%;
- font-weight: normal;
- color: #ccc;
- text-shadow: #fff 0px 1px 0px;
-}
-
-div#web {
- clear: both;
- margin: 0px auto;
- width: 600px;
- min-height: 400px;
- border-radius: 3px;
- text-align: left;
- padding: 10px;
-}
-
-div#web p, div#web div.suite {
- background-color: #fff;
- border-radius: 2px;
- margin: 0 0 5px 0;
- padding: 0;
-}
-
-/* Simple output */
-div#web p.simple {
- color: #999;
- text-align: center;
- margin-top: 10px;
- background-color: #eee;
-}
-
-/* Suite */
-div#web div.suite {
- color: #444;
- border: solid 1px #ddd;
- padding: 5px 5px 5px 15px;
-}
-
-div#web div.succ {
- border: solid 1px green;
-}
-
-div#web div.fail {
- border: solid 1px #900020;
-}
-
-div#web div.suite h2 {
- font-weight: normal;
- font-size: 100%;
- margin: 0 0 10px -10px;
- padding: 0;
-}
-
-div#web div.suite a {
- color: #444;
- text-decoration: none;
-}
-
-div#web div.suite a:hover {
- text-decoration: underline;
-}
-
-/* Test */
-div#web div.test {
- margin: 5px 0;
- border-left: solid 3px #ccc;
- padding-left: 5px;
-}
-
-div#web div.suite div.succ {
- border: none;
- border-left: solid 3px green;
-}
-
-div#web div.suite div.fail {
- border: none;
- border-left: solid 3px #900020;
-}
-
-/* Failure */
-div#web div.test div.report {
- font-size: 80%;
- padding: 5px;
-}
-
-div#web div.test div.report p {
- margin: 0;
- padding: 0;
-}
-
-div#web div.test div.report p label {
- display: inline-block;
- font-weight: bold;
- width: 75px;
-}
-
-textarea.fixture {
- display: none;
-}
Oops, something went wrong.

0 comments on commit 7c3a1a6

Please sign in to comment.