Skip to content

Commit

Permalink
test(e2e): proxy tilde deprecation warning (#1803)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Mar 12, 2024
1 parent 952e3fb commit 8d39134
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion e2e/cases/css/import-common-css/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { expect, test } from '@playwright/test';
import { build } from '@e2e/helper';
import { build, proxyConsole } from '@e2e/helper';

test('should compile common css import correctly', async () => {
const { restore, logs } = proxyConsole();

const rsbuild = await build({
cwd: __dirname,
rsbuildConfig: {
Expand All @@ -16,7 +18,14 @@ test('should compile common css import correctly', async () => {
const files = await rsbuild.unwrapOutputJSON();
const cssFiles = Object.keys(files).find((file) => file.endsWith('.css'))!;

// there will be a deprecation log for `~`.
expect(
logs.some((log) => log.includes(`a request starts with '~' is deprecated`)),
);

expect(files[cssFiles]).toEqual(
'html{min-height:100%}#a{color:red}#b{color:blue}',
);

restore();
});
11 changes: 10 additions & 1 deletion e2e/cases/css/nested-npm-import/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import path from 'node:path';
import { expect, test } from '@playwright/test';
import { build } from '@e2e/helper';
import { build, proxyConsole } from '@e2e/helper';
import { fse } from '@rsbuild/shared';

test('should compile nested npm import correctly', async () => {
const { restore, logs } = proxyConsole();

fse.copySync(
path.resolve(__dirname, '_node_modules'),
path.resolve(__dirname, 'node_modules'),
Expand All @@ -19,4 +21,11 @@ test('should compile nested npm import correctly', async () => {
expect(files[cssFiles]).toEqual(
'#b{color:yellow}#c{color:green}#a{font-size:10px}html{font-size:18px}',
);

// there will be a deprecation log for `~`.
expect(
logs.some((log) => log.includes(`a request starts with '~' is deprecated`)),
);

restore();
});

0 comments on commit 8d39134

Please sign in to comment.