Skip to content

Commit

Permalink
test(e2e/plugin-assets-retry): fix windows unstable test caused by lo…
Browse files Browse the repository at this point in the history
…g parse (#2211)
  • Loading branch information
SoonIter committed Apr 28, 2024
1 parent 22124f3 commit 42eff20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion e2e/cases/assets-retry/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import { pluginAssetsRetry } from '@rsbuild/plugin-assets-retry';
import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry';
import { pluginReact } from '@rsbuild/plugin-react';
import type { RequestHandler } from '@rsbuild/shared';
import stripAnsi from 'strip-ansi';

function count404Response(logs: string[], urlPrefix: string): number {
let count = 0;
for (const log of logs) {
if (log.includes('404') && log.includes(urlPrefix)) {
const rawLog = stripAnsi(log);
// e.g: 18:09:23 404 GET /static/js/index.js 4.443 ms
if (rawLog.includes('404 GET') && rawLog.includes(urlPrefix)) {
count++;
}
}
Expand Down Expand Up @@ -60,6 +63,12 @@ async function createRsbuildWithMiddleware(
},
],
},
output: {
sourceMap: {
css: false,
js: false,
},
},
},
});
return rsbuild;
Expand Down
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"vue-router": "^4.3.2"
},
"devDependencies": {
"strip-ansi": "6.0.1",
"@e2e/helper": "workspace:*",
"@playwright/test": "1.43.1",
"@rsbuild/babel-preset": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 42eff20

Please sign in to comment.