-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test for scan dependencies (#980)
* chore: add test for scan dependencies * fix: actual test * fix: use vite from pkg.pr.new as a dep for scan-deps * fix: use pkg.pr.new as root vite dep * chore: add usual vite config to scan deps * fix: use patched vite version, bump deps for audit, dedupe * chore(test): add svelte4 syntax checks --------- Co-authored-by: dominikg <dominik.goepel@gmx.de>
- Loading branch information
1 parent
9be5d4b
commit 8cf6dd7
Showing
19 changed files
with
383 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { e2eServer, getText } from '~utils'; | ||
import { describe, expect, it } from 'vitest'; | ||
describe('vite import scan', () => { | ||
it('should not fail to discover dependencies exported from script module', async () => { | ||
// vite logs an error if scan fails but continues, so validate no errors logged | ||
expect( | ||
e2eServer.logs.server.err.length, | ||
`unexpected errors:\n${e2eServer.logs.server.err.join('\n')}` | ||
).toBe(0); | ||
}); | ||
it('should work with exports from module context', async () => { | ||
expect(await getText('#svelte5')).toBe('svelte5'); | ||
expect(await getText('#svelte4double')).toBe('svelte4double'); | ||
expect(await getText('#svelte4single')).toBe('svelte4single'); | ||
expect(await getText('#svelte4none')).toBe('svelte4none'); | ||
expect(await getText('#svelte4space')).toBe('svelte4space'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/png" href="/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + Svelte</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "e2e-tests-scan-deps", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite --force", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/vite-plugin-svelte": "workspace:^", | ||
"svelte": "^5.0.0-next.242", | ||
"vite": "^5.4.2" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
import { svelte5 } from './Svelte5.svelte'; | ||
import { svelte4double } from './Svelte4DoubleQuote.svelte'; | ||
import { svelte4single } from './Svelte4SingleQuote.svelte'; | ||
import { svelte4none } from './Svelte4NoQuote.svelte'; | ||
import { svelte4space } from './Svelte4WithSpace.svelte'; | ||
</script> | ||
|
||
<div id="svelte5">{svelte5}</div> | ||
<div id="svelte4double">{svelte4double}</div> | ||
<div id="svelte4single">{svelte4single}</div> | ||
<div id="svelte4none">{svelte4none}</div> | ||
<div id="svelte4space">{svelte4space}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- eslint-disable-next-line svelte/valid-compile --> | ||
<script context="module"> | ||
export const svelte4double = 'svelte4double'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- eslint-disable-next-line svelte/valid-compile --> | ||
<script context=module> | ||
export const svelte4none = 'svelte4none'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- eslint-disable-next-line svelte/valid-compile --> | ||
<script context='module'> | ||
export const svelte4single = 'svelte4single'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- prettier-ignore --> | ||
<!-- eslint-disable-next-line svelte/valid-compile --> | ||
<script context= "module"> | ||
export const svelte4space = 'svelte4space'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script module> | ||
export const svelte5 = 'svelte5'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import App from './App.svelte'; | ||
import { mount } from 'svelte'; | ||
mount(App, { target: document.body }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="svelte" /> | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineConfig } from 'vite'; | ||
import { svelte } from '@sveltejs/vite-plugin-svelte'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [svelte()], | ||
server: { | ||
watch: { | ||
// During tests we edit the files too fast and sometimes chokidar | ||
// misses change events, so enforce polling for consistency | ||
usePolling: true, | ||
interval: 100 | ||
} | ||
}, | ||
build: { | ||
minify: false, | ||
sourcemap: true // must be true for hermetic build test! | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.