From d2600cc8ef34243454ee5b656d15fca95bc67f61 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 10 Mar 2014 10:37:14 -0500 Subject: [PATCH] lint: Fail on js syntax errors --- setup/test/tests/test.jslint.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 setup/test/tests/test.jslint.php diff --git a/setup/test/tests/test.jslint.php b/setup/test/tests/test.jslint.php new file mode 100644 index 000000000..e9fd1bbe0 --- /dev/null +++ b/setup/test/tests/test.jslint.php @@ -0,0 +1,25 @@ +<?php +require_once "class.test.php"; + +class JsSyntaxTest extends Test { + var $name = "JavaScript Syntax Checks"; + + function testLintErrors() { + $exit = 0; + $root = get_osticket_root_path(); + foreach (glob_recursive("$root/*.js") as $s) { + ob_start(); + system("jsl -process $s", $exit); + $line = ob_get_contents(); + ob_end_clean(); + if ($exit == 3) + $this->fail($s, 0, $line); + else + $this->pass(); + } + } +} + +return 'JsSyntaxTest'; +?> + -- GitLab