Permalink
Browse files

* Removing all runner related files

* Adding Runner as submodule
  • Loading branch information...
1 parent dd843fb commit abbab3c21d7ae05bacfde5e2a7be16cd7d7aa0ca @cpojer cpojer committed Jul 29, 2010
Showing with 4 additions and 3,240 deletions.
  1. +3 −15 .gitmodules
  2. +0 −1 CommonJS-Loader
  3. +0 −53 Helpers/JSSpecToJasmine.js
  4. +0 −88 Helpers/Loader.js
  5. +0 −20 Helpers/RunnerOptions.js
  6. +0 −185 Helpers/jasmine-html.js
  7. +0 −1 JSTD-Adapter
  8. +0 −1 JSTestDriver
  9. +0 −1 Jasmine-Node
  10. +0 −166 Jasmine/jasmine.css
  11. +0 −2,343 Jasmine/jasmine.js
  12. +0 −1 Packager
  13. +1 −0 Runner
  14. +0 −35 buildCommonJS
  15. +0 −40 buildJSTDConfiguration.js
  16. +0 −55 index.html
  17. +0 −3 runner
  18. +0 −140 runner.css
  19. +0 −54 runner.html
  20. +0 −33 runner.js
  21. +0 −4 server
  22. +0 −1 test
View
@@ -1,15 +1,3 @@
-[submodule "JSTD-Adapter"]
- path = JSTD-Adapter
- url = git://github.com/cpojer/jasmine-jstd-adapter.git
-[submodule "Jasmine-Node"]
- path = Jasmine-Node
- url = git://github.com/cpojer/jasmine-node.git
-[submodule "CommonJS-Loader"]
- path = CommonJS-Loader
- url = git://github.com/cpojer/mootools-loader.git
-[submodule "Packager"]
- path = Packager
- url = http://github.com/kamicane/packager.git
-[submodule "JSTestDriver"]
- path = JSTestDriver
- url = git://github.com/cpojer/jstestdriver-build.git
+[submodule "Runner"]
+ path = Runner
+ url = git://github.com/mootools/mootools-runner.git
Submodule CommonJS-Loader deleted from 13da79
View
@@ -1,53 +0,0 @@
-value_of = expect;
-
-(function(prototype){
-
-prototype.should_be = prototype.toEqual;
-prototype.should_not_be = prototype.toNotEqual;
-
-prototype.should_be_true = prototype.toBeTruthy;
-prototype.should_be_false = prototype.toBeFalsy;
-prototype.should_be_null = prototype.toBeNull;
-prototype.should_match = prototype.toMatch;
-prototype.should_be_empty = function(){
- return !this.actual || (this.actual.length == 0);
-};
-
-})(jasmine.Matchers.prototype);
-
-describe = (function(original){
- var each = 'before each',
- all = 'before all',
- after = 'after all';
-
- return function(name, object){
- if (object instanceof Function){
- original(name, object);
- return;
- }
-
- original(name, function(){
- var beforeAll = object[all],
- bfEach = object[each],
- aAll = object[after];
-
- beforeEach(function(){
- if (beforeAll){
- beforeAll();
- beforeAll = null;
- }
-
- if (bfEach) bfEach();
- });
-
- delete object[all];
- delete object[each];
- delete object[after];
-
- for (var key in object)
- it(key, object[key]);
-
- if (aAll) it('cleans up', aAll);
- });
- };
-})(describe);
View
@@ -1,88 +0,0 @@
-(function(){
-
-var toString = Object.prototype.toString;
-var isArray = Array.isArray || function(array){
- return toString.call(array) == '[object Array]';
-};
-
-var indexOf = function(array, item, from){
- var len = array.length;
- for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
- if (array[i] === item) return i;
- }
- return -1;
-};
-
-var forEach = function(array, fn, bind){
- for (var i = 0, l = array.length; i < l; i++){
- if (i in array) fn.call(bind, array[i], i, array);
- }
-};
-
-// Uses String.parseQueryString from MooTools-More
-// TODO Needs compat for other browsers
-var parseQueryString = function(string){
- if (typeof string != 'string') return string;
-
- var vars = string.split(/[&;]/), res = {};
- if (vars.length) forEach(vars, function(val){
- var index = val.indexOf('='),
- keys = index < 0 ? [''] : val.substr(0, index).match(/[^\]\[]+/g),
- value = decodeURIComponent(val.substr(index + 1)),
- obj = res;
- forEach(keys, function(key, i){
- var current = obj[key];
- if(i < keys.length - 1)
- obj = obj[key] = current || {};
- else if(current && isArray(current))
- current.push(value);
- else
- obj[key] = current != null ? [current, value] : value;
- });
- });
- return res;
-};
-
-var getSpecs = function(Sets, queryString){
- queryString = parseQueryString(queryString);
-
- var requestedSpecs = [],
- specs = queryString.specs;
-
- forEach(specs && isArray(specs) ? specs : [specs], function(spec){
- if (Sets[spec] && indexOf(requestedSpecs, spec) == -1) requestedSpecs.push(spec);
- });
-
- return requestedSpecs;
-};
-
-loadLibrary = function(Source, queryString){
- var query = parseQueryString(queryString),
- version = query.version,
- path = (query.path || '../') + 'Source/',
- types = query.types || [],
- source = Source[version];
-
- if (!source) return;
-
- if (!types.length) for (var type in source) types.push(type);
-
- for (var i = 0; i < types.length; i++)
- if (source[types[i]])
- load(source[types[i]], path);
-
- return version;
-
-};
-
-loadSpecs = function(Sets, queryString){
- var requestedSpecs = getSpecs(Sets, queryString);
- for (var i = 0; i < requestedSpecs.length; i++){
- var specs = Sets[requestedSpecs[i]];
- load(specs, requestedSpecs[i] + '/');
- }
-
- return requestedSpecs;
-};
-
-})();
View
@@ -1,20 +0,0 @@
-var puts = require('sys').puts;
-
-exports.parseOptions = function(arg){
-
-if (!arg){
- puts('Please provide options for the Spec Runner');
- return null;
-}
-
-var options;
-try {
- options = JSON.parse(arg);
-} catch(e){
- puts('Please provide a proper JSON-Object');
- return null;
-}
-
-return options;
-
-};
View
@@ -1,185 +0,0 @@
-jasmine.TrivialReporter = function(doc) {
- this.document = doc || document;
- this.suiteDivs = {};
- this.logRunningSpecs = false;
-};
-
-jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
- var el = document.createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(document.createTextNode(child));
- } else {
- if (child) { el.appendChild(child); }
- }
- }
-
- for (var attr in attrs) {
- if (attr == "className") {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
- var showPassed, showSkipped;
-
- this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
- this.createDom('div', { className: 'banner' },
- this.createDom('div', { className: 'logo' },
- "Jasmine",
- this.createDom('span', { className: 'version' }, runner.env.versionString())),
- this.createDom('div', { className: 'options' },
- "Show ",
- showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
- showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
- )
- ),
-
- this.runnerDiv = this.createDom('div', { className: 'runner running' },
- this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
- this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
- this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
- );
-
- this.document.body.appendChild(this.outerDiv);
-
- var suites = runner.suites();
- for (var i = 0; i < suites.length; i++) {
- var suite = suites[i];
- var suiteDiv = this.createDom('div', { className: 'suite' },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
- this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
- this.suiteDivs[suite.id] = suiteDiv;
- var parentDiv = this.outerDiv;
- if (suite.parentSuite) {
- parentDiv = this.suiteDivs[suite.parentSuite.id];
- }
- parentDiv.appendChild(suiteDiv);
- }
-
- this.startedAt = new Date();
-
- var self = this;
- showPassed.onchange = function(evt) {
- if (evt.target.checked) {
- self.outerDiv.className += ' show-passed';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
- }
- };
-
- showSkipped.onchange = function(evt) {
- if (evt.target.checked) {
- self.outerDiv.className += ' show-skipped';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
- }
- };
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
- var results = runner.results();
- var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
- this.runnerDiv.setAttribute("class", className);
- //do it twice for IE
- this.runnerDiv.setAttribute("className", className);
- var specs = runner.specs();
- var specCount = 0;
- for (var i = 0; i < specs.length; i++) {
- if (this.specFilter(specs[i])) {
- specCount++;
- }
- }
- var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
- message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
- this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
-
- this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
-};
-
-jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
- var results = suite.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.totalCount == 0) { // todo: change this to check results.skipped
- status = 'skipped';
- }
- this.suiteDivs[suite.id].className += " " + status;
-};
-
-jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
- if (this.logRunningSpecs) {
- this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
- }
-};
-
-jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
- var results = spec.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.skipped) {
- status = 'skipped';
- }
- var specDiv = this.createDom('div', { className: 'spec ' + status },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
- this.createDom('a', {
- className: 'description',
- href: '?spec=' + encodeURIComponent(spec.getFullName()),
- title: spec.getFullName()
- }, spec.description));
-
-
- var resultItems = results.getItems();
- var messagesDiv = this.createDom('div', { className: 'messages' });
- for (var i = 0; i < resultItems.length; i++) {
- var result = resultItems[i];
- if (result.type == 'log') {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
- } else if (result.type == 'expect' && result.passed && !result.passed()) {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
-
- var fn = spec.queue && spec.queue.blocks && spec.queue.blocks[1] ? spec.queue.blocks[1].func : null;
- if (fn){
- var pre = this.createDom('pre', {className: 'examples-code'});
-
- pre.appendChild(this.createDom('code', null, fn.toString().replace(/</img, '&lt;').replace(/>/img, '&gt;')));
- messagesDiv.appendChild(pre);
- }
- }
- }
-
- if (messagesDiv.childNodes.length > 0) {
- specDiv.appendChild(messagesDiv);
- }
-
- this.suiteDivs[spec.suite.id].appendChild(specDiv);
-};
-
-jasmine.TrivialReporter.prototype.log = function() {
- var console = jasmine.getGlobal().console;
- if (console && console.log) console.log.apply(console, arguments);
-};
-
-jasmine.TrivialReporter.prototype.getLocation = function() {
- return this.document.location;
-};
-
-jasmine.TrivialReporter.prototype.specFilter = function(spec) {
- var paramMap = {};
- var params = this.getLocation().search.substring(1).split('&');
- for (var i = 0; i < params.length; i++) {
- var p = params[i].split('=');
- paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
- }
-
- if (!paramMap["spec"]) return true;
- return spec.getFullName().indexOf(paramMap["spec"]) == 0;
-};
Submodule JSTD-Adapter deleted from e4e4be
Submodule JSTestDriver deleted from 5fb76d
Submodule Jasmine-Node deleted from 87841b
Oops, something went wrong.

0 comments on commit abbab3c

Please sign in to comment.