Skip to content

Commit b42e2f7

Browse files
bradietilleyowenvoke
authored andcommitted
tests: resolve exceptions in Build clear method
1 parent 78f73ce commit b42e2f7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/Commands/BuildCommand.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Console\Output\NullOutput;
2323
use Symfony\Component\Console\Output\OutputInterface;
2424
use Symfony\Component\Process\Process;
25+
use Throwable;
2526

2627
final class BuildCommand extends Command implements SignalableCommandInterface
2728
{
@@ -93,9 +94,19 @@ private function build(string $name): void
9394
* after compile all the code to a single file, we move the built file
9495
* to the builds folder with the correct permissions.
9596
*/
96-
$this->prepare()
97-
->compile($name)
98-
->clear();
97+
$exception = null;
98+
99+
try {
100+
$this->prepare()->compile($name);
101+
} catch (Throwable $exception) {
102+
//
103+
}
104+
105+
$this->clear();
106+
107+
if ($exception !== null) {
108+
throw $exception;
109+
}
99110

100111
$this->output->writeln(
101112
sprintf(' Compiled successfully: <fg=green>%s</>', $this->app->buildsPath($name))

tests/BuildCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ public function clear()
7474
expect($exception)->toBeInstanceOf(RuntimeException::class)
7575
->and($exception->getMessage())->toEqual('Foo bar')
7676
->and($contents)->toEqual(File::get(config_path('app.php')));
77-
})->skip('This test is currently broken (investigating)');
77+
});

0 commit comments

Comments
 (0)