Skip to content

Commit

Permalink
test(e2e): fix confusing decorator error logs (#2031)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Apr 8, 2024
1 parent 8796afd commit 189e706
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion e2e/cases/decorator/2022-03/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { build, gotoPage, rspackOnlyTest } from '@e2e/helper';
import { build, gotoPage, proxyConsole, rspackOnlyTest } from '@e2e/helper';
import { pluginBabel } from '@rsbuild/plugin-babel';

test('should run stage 3 decorators correctly', async ({ page }) => {
Expand Down Expand Up @@ -37,6 +37,8 @@ rspackOnlyTest(
test.fail(
'stage 3 decorators do not support decoratorBeforeExport',
async ({ page }) => {
const { logs, restore } = proxyConsole();

// SyntaxError: Decorators must be placed *after* the 'export' keyword
const rsbuild = await build({
cwd: __dirname,
Expand All @@ -56,5 +58,15 @@ test.fail(
expect(await page.evaluate('window.method')).toBe('targetMethod');
expect(await page.evaluate('window.field')).toBe('message');
await rsbuild.close();

expect(
logs.find((log) =>
log.includes(
'Using the export keyword between a decorator and a class is not allowed',
),
),
).toBeTruthy();

restore();
},
);

0 comments on commit 189e706

Please sign in to comment.