summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/mdx-plus-react-errors.test.js
diff options
context:
space:
mode:
authorGravatar Xetera <contact@xetera.dev> 2024-05-21 18:48:19 +0300
committerGravatar GitHub <noreply@github.com> 2024-05-21 17:48:19 +0200
commit3cc3e2ccba062749a6bd8469bc88ff797bea0abc (patch)
tree9c82322bf1228c760d359d7cd1f60b72fe3916b5 /packages/integrations/mdx/test/mdx-plus-react-errors.test.js
parentfcd19fb8e248f8542278537bc49a258eab538c4d (diff)
downloadastro-3cc3e2ccba062749a6bd8469bc88ff797bea0abc.tar.gz
astro-3cc3e2ccba062749a6bd8469bc88ff797bea0abc.tar.zst
astro-3cc3e2ccba062749a6bd8469bc88ff797bea0abc.zip
fix(renderer): omitting internal symbol from mdx props (#10813)
Diffstat (limited to 'packages/integrations/mdx/test/mdx-plus-react-errors.test.js')
-rw-r--r--packages/integrations/mdx/test/mdx-plus-react-errors.test.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/mdx-plus-react-errors.test.js b/packages/integrations/mdx/test/mdx-plus-react-errors.test.js
new file mode 100644
index 000000000..9d87fa8a0
--- /dev/null
+++ b/packages/integrations/mdx/test/mdx-plus-react-errors.test.js
@@ -0,0 +1,33 @@
+import * as assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import { loadFixture } from '../../../astro/test/test-utils.js';
+
+function hookError() {
+ const error = console.error;
+ const errors = [];
+ console.error = function (...args) {
+ errors.push(args);
+ };
+ return () => {
+ console.error = error;
+ return errors;
+ };
+}
+
+describe('MDX and React with build errors', () => {
+ let fixture;
+ let unhook;
+
+ it('shows correct error messages on build error', async () => {
+ try {
+ fixture = await loadFixture({
+ root: new URL('./fixtures/mdx-plus-react-errors/', import.meta.url),
+ });
+ unhook = hookError();
+ await fixture.build();
+ } catch (err) {
+ assert.equal(err.message, 'a is not defined');
+ }
+ unhook();
+ });
+});