Skip to content

Commit

Permalink
fix(test): relax js mime type test to accept both application/javascr…
Browse files Browse the repository at this point in the history
…ipt and text/javascript response from devserver (#835)
  • Loading branch information
dominikg authored Jan 15, 2024
1 parent d5a6dad commit a9cc778
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ describe.runIf(!isBuild)('direct', () => {
const response = await fetchFromPage(
'src/Dummy.svelte?direct&svelte&type=script&sourcemap&lang.js',
{
headers: { Accept: 'application/javascript' }
headers: { Accept: 'text/javascript' }
}
);
expect(response.ok).toBe(true);
expect(response.headers.get('Content-Type')).toBe('application/javascript');
// vite switched from application/javascript to text/javascript in 5.1
expect(response.headers.get('Content-Type')).toMatch(/^(?:text|application)\/javascript$/);
const js = await response.text();
expect(normalizeSnapshot(js)).toMatchFileSnapshot(snapshotFilename('direct-js'));
});
Expand Down

0 comments on commit a9cc778

Please sign in to comment.