Permalink
Browse files

New build with Dav's changes

  • Loading branch information...
nzakas
nzakas committed Feb 14, 2011
1 parent b6259f9 commit 5eedefa31b974050ff771b6965c5c00375040736
View
@@ -4,13 +4,13 @@
<property environment="env" />
- <target name="yuitest_build" depends="YuiModuleTargets.build">
+ <target name="build" depends="YuiModuleTargets.build">
<ant antfile="${buildfile.dir}/build-core.xml" target="yuitest_build_subtask" inheritAll="false" />
<ant antfile="${buildfile.dir}/build-node.xml" target="yuitest_build_subtask" inheritAll="false" />
</target>
<!-- override to make npm package -->
- <target name="build" depends="yuitest_build">
+ <target name="npmbuild" depends="all">
<echo>Creating NPM package directory</echo>
<mkdir dir="${global.build.npm}"/>
<copy file="${component.npm.base}/package.json" tofile="${global.build.npm}/package.json"/>
@@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}
+
//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
@@ -86,11 +87,23 @@ files = files.map(function(filename){
//TODO: Other types of output
YUITest.Node.CLI.XUnit();
+//-----------------------------------------------------------------------------
+// Set up TestRunner
+//-----------------------------------------------------------------------------
+
+TestRunner.subscribe("complete", function(event){
+
+ //if there are failed tests, exit with code 1
+ if (event.results.failed){
+ process.exit(1);
+ }
+});
+
//-----------------------------------------------------------------------------
// Include test files
//-----------------------------------------------------------------------------
-var code = [], i, len;
+var i, len;
if (files.length){
for (i=0, len=files.length; i < len; i++){
@@ -101,11 +114,13 @@ if (files.length){
var output = fs.readFileSync(files[i]);
vm.runInThisContext("(function(YUITest){\n" + output + "\n})", files[i])(YUITest);
- //code.push(output);
}
} else {
process.stdout.write("No tests to run.\n");
}
-//eval(code.join("\n\n"));
+//-----------------------------------------------------------------------------
+// Run it!
+//-----------------------------------------------------------------------------
+
TestRunner.run();
@@ -14,7 +14,9 @@
"lib" : "lib"
},
"main": "./lib/yuitest-node.js",
-
+ "bin": {
+ "yuitest": "./cli.js"
+ },
/*"dependencies": {
"yui3-core": ">=3.3.0",
},*/
@@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}
+
//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
@@ -86,11 +87,23 @@ files = files.map(function(filename){
//TODO: Other types of output
YUITest.Node.CLI.XUnit();
+//-----------------------------------------------------------------------------
+// Set up TestRunner
+//-----------------------------------------------------------------------------
+
+TestRunner.subscribe("complete", function(event){
+
+ //if there are failed tests, exit with code 1
+ if (event.results.failed){
+ process.exit(1);
+ }
+});
+
//-----------------------------------------------------------------------------
// Include test files
//-----------------------------------------------------------------------------
-var code = [], i, len;
+var i, len;
if (files.length){
for (i=0, len=files.length; i < len; i++){
@@ -101,11 +114,13 @@ if (files.length){
var output = fs.readFileSync(files[i]);
vm.runInThisContext("(function(YUITest){\n" + output + "\n})", files[i])(YUITest);
- //code.push(output);
}
} else {
process.stdout.write("No tests to run.\n");
}
-//eval(code.join("\n\n"));
+//-----------------------------------------------------------------------------
+// Run it!
+//-----------------------------------------------------------------------------
+
TestRunner.run();

0 comments on commit 5eedefa

Please sign in to comment.