Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Prevent regressions in static file serving of files outside the root #2358

Merged
merged 3 commits into from
Mar 15, 2021

Conversation

ElMassimo
Copy link
Contributor

@ElMassimo ElMassimo commented Mar 3, 2021

Description 📖

This pull request adds a test to prevent regressions in static file serving as in #2201, which has a high impact downstream.

The added scenario ensures the 404 check fails in 2.0.4, and passes in the current version.

Background 📜

@ElMassimo ElMassimo changed the title test: Prevent static file serving regressions like in #2201 test: Prevent regressions in static file serving of files outside the root Mar 3, 2021
const execRoot = process.cwd()
const playgroundDir = execRoot.includes('playground')
? path.resolve(__dirname, '..') // Allow running vite locally inside the folder.
: path.resolve(execRoot, 'packages/playground')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified if we assume Vite is always run by jest, but added it in case folks run vite manually from the assets folder when debugging, so that it always resolves as expected.

@ElMassimo ElMassimo force-pushed the test-static-file-serving branch from 5955dcb to 674d4a2 Compare March 3, 2021 14:57
@ElMassimo ElMassimo force-pushed the test-static-file-serving branch from 674d4a2 to 3978e06 Compare March 3, 2021 14:57
@antfu antfu added p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) and removed p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) labels Mar 15, 2021
@yyx990803 yyx990803 merged commit ee7eb82 into vitejs:main Mar 15, 2021
@ElMassimo ElMassimo deleted the test-static-file-serving branch March 15, 2021 14:55
patak-dev added a commit that referenced this pull request Apr 16, 2021
TobiasMelen pushed a commit to TobiasMelen/vite that referenced this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants