Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

fix: Assert that the comparison process depending of external node ap… - #4

Open
ijpatricio wants to merge 1 commit into
beyondcode:masterfrom
ijpatricio:ijpatricio-fix-1
Open

fix: Assert that the comparison process depending of external node ap…#4
ijpatricio wants to merge 1 commit into
beyondcode:masterfrom
ijpatricio:ijpatricio-fix-1

Conversation

@ijpatricio

Copy link
Copy Markdown

…plications executes OK.

Tests:

$process = newProcess($fullCommand);
$process->run();
if ($process->isSuccessful()) {
returnrtrim($process->getOutput());
}

I'm not sure I can add tests, as I cannot replace Process here, it's being instatiated with new keyword,
I would go ahead and resolve it with container, but let's see what you have to say?

This would be equivalent

$process = app()->make(Process::class, ['commandline' => $fullCommand]);

and then we could swap out in the test.

So, in manual testing...

When running php artisan dusk, and not pngjs installed

output is

PHPUnit 7.3.2 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 2.59 seconds, Memory: 14.00MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
RuntimeException: Could not run the Node process. Probably a missing NPM dependency.
module.js:557
throw err;
^
Error: Cannot find module 'pngjs'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/bin/diff.js:1:73)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiff.php:144
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiff.php:112
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiffTester.php:150
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiffTester.php:59

Then, next, without pixelmatch installed

PHPUnit 7.3.2 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 2.42 seconds, Memory: 14.00MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
RuntimeException: Could not run the Node process. Probably a missing NPM dependency.
module.js:557
throw err;
^
Error: Cannot find module 'pixelmatch'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/bin/diff.js:3:13)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiff.php:144
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiff.php:112
/Users/joaopatricio/code/packages/beyondcode/laravel-visual-diff/src/VisualDiffTester.php:150

Then, when both are installed...

PHPUnit 7.3.2 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 1.9 seconds, Memory: 14.00MB
OK (1 test, 1 assertion)

So, what do you think?

@ijpatricioijpatricio mentioned this pull request Aug 24, 2018
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@ijpatricio