Skip to content

Commit

Permalink
change console error to throw
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Jan 19, 2024
1 parent 2e211a8 commit d1a28a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Components/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function raiseConsoleErrorOrException(BundlingFailedException $e)

return <<< HTML
<!--[BUNDLE: {$this->as} from '{$this->module}']-->
<script data-bundle="{$this->module}">console.error('BUNDLING ERROR: import {$this->module} as {$this->as}')</script>
<script data-bundle="{$this->module}">throw 'BUNDLING ERROR: import {$this->module} as {$this->as}'</script>
<!--[ENDBUNDLE]>-->
HTML;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ public function it_logs_console_errors_when_debug_mode_disabled()
HTML)
->assertScript(<<< 'JS'
document.querySelector('script[data-bundle="~/nonexistent-module"').innerHTML
JS, "console.error('BUNDLING ERROR: import ~/nonexistent-module as foo')");
JS, "throw 'BUNDLING ERROR: import ~/nonexistent-module as foo'");
}
}
4 changes: 2 additions & 2 deletions tests/Feature/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@
->not->toThrow(BundlingFailedException::class);
});

it('raises console error when blade component fails bundling and debug mode is disabled', function () {
it('logs console error when blade component fails bundling and debug mode is disabled', function () {
config()->set('app.debug', false);
$component = new Import('~/foo', 'bar');

expect($component->render())
->toContain(
'console.error',
'throw',
'BUNDLING ERROR: import ~/foo as bar'
)
->not->toThrow(BundlingFailedException::class);
Expand Down

0 comments on commit d1a28a3

Please sign in to comment.