Skip to content
Browse files

Added a coverage target to instrument modules with yuitest code coverage

  • Loading branch information...
1 parent 1c1b873 commit 9f94e2caef0827bd05714ec0ec84462d9c19a423 @davglass committed
View
7 componentbuild/3.x/module.xml
@@ -5,7 +5,7 @@
<dirname property="module.basedir" file="${ant.file.YuiModuleTargets}"/>
<import file="${module.basedir}/../shared/targets.xml" description="Targets common to Rollup/Module" />
- <target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs" />
+ <target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs, build-coverage" />
<target name="buildskins" depends="-buildskins, -rollupcss" />
<target name="buildlangs" depends="-buildlangs, -rolluplangs" />
@@ -27,6 +27,11 @@
flags="${component.logger.regex.flags}" />
</target>
+ <target name="build-coverage" unless="coverage.skip">
+ <echo>Creating coverage file for: ${component.builddir}/${component.basefilename}.js</echo>
+ <yuicoverage src="${component.builddir}/${component.basefilename}.js" dest="${component.builddir}/${component.basefilename}-coverage.js" />
+ </target>
+
<!-- DEBUG -->
<target name="builddebug" depends="-concatdebug, -registerdebug, -prependdebug, -appenddebug" description="Create component-debug.js">
<fixcrlf srcdir="${component.builddir}" includes="${component.basefilename}-debug.js" eol="${buildfiles.eol}" />
View
BIN componentbuild/lib/yuitest-coverage/yuitest-coverage.jar
Binary file not shown.
View
14 componentbuild/shared/macrolib.xml
@@ -95,6 +95,20 @@
</then>
</if>
+ <macrodef name="yuicoverage">
+ <attribute name="dest" />
+ <attribute name="src" />
+ <sequential>
+ <java jar="${yuitest-coverage.jar}" failonerror="true" fork="true">
+ <arg value="--charset" />
+ <arg value="utf8" />
+ <arg value="-o" />
+ <arg path="@{dest}" />
+ <arg path="@{src}" />
+ </java>
+ </sequential>
+ </macrodef>
+
<macrodef name="concatsource">
<attribute name="destfile" />
<attribute name="sourcedir" />
View
1 componentbuild/shared/properties.xml
@@ -26,6 +26,7 @@
<property name="jslintconsole.js" location="${builddir}/lib/jslint/jslint-console.js" />
<property name="jslintsrc.js" location="${builddir}/lib/jslint/fulljslint.js" />
<property name="yuicompressor.jar" location="${builddir}/lib/yuicompressor/ant-yuicompressor-2.4.5pre2.jar" />
+ <property name="yuitest-coverage.jar" location="${builddir}/lib/yuitest-coverage/yuitest-coverage.jar" />
<property name="yrb2jsonconsole.js" location="${builddir}/lib/yrb2json/yrb2json-console.js" />
<property name="yrb2jsonsrc.js" location="${builddir}/lib/yrb2json/yrb2json.js" />

0 comments on commit 9f94e2c

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