def test_analysis_fails_when_lib_dir_is_not_found(self): jsl = JSLintAnalyzer({'lib_path': '/some/invalid/path', 'use_nodejs_if_available': False}) test_resource = Resource(self.make_a_js_file_with_no_lint()) analysis = jsl.analyze(test_resource) self.assertFalse(analysis.good, 'Expected the analysis to be bad since the tools could not be found') self.assertEquals(1, len(analysis.errors)) self.assertEquals('No suitable JSLint runner (cscript.exe, node.js or rhino) could be found.', analysis.errors[0])
def test_analysis_fails_when_lib_dir_is_not_found(self): jsl = JSLintAnalyzer({ 'lib_path': '/some/invalid/path', 'use_nodejs_if_available': False }) test_resource = Resource(self.make_a_js_file_with_no_lint()) analysis = jsl.analyze(test_resource) self.assertFalse( analysis.good, 'Expected the analysis to be bad since the tools could not be found' ) self.assertEquals(1, len(analysis.errors)) self.assertEquals( 'No suitable JSLint runner (cscript.exe, node.js or rhino) could be found.', analysis.errors[0])
def test_analysis_fails_for_resource_with_lint(self): jsl = JSLintAnalyzer() test_resource = Resource(self.make_a_js_file_with_lint()) analysis = jsl.analyze(test_resource) self.assertFalse(analysis.good) self.assertEquals(1, len(analysis.errors))
def test_analysis_succeeds_for_resource_with_no_lint(self): jsl = JSLintAnalyzer() test_resource = Resource(self.make_a_js_file_with_no_lint()) analysis = jsl.analyze(test_resource) self.assertTrue(analysis.good)