Skip to content

Commit

Permalink
fix tests url
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 3, 2024
1 parent 35f48d4 commit 6622319
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/vite/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ export function resolver(): Plugin {
}
}
});
return () => {
server.middlewares.use((req, res, next) => {
if (req.originalUrl && req.originalUrl.length > 1) {
if (req.originalUrl?.match(/\/tests($|\?)/)) {
req.originalUrl = '/tests/index.html';
(req as any).url = '/tests/index.html';
return next();
}
}
return next();
});
};
},

async resolveId(source, importer, options) {
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/vite-internals-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function buildViteInternalsTest(testNonColocatedTemplates: boolean, app: Project
'use strict';
module.exports = {
test_page: 'tests/index.html?hidepassed',
test_page: 'tests?hidepassed',
disable_watching: true,
launch_in_ci: ['Chrome'],
launch_in_dev: ['Chrome'],
Expand Down

0 comments on commit 6622319

Please sign in to comment.