-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): update const enum test case (#3281)
- Loading branch information
1 parent
f92daa4
commit 423c281
Showing
5 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
// TODO not supported yet | ||
test.skip('should compile const enum correctly', async () => { | ||
const rsbuild = await build({ | ||
test('should compile const enum correctly', async ({ page }) => { | ||
await build({ | ||
cwd: __dirname, | ||
rsbuildConfig: { | ||
output: { | ||
polyfill: 'off', | ||
}, | ||
}, | ||
page, | ||
}); | ||
const files = await rsbuild.unwrapOutputJSON(); | ||
|
||
const content = | ||
files[Object.keys(files).find((file) => /index\.\w+\.js/.test(file))!]; | ||
|
||
expect(content.includes('console.log("fish is :",0)')).toBeTruthy(); | ||
expect(await page.evaluate(() => window.test)).toBe('Fish 0, Cat 1'); | ||
expect(await page.evaluate(() => window.test2)).toBe('Fish 0, Cat 1'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
export enum Animals { | ||
Fish = 0, | ||
Cat = 1, | ||
} | ||
|
||
// biome-ignore lint/suspicious/noConstEnum: for testing | ||
export const enum Animals2 { | ||
Fish = 0, | ||
Cat = 1, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import { Animals } from './foo'; | ||
import { Animals, Animals2 } from './foo'; | ||
|
||
console.log('fish is :', Animals.Fish); | ||
declare global { | ||
interface Window { | ||
test: string; | ||
test2: string; | ||
} | ||
} | ||
|
||
window.test = `Fish ${Animals.Fish}, Cat ${Animals.Cat}`; | ||
window.test2 = `Fish ${Animals2.Fish}, Cat ${Animals2.Cat}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters