Skip to content
Browse files

New build with Dav's changes

  • Loading branch information...
1 parent b6259f9 commit 5eedefa31b974050ff771b6965c5c00375040736 nzakas committed Feb 14, 2011
View
4 javascript/build.xml
@@ -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"/>
View
21 javascript/build/yuitest/npm/cli.js
@@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}
+
//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
@@ -87,10 +88,22 @@ files = files.map(function(filename){
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();
View
4 javascript/build/yuitest/npm/package.json
@@ -14,7 +14,9 @@
"lib" : "lib"
},
"main": "./lib/yuitest-node.js",
-
+ "bin": {
+ "yuitest": "./cli.js"
+ },
/*"dependencies": {
"yui3-core": ">=3.3.0",
},*/
View
21 javascript/src/nodejs/cli.js
@@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}
+
//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
@@ -87,10 +88,22 @@ files = files.map(function(filename){
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.
Something went wrong with that request. Please try again.