Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New build with Dav's changes

  • Loading branch information...
commit 5eedefa31b974050ff771b6965c5c00375040736 1 parent b6259f9
Nicholas C. Zakas authored
4 javascript/build.xml
@@ -4,13 +4,13 @@
4 4
5 5 <property environment="env" />
6 6
7   - <target name="yuitest_build" depends="YuiModuleTargets.build">
  7 + <target name="build" depends="YuiModuleTargets.build">
8 8 <ant antfile="${buildfile.dir}/build-core.xml" target="yuitest_build_subtask" inheritAll="false" />
9 9 <ant antfile="${buildfile.dir}/build-node.xml" target="yuitest_build_subtask" inheritAll="false" />
10 10 </target>
11 11
12 12 <!-- override to make npm package -->
13   - <target name="build" depends="yuitest_build">
  13 + <target name="npmbuild" depends="all">
14 14 <echo>Creating NPM package directory</echo>
15 15 <mkdir dir="${global.build.npm}"/>
16 16 <copy file="${component.npm.base}/package.json" tofile="${global.build.npm}/package.json"/>
21 javascript/build/yuitest/npm/cli.js
@@ -51,6 +51,7 @@ function getFiles(dir){
51 51 return files;
52 52 }
53 53
  54 +
54 55 //-----------------------------------------------------------------------------
55 56 // Process command line
56 57 //-----------------------------------------------------------------------------
@@ -87,10 +88,22 @@ files = files.map(function(filename){
87 88 YUITest.Node.CLI.XUnit();
88 89
89 90 //-----------------------------------------------------------------------------
  91 +// Set up TestRunner
  92 +//-----------------------------------------------------------------------------
  93 +
  94 +TestRunner.subscribe("complete", function(event){
  95 +
  96 + //if there are failed tests, exit with code 1
  97 + if (event.results.failed){
  98 + process.exit(1);
  99 + }
  100 +});
  101 +
  102 +//-----------------------------------------------------------------------------
90 103 // Include test files
91 104 //-----------------------------------------------------------------------------
92 105
93   -var code = [], i, len;
  106 +var i, len;
94 107
95 108 if (files.length){
96 109 for (i=0, len=files.length; i < len; i++){
@@ -101,11 +114,13 @@ if (files.length){
101 114
102 115 var output = fs.readFileSync(files[i]);
103 116 vm.runInThisContext("(function(YUITest){\n" + output + "\n})", files[i])(YUITest);
104   - //code.push(output);
105 117 }
106 118 } else {
107 119 process.stdout.write("No tests to run.\n");
108 120 }
109 121
110   -//eval(code.join("\n\n"));
  122 +//-----------------------------------------------------------------------------
  123 +// Run it!
  124 +//-----------------------------------------------------------------------------
  125 +
111 126 TestRunner.run();
4 javascript/build/yuitest/npm/package.json
@@ -14,7 +14,9 @@
14 14 "lib" : "lib"
15 15 },
16 16 "main": "./lib/yuitest-node.js",
17   -
  17 + "bin": {
  18 + "yuitest": "./cli.js"
  19 + },
18 20 /*"dependencies": {
19 21 "yui3-core": ">=3.3.0",
20 22 },*/
21 javascript/src/nodejs/cli.js
@@ -51,6 +51,7 @@ function getFiles(dir){
51 51 return files;
52 52 }
53 53
  54 +
54 55 //-----------------------------------------------------------------------------
55 56 // Process command line
56 57 //-----------------------------------------------------------------------------
@@ -87,10 +88,22 @@ files = files.map(function(filename){
87 88 YUITest.Node.CLI.XUnit();
88 89
89 90 //-----------------------------------------------------------------------------
  91 +// Set up TestRunner
  92 +//-----------------------------------------------------------------------------
  93 +
  94 +TestRunner.subscribe("complete", function(event){
  95 +
  96 + //if there are failed tests, exit with code 1
  97 + if (event.results.failed){
  98 + process.exit(1);
  99 + }
  100 +});
  101 +
  102 +//-----------------------------------------------------------------------------
90 103 // Include test files
91 104 //-----------------------------------------------------------------------------
92 105
93   -var code = [], i, len;
  106 +var i, len;
94 107
95 108 if (files.length){
96 109 for (i=0, len=files.length; i < len; i++){
@@ -101,11 +114,13 @@ if (files.length){
101 114
102 115 var output = fs.readFileSync(files[i]);
103 116 vm.runInThisContext("(function(YUITest){\n" + output + "\n})", files[i])(YUITest);
104   - //code.push(output);
105 117 }
106 118 } else {
107 119 process.stdout.write("No tests to run.\n");
108 120 }
109 121
110   -//eval(code.join("\n\n"));
  122 +//-----------------------------------------------------------------------------
  123 +// Run it!
  124 +//-----------------------------------------------------------------------------
  125 +
111 126 TestRunner.run();

0 comments on commit 5eedefa

Please sign in to comment.
Something went wrong with that request. Please try again.