def test_jshint_parse_output_should_return_true_empty_normal_output(self):
     file_path = self.given_a_file_in_test_dir('jshint.xml', '')
     self.options['jenkins'] = 'False'
     linter = JSHint(self.options)
     self.assertFalse(linter.use_jenkins)
     with OutputCapture():
         self.assertTrue(linter.parse_output(open(file_path), 1))
Exemple #2
0
 def test_jshint_parse_output_should_return_true_empty_normal_output(self):
     file_path = self.given_a_file_in_test_dir('jshint.xml', '')
     self.options['jenkins'] = 'False'
     linter = JSHint(self.options)
     self.assertFalse(linter.use_jenkins)
     with OutputCapture():
         self.assertTrue(linter.parse_output(open(file_path), 1))
 def test_jshint_parse_output_should_return_false_with_xml_output(self):
     file_path = self.given_a_file_in_test_dir('jshint.xml', XML_OUTPUT)
     self.options['jenkins'] = 'True'
     linter = JSHint(self.options)
     self.assertTrue(linter.use_jenkins)
     with OutputCapture():
         self.assertFalse(linter.parse_output(open(file_path), 1))
Exemple #4
0
 def test_jshint_parse_output_should_return_false_with_xml_output(self):
     file_path = self.given_a_file_in_test_dir('jshint.xml', XML_OUTPUT)
     self.options['jenkins'] = 'True'
     linter = JSHint(self.options)
     self.assertTrue(linter.use_jenkins)
     with OutputCapture():
         self.assertFalse(linter.parse_output(open(file_path), 1))
Exemple #5
0
 def test_jshint_parse_output_should_return_false_if_warnings_not_suppressed(
         self):  # noqa
     file_path = self.given_a_file_in_test_dir('jshint.xml',
                                               EXPECTED_WARNINGS_OUTPUT)
     self.options['jenkins'] = 'False'
     self.options['jshint-suppress-warnings'] = 'False'
     linter = JSHint(self.options)
     self.assertFalse(linter.use_jenkins)
     with OutputCapture():
         self.assertFalse(linter.parse_output(open(file_path), 1))
 def test_jshint_parse_output_should_return_false_if_warnings_not_suppressed(self):  # noqa
     file_path = self.given_a_file_in_test_dir(
         'jshint.xml',
         EXPECTED_WARNINGS_OUTPUT
     )
     self.options['jenkins'] = 'False'
     self.options['jshint-suppress-warnings'] = 'False'
     linter = JSHint(self.options)
     self.assertFalse(linter.use_jenkins)
     with OutputCapture():
         self.assertFalse(linter.parse_output(open(file_path), 1))
Exemple #7
0
 def test_analysis_file_should_exist_when_jenkins_is_true(self):
     location_tmp_dir = mkdtemp()
     self.options['location'] = location_tmp_dir
     self.options['jenkins'] = 'True'  # need to activate jenkins.
     with OutputCapture():
         JSHint(self.options).run()
     file_exist = path_isfile(path_join(location_tmp_dir, 'jshint.xml'))
     rmtree(location_tmp_dir)
     self.assertTrue(file_exist)
Exemple #8
0
 def test_analysis_should_return_true(self):
     with OutputCapture():
         self.assertTrue(JSHint(self.options).run())
Exemple #9
0
 def test_analysis_should_return_true_when_oserror(self):
     # The options are fake, so the function should raise an OSError
     # but return True.
     self.options['jshint-bin'] = 'FAKE_BIN'
     with OutputCapture():
         self.assertTrue(JSHint(self.options).run())
Exemple #10
0
 def test_analysis_should_return_true_for_warnings(self):
     self.given_a_file_in_test_dir('warnings.js', WARNINGS_FILE)
     with OutputCapture():
         self.assertTrue(JSHint(self.options).run())
Exemple #11
0
 def test_analysis_should_return_false_when_error_found(self):
     self.given_a_file_in_test_dir('incorrect.js', INCORRECT_FILE)
     with OutputCapture():
         self.assertFalse(JSHint(self.options).run())