WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f570695

Browse files
authored
test: add nested tsconfig paths test (#527)
1 parent ef44d75 commit f570695

File tree

10 files changed

+42
-0
lines changed

10 files changed

+42
-0
lines changed

playground/resolve-tsconfig-paths/__tests__/resolve.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ test('import from .js', async () => {
1212
test('fallback works', async () => {
1313
await expect.poll(() => page.textContent('.fallback')).toMatch('[success]')
1414
})
15+
16+
test('nested tsconfig.json & references / include works', async () => {
17+
await expect.poll(() => page.textContent('.nested-a')).toMatch('[success]')
18+
await expect.poll(() => page.textContent('.nested-b')).toMatch('[success]')
19+
})

playground/resolve-tsconfig-paths/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ <h2>Import from .js</h2>
99
<h2>Fallback works</h2>
1010
<p class="fallback"></p>
1111

12+
<h2>Nested tsconfig.json & references / include works</h2>
13+
<p class="nested-a"></p>
14+
<p class="nested-b"></p>
15+
1216
<script type="module">
1317
function text(selector, text) {
1418
document.querySelector(selector).textContent = text
@@ -22,4 +26,8 @@ <h2>Fallback works</h2>
2226

2327
import fallback from '@fallback/fallback'
2428
text('.fallback', fallback)
29+
30+
import { valueA, valueB } from './src/nested/index.ts'
31+
text('.nested-a', valueA)
32+
text('.nested-b', valueB)
2533
</script>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const value = '[success] a-imported' as const
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { value } from '@imported'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const value = '[success] b-imported' as const
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { value } from '@imported'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { value as valueA } from './a'
2+
export { value as valueB } from './b'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"include": ["./a.ts"],
3+
"compilerOptions": {
4+
"paths": {
5+
"@imported": ["./a-imported.ts"]
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"include": ["./b.ts"],
3+
"compilerOptions": {
4+
"paths": {
5+
"@imported": ["./b-imported.ts"]
6+
}
7+
}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"include": [],
3+
"references": [
4+
{ "path": "./tsconfig.a.json" },
5+
{ "path": "./tsconfig.b.json" }
6+
]
7+
}

0 commit comments

Comments
 (0)