Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #706 from drewfish/tests-cli
Browse files Browse the repository at this point in the history
fix for mojito test app with coverage (updates pr703)
  • Loading branch information
drewfish committed Nov 5, 2012
2 parents 800ddb3 + 8a8d470 commit cdaf34a
Show file tree
Hide file tree
Showing 107 changed files with 20,384 additions and 13 deletions.
18 changes: 9 additions & 9 deletions lib/app/commands/test.js
Expand Up @@ -25,7 +25,10 @@ var libpath = require('path'),
mojitoTmp = '/tmp/mojitotmp',
mojitoInstrumentedDir = '/tmp/mojito-lib-inst',

fwTestsRoot = libpath.join(targetMojitoPath, 'lib/tests'),
yuiTestCoverageJar = libpath.join(targetMojitoPath,
'tests/harness/lib/yuitest/java/build/yuitest-coverage.jar'),
yuiTestCoverageReportJar = libpath.join(targetMojitoPath,
'tests/harness/lib/yuitest/java/build/yuitest-coverage-report.jar'),

resultsDir = 'artifacts/test',
resultsFile = libpath.join(resultsDir, 'result.xml'),
Expand Down Expand Up @@ -370,9 +373,8 @@ function processResults() {
utils.log('Creating coverage report...');
// generate coverage reports in html
// TODO: find home for fixed path string
exec('java -jar ' + fwTestsRoot +
'/harness/lib/yuitest/java/build/yuitest-coverage-report.jar ' +
'--format LCOV -o ' + coverageDir + ' ' + coverageFile,
exec('java -jar ' + yuiTestCoverageReportJar +
' --format LCOV -o ' + coverageDir + ' ' + coverageFile,
function(error, stdout, stderr) {
if (inputOptions.verbose) {
utils.log('stdout: ' + stdout);
Expand Down Expand Up @@ -468,12 +470,10 @@ function executeTestsWithinY(tests, cb) {
function instrumentDirectory(from, verbose, testType, callback) {
utils.log('Instrumenting "' + from +
'" for test coverage\n\t(this will take a while).');
var converter = libfs.realpathSync(fwTestsRoot +
'/harness/lib/yuitest/java/build/yuitest-coverage.jar'),
opts = verbose ? ' -v' : '',
var opts = verbose ? ' -v' : '',
realPathFrom = libfs.realpathSync(from),
cmd = 'java -jar ' + converter + opts + ' -d -o ' +
mojitoInstrumentedDir + ' ' + mojitoTmp,
cmd = 'java -jar ' + yuiTestCoverageJar + ' ' + opts +
' -d -o ' + mojitoInstrumentedDir + ' ' + mojitoTmp,
allMatcher,
instrumentableJsMatcher;

Expand Down
8 changes: 4 additions & 4 deletions lib/store.js
Expand Up @@ -28,7 +28,7 @@ var Store = {};
/**
* Creates a new server-side resource store instance and returns it.
* @method createStore
* @param {{dir: string,
* @param {{root: string,
* context: Object,
* appConfig: Object,
* verbose: boolean}} options An object containing store options.
Expand All @@ -43,8 +43,8 @@ Store.createStore = function(options) {
if (!options) {
options = {};
}
if (!options.dir) {
options.dir = process.cwd();
if (!options.root) {
options.root = process.cwd();
}
if (!options.context) {
options.context = {};
Expand Down Expand Up @@ -74,7 +74,7 @@ Store.createStore = function(options) {
Y.use('mojito-resource-store');

store = new Y.mojito.ResourceStore({
root: options.dir,
root: options.root,
context: options.context,
appConfig: options.appConfig
});
Expand Down
28 changes: 28 additions & 0 deletions tests/harness/lib/yuitest/LICENSE
@@ -0,0 +1,28 @@
YUI Test
Author: Nicholas C. Zakas <nzakas@yahoo-inc.com>
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Yahoo! source code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt

Some portions Copyright (c) 2002 JSON.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1 change: 1 addition & 0 deletions tests/harness/lib/yuitest/README
@@ -0,0 +1 @@
YUITest
33 changes: 33 additions & 0 deletions tests/harness/lib/yuitest/java/README
@@ -0,0 +1,33 @@
YUI Test Java Tools
Author: Nicholas C. Zakas <nzakas@yahoo-inc.com>
www.nczonline.net
Copyright (c) 2009, Yahoo! Inc. All rights reserved.

Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt


This software contains an ANTLR grammar based off of work from a couple of sources:

The original ES3 grammar is available under a BSD License.
Copyright (c) 2008-2009 Xebic Reasearch BV. Original work by Patrick Hulsmeijer.

The modified ES3 grammar contains portions from JsTestDriver
(http://code.google.com/p/js-test-driver/) and is available under an
Apache License, Version 2.0. Copyright (c) 2009 Google Inc.


This software also requires access to software from the following sources:

The Jargs Library v 1.0 ( http://jargs.sourceforge.net/ ) is available
under a BSD License. Copyright (c) 2001-2003 Steve Purcell,
Copyright (c) 2002 Vidar Holen, Copyright (c) 2002 Michal Ceresna and
Copyright (c) 2005 Ewan Mellor.

The Antlr Library v3.2 (http://www.antlr.org) is available
under a BSD License (http://www.antlr.org/license.html).
Copyright (c) 2003-2008 Terrence Parr.

The Selenium Java Client Driver Library v1.0.1 (http://www.seleniumhq.org)
is available an Apache License (http://seleniumhq.org/about/license.html).

39 changes: 39 additions & 0 deletions tests/harness/lib/yuitest/java/ant.properties
@@ -0,0 +1,39 @@
#Target JVM for the compilation
target.jvm.version = 1.5

#Directories
src.dir = src
lib.dir = lib
doc.dir = doc
build.dir = build
tmp.dir = tmp
tests.dir = tests

#Version information
version.number = 0.6.4

#Code paths
codepath.root.dir = com/yahoo/platform/yuitest

#Libraries
antlr.jar = antlr-3.2.jar
antlr2.jar = antlr-2.7.7.jar
antlr-runtime.jar = antlr-runtime-3.2.jar
stringtemplate.jar = stringtemplate-3.2.1.jar
jargs.jar = jargs-1.0.jar
junit.jar = junit-4.1.jar
selenium.jar = selenium-java-client-driver.jar

#Coverage info
coverage.name = yuitest-coverage
coverage.jar.name = ${coverage.name}.jar
coverage.root.dir = ${codepath.root.dir}/coverage

coverage-report.name = yuitest-coverage-report
coverage-report.jar.name = ${coverage-report.name}.jar
coverage-report.root.dir = ${codepath.root.dir}/coverage

#Selenium Driver info
selenium-driver.name = yuitest-selenium-driver
selenium-driver.jar.name = ${selenium-driver.name}.jar
selenium-driver.root.dir = ${codepath.root.dir}/selenium

0 comments on commit cdaf34a

Please sign in to comment.