changeset 35043:5d4369079c86

tests: use jshint when available to check .js files
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 11 Nov 2017 15:07:21 +0800
parents 5f82e26cbed1
children 71e63fe6b1ab
files tests/hghave.py tests/test-check-jshint.t
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Sat Nov 11 14:14:38 2017 +0800
+++ b/tests/hghave.py	Sat Nov 11 15:07:21 2017 +0800
@@ -444,6 +444,10 @@
     return matchoutput("clang-format --help",
                        br"^OVERVIEW: A tool to format C/C\+\+[^ ]+ code.")
 
+@check("jshint", "JSHint static code analysis tool")
+def has_jshint():
+    return matchoutput("jshint --version 2>&1", br"jshint v")
+
 @check("pygments", "Pygments source highlighting library")
 def has_pygments():
     try:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-jshint.t	Sat Nov 11 15:07:21 2017 +0800
@@ -0,0 +1,12 @@
+#require test-repo jshint hg10
+
+  $ . "$TESTDIR/helpers-testrepo.sh"
+
+run jshint on all tracked files ending in .js except vendored dependencies
+
+  $ cd "`dirname "$TESTDIR"`"
+
+  $ testrepohg locate 'set:**.js' \
+  > -X mercurial/templates/static/excanvas.js \
+  > 2>/dev/null \
+  > | xargs jshint