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

Add test for single alias #11296

Merged
merged 1 commit into from Mar 23, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/integration/jsconfig-paths/components/hello.js
@@ -0,0 +1,5 @@
import React from 'react'

export function Hello() {
return <>Hello</>
}
3 changes: 2 additions & 1 deletion test/integration/jsconfig-paths/jsconfig.json
Expand Up @@ -3,7 +3,8 @@
"baseUrl": ".",
"paths": {
"@c/*": ["components/*"],
"@lib/*": ["lib/a/*", "lib/b/*"]
"@lib/*": ["lib/a/*", "lib/b/*"],
"@mycomponent": ["components/hello.js"]
}
}
}
9 changes: 9 additions & 0 deletions test/integration/jsconfig-paths/pages/single-alias.js
@@ -0,0 +1,9 @@
import { Hello } from '@mycomponent'

export default function SingleAlias() {
return (
<div>
<Hello />
</div>
)
}
5 changes: 5 additions & 0 deletions test/integration/jsconfig-paths/test/index.test.js
Expand Up @@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/)
})

it('should resolve a single matching alias', async () => {
const $ = await get$('/single-alias')
expect($('body').text()).toMatch(/Hello/)
})
})
})
5 changes: 5 additions & 0 deletions test/integration/typescript-paths/components/hello.tsx
@@ -0,0 +1,5 @@
import React from 'react'

export function Hello() {
return <>Hello</>
}
9 changes: 9 additions & 0 deletions test/integration/typescript-paths/pages/single-alias.tsx
@@ -0,0 +1,9 @@
import { Hello } from '@mycomponent'

export default function SingleAlias() {
return (
<div>
<Hello />
</div>
)
}
5 changes: 5 additions & 0 deletions test/integration/typescript-paths/test/index.test.js
Expand Up @@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/)
})

it('should resolve a single matching alias', async () => {
const $ = await get$('/single-alias')
expect($('body').text()).toMatch(/Hello/)
})
})
})
3 changes: 2 additions & 1 deletion test/integration/typescript-paths/tsconfig.json
Expand Up @@ -3,7 +3,8 @@
"baseUrl": ".",
"paths": {
"@c/*": ["components/*"],
"@lib/*": ["lib/a/*", "lib/b/*"]
"@lib/*": ["lib/a/*", "lib/b/*"],
"@mycomponent": ["components/hello.tsx"]
},
"esModuleInterop": true,
"module": "esnext",
Expand Down