Skip to content

Commit

Permalink
New build with Dav's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Feb 14, 2011
1 parent b6259f9 commit 5eedefa
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
4 changes: 2 additions & 2 deletions javascript/build.xml
Expand Up @@ -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"/>
Expand Down
21 changes: 18 additions & 3 deletions javascript/build/yuitest/npm/cli.js
Expand Up @@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}


//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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++){
Expand All @@ -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();
4 changes: 3 additions & 1 deletion javascript/build/yuitest/npm/package.json
Expand Up @@ -14,7 +14,9 @@
"lib" : "lib"
},
"main": "./lib/yuitest-node.js",

"bin": {
"yuitest": "./cli.js"
},
/*"dependencies": {
"yui3-core": ">=3.3.0",
},*/
Expand Down
21 changes: 18 additions & 3 deletions javascript/src/nodejs/cli.js
Expand Up @@ -51,6 +51,7 @@ function getFiles(dir){
return files;
}


//-----------------------------------------------------------------------------
// Process command line
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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++){
Expand All @@ -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.