Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case when jshint is not available #3776

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

fredden
Copy link
Contributor

@fredden fredden commented Mar 5, 2023

When I run the test suite on a system where jshint is not installed, I get the following error:

............................................................. 1159 / 1729 ( 67%)
............................................................. 1220 / 1729 ( 70%)
............................................................. 1281 / 1729 ( 74%)
............................................................. 1342 / 1729 ( 77%)
............................................................. 1403 / 1729 ( 81%)
............................................................. 1464 / 1729 ( 84%)
.........S................................................... 1525 / 1729 ( 88%)
......SSjs: Couldn't read source file "":  (No such file or directory).
F

80 sniff test files generated 242 unique error codes; 126 were fixable (52%)

Time: 2.03 seconds, Memory: 36.00 MB

There was 1 failure:

1) PHP_CodeSniffer\Standards\Generic\Tests\Debug\JSHintUnitTest::testSniff
[LINE 3] Expected 2 warning(s) in JSHintUnitTest.js but found 0 warning(s).

/path/to/repository/squizlabs-php-codesniffer/tests/Standards/AbstractSniffUnitTest.php:206
/path/to/repository/squizlabs-php-codesniffer/tests/TestSuite7.php:28

FAILURES!
Tests: 1534, Assertions: 9422, Failures: 1, Skipped: 3.

Note the error (js: Couldn't read source file "": (No such file or directory).) part-way through the test-suite output.
The command being run is /usr/bin/rhino "" '/path/to/repository/squizlabs-php-codesniffer/src/Standards/Generic/Tests/Debug/JSHintUnitTest.js'

This pull request fixes this by skipping the test when jshint is not available on the system.

Copy link
Contributor

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Note: This is a follow up on PR #2362, which already improved the logic in the sniff regarding the external tools, but didn't take into account a potential situation where Rhino is available, but jshint is not.

@jrfnl jrfnl added this to the 3.8.0 milestone Jun 21, 2023
@jrfnl jrfnl merged commit 12a2e09 into squizlabs:master Jul 11, 2023
jrfnl added a commit that referenced this pull request Jul 11, 2023
@fredden fredden deleted the jshint-not-available-test-failure branch July 11, 2023 07:06
@jrfnl
Copy link
Contributor

jrfnl commented Dec 8, 2023

FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants