Permalink
Browse files

Tools to help with test definitions, building sources for internal mf…

… projects.
  • Loading branch information...
1 parent 1a6fbb9 commit a28be359be1445e41e771d213fe5986b10dd0f8f Mason Browne committed Mar 9, 2012
View
@@ -1,14 +1,24 @@
+process.env["PATH"] = "node_modules/.bin:#{process.env["PATH"]}"
+
{exec} = require "child_process"
-{Builder} = require "./src/index"
+{SourceBuilder:Builder, TestBuilder:TestBuilder} = require "./src/index"
baseDir = __dirname
builds =
"lib": ["src"]
task "build", "Convert CoffeeScript sources into JS files", ->
for build, dirs of builds
new Builder(baseDir)
+ .libraryName("mf-tools")
.buildName(build)
.outputDir(build)
.inputDirs((dir for dir in dirs)...)
.build()
+testBuilder = new TestBuilder()
+ .includePaths("lib")
+ .tests({
+ alive: "test/alive/*.test.coffee"
+ })
+ .task(task)
+ .build()
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,7 +0,0 @@
-(function() {
-
- module.exports = {
- Builder: require("./builder")
- };
-
-}).call(this);
View
@@ -0,0 +1,5 @@
+
+ module.exports = {
+ SourceBuilder: require("./sourceBuilder"),
+ TestBuilder: require("./test/testBuilder")
+ };

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,10 @@
+
+ exports.group = function(groupName, ex, fun) {
+ var t;
+ t = function(name, test) {
+ console.log("Prepping test: test " + name);
+ return ex['test ' + name] = test;
+ };
+ console.log("Prepping group: " + groupName);
+ return fun(t);
+ };
@@ -0,0 +1,19 @@
+require('coffee-script');
+var path = require('path'),
+ spawn = require('child_process').spawn;
+
+
+harness = {};
+helpers = ["group", "import", "image", "page", "server"]
+
+for(var i = 0; i < helpers.length; i++){
+ helper = helpers[i];
+ harness[helper] = require("./" + helper)[helper];
+}
+
+harness.assert = require('chai').assert;
+
+exports.harness = harness;
+// Hint at libraries that we're in test mode
+global.MF_TEST = true;
+global.MF_TEST_CONFIG = {};
View
@@ -0,0 +1,19 @@
+(function() {
+ var Image;
+
+ Image = (function() {
+
+ function Image() {}
+
+ Image.prototype.constuctor = function(w, h) {
+ this.src = "";
+ return this.complete = true;
+ };
+
+ return Image;
+
+ })();
+
+ module.exports.image = Image;
+
+}).call(this);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,27 @@
+(function() {
+ var page, phantom;
+
+ phantom = require('phantom');
+
+ page = {};
+
+ page.eval = function(url, pageFn, testFn) {
+ return phantom.create(function(ph) {
+ return ph.createPage(function(p) {
+ return p.open(url, function(status) {
+ if (status !== 'success') {
+ ph.exit();
+ throw "Page load error: " + status;
+ }
+ return p.evaluate(pageFn, function(result) {
+ ph.exit();
+ return testFn(result);
+ });
+ });
+ });
+ });
+ };
+
+ exports.page = page;
+
+}).call(this);
Oops, something went wrong.

0 comments on commit a28be35

Please sign in to comment.