-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfc5649
commit 011bbca
Showing
7 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/playground/fs-serve/__tests__/deny/fs-serve-deny.spec.ts
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,22 @@ | ||
import { isBuild } from '../../../testUtils' | ||
|
||
describe('main', () => { | ||
if (!isBuild) { | ||
test('**/deny/** should deny src/deny/deny.txt', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/deny.txt', viteTestUrl).href | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
test('**/deny/** should deny src/deny/.deny', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/.deny', viteTestUrl).href | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
} else { | ||
test('dummy test to make jest happy', async () => { | ||
// Your test suite must contain at least one 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../root/vite.config-deny') |
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 @@ | ||
.deny |
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 @@ | ||
deny |
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,15 @@ | ||
const path = require('path') | ||
const { defineConfig } = require('vite') | ||
|
||
module.exports = defineConfig({ | ||
server: { | ||
fs: { | ||
strict: true, | ||
allow: [path.resolve(__dirname, 'src')], | ||
deny: ['**/deny/**'] | ||
} | ||
}, | ||
define: { | ||
ROOT: JSON.stringify(path.dirname(__dirname).replace(/\\/g, '/')) | ||
} | ||
}) |
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