Permalink
Browse files

* Adding runner for NodeJS. Uses Packager + MooTools Loader to create…

… a build file (run ./buildCommonJS path/to/core - use ./runner.js to run specs). A lot of specs fail intentionally because they refer to global objects. Once the specs are cleaned up, this should be actually useful. Also note, runner.js is dirrrty.
  • Loading branch information...
cpojer committed Jul 23, 2010
1 parent f61042e commit 614ac71071e68213dddfed8f053db61789e93978
Showing with 73 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +9 −0 .gitmodules
  3. +1 −0 CommonJS-Loader
  4. +1 −1 Helpers/JSSpecToJasmine.js
  5. +1 −0 Jasmine-Node
  6. +1 −0 Packager
  7. +34 −0 buildCommonJS
  8. +1 −1 build.js → buildJSTDConfiguration.js
  9. +23 −0 runner.js
View
@@ -0,0 +1,2 @@
+jsTestDriver.conf
+MooTools.js
View
@@ -1,3 +1,12 @@
[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 CommonJS-Loader added at 13da79
@@ -1,4 +1,4 @@
-var value_of = expect;
+(typeof GLOBAL != 'undefined' ? GLOBAL : this).value_of = expect;
(function(prototype){
Submodule Jasmine-Node added at 7a0ac6
Submodule Packager added at fc36b2
View
@@ -0,0 +1,34 @@
+#!/usr/bin/env php
+<?php
+
+$list = array('Loader/Prefix', 'Core/Class', 'Core/Class.Extras', 'Loader/Loader');
+
+$stderr = fopen('php://stderr', 'w');
+
+require dirname(__FILE__) . '/Packager/packager.php';
+
+array_shift($argv);
+
+$path = array_shift($argv);
+$pkg = new Packager(array(
+ dirname(__FILE__) . '/' . $path,
+ dirname(__FILE__) . '/CommonJS-Loader/'
+));
+
+fwrite($stderr, "Packager is building MooTools Core + MooTools Loader for CommonJS use\n\n");
+fwrite($stderr, "Included Components:\n");
+
+$files = $pkg->components_to_files($list);
+
+$files = $pkg->complete_files($files);
+
+foreach ($files as $file)
+ fwrite($stderr, "- $file: [" . implode(", ", $pkg->get_file_provides($file)) . "]\n");
+
+$output = $pkg->build($files, array(), array(), array('1.2compat'));
+
+file_put_contents('MooTools.js', $output);
+
+fclose($stderr);
+
+?>
@@ -34,7 +34,7 @@ for (var base in Source[version]){
data += ' - "' + path + files[i] + '.js"\n';
}
-for (var i = 0; i < sets.length; i++){
+for (i = 0; i < sets.length; i++){
var set = sets[i];
for (i = 0; i < Sets[set].length; i++)
data += ' - "' + set + '/' + Sets[set][i] + '.js"\n';
View
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+
+// Runs specs in NodeJS, also a proof of concept for now
+
+require.paths.push('./Jasmine-Node/lib');
+
+var jasmine = require('jasmine'),
+ sys = require('sys');
+
+for(var key in jasmine)
+ global[key] = jasmine[key];
+
+require('./Helpers/JSSpecToJasmine');
+require('./MooTools').apply(GLOBAL);
+
+require('./1.3/Core/Core');
+require('./1.3/Types/Array');
+require('./1.3/Types/Function');
+require('./1.3/Types/Object');
+
+jasmine.executeSpecsInFolder(__dirname + '/1.3/Core', function(runner, log){
+ process.exit(runner.results().failedCount);
+}, true, true);

0 comments on commit 614ac71

Please sign in to comment.