Skip to content

Commit

Permalink
Skip test when NPM is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Sep 27, 2024
1 parent 49e2e23 commit 02b640a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Magento2/Tests/Eslint/AbstractEslintTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Magento2\Tests\Eslint;

use PHP_CodeSniffer\Config;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -24,6 +25,10 @@ abstract class AbstractEslintTestCase extends TestCase
*/
protected function assertFileContainsError(string $testFile, array $expectedMessages): void
{
if (Config::getExecutablePath('npm') === null) {
$this->markTestSkipped('npm is not installed here');
}

// phpcs:ignore Magento2.Security.InsecureFunction.FoundWithAlternative
exec(
'npm run eslint -- Magento2/Tests/Eslint/' . $testFile,
Expand Down

0 comments on commit 02b640a

Please sign in to comment.