Skip to content

Commit

Permalink
Fix e2e test wait-on local server
Browse files Browse the repository at this point in the history
Work around wait-on 404 error

Originally from: vitejs/vite#9520 (comment)
  • Loading branch information
samanehsan committed Aug 21, 2023
1 parent 9bf60d8 commit 64e2ad6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
env:
DISABLE_ESLINT_PLUGIN: true
run: |
npm start & npx wait-on http://localhost:3000
npm start & npx wait-on http://localhost:3000 --verbose
# Build the Docker image
- name: Build
run: |
Expand Down
15 changes: 15 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const bigQueryApi = 'https://bigquery.googleapis.com';
const googleSheetsApi = 'https://sheets.googleapis.com';
const driveApi = 'https://www.googleapis.com';

function fixAcceptHeader404() {
return {
name: 'fix-accept-header-404', // issue with vite dev server: https://github.com/vitejs/vite/issues/9520
configureServer(server) {
server.middlewares.use((req, _res, next) => {
if (req.headers.accept == 'application/json, text/plain, */*') {
req.headers.accept = '*/*';
}
next();
});
},
};
}

dns.setDefaultResultOrder('verbatim');

export default defineConfig({
Expand All @@ -29,6 +43,7 @@ export default defineConfig({
svgr(),
tsconfigPaths(),
eslint(),
fixAcceptHeader404(),
],
server: {
port: 3000,
Expand Down

0 comments on commit 64e2ad6

Please sign in to comment.