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(resolve): cover the codes that parse the fs path contained postfix #12436

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playground/resolve/__tests__/resolve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test('resolve.conditions', async () => {

test('resolve package that contains # in path', async () => {
expect(await page.textContent('.path-contains-sharp-symbol')).toMatch(
'[success] true',
'[success] true #',
)
})

Expand Down
6 changes: 5 additions & 1 deletion playground/resolve/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,12 @@ <h2>resolve package that contains # in path</h2>

import es5Ext from 'es5-ext'
import contains from 'es5-ext/string/#/contains'
import { last } from '@vitejs/test-resolve-sharp-dir'

text('.path-contains-sharp-symbol', `[success] ${contains.call('#', '#')}`)
text(
'.path-contains-sharp-symbol',
`[success] ${contains.call('#', '#')} ${last.call('#')}`,
)
</script>

<style>
Expand Down
3 changes: 2 additions & 1 deletion playground/resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@vitejs/test-resolve-exports-path": "link:./exports-path",
"@vitejs/test-resolve-exports-with-module": "link:./exports-with-module",
"@vitejs/test-resolve-linked": "workspace:*",
"@vitejs/test-resolve-imports-pkg": "link:./imports-path/other-pkg"
"@vitejs/test-resolve-imports-pkg": "link:./imports-path/other-pkg",
"@vitejs/test-resolve-sharp-dir": "link:./sharp-dir"
}
}
3 changes: 3 additions & 0 deletions playground/resolve/sharp-dir/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
last: require('es5-ext/string/#/last.js'),
}
9 changes: 9 additions & 0 deletions playground/resolve/sharp-dir/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@vitejs/test-resolve-sharp-dir",
"private": true,
"version": "1.0.0",
"main": "./index.cjs",
"dependencies": {
"es5-ext": "0.10.62"
}
}
5 changes: 4 additions & 1 deletion playground/resolve/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export default defineConfig({
},
],
optimizeDeps: {
include: ['@vitejs/test-require-pkg-with-module-field'],
include: [
'@vitejs/test-require-pkg-with-module-field',
'@vitejs/test-resolve-sharp-dir',
],
},
})
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.