Unverified Commit 541cd01b authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add test for single alias (#11296)

parent c68de947
import React from 'react'
export function Hello() {
return <>Hello</>
}
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@c/*": ["components/*"], "@c/*": ["components/*"],
"@lib/*": ["lib/a/*", "lib/b/*"] "@lib/*": ["lib/a/*", "lib/b/*"],
"@mycomponent": ["components/hello.js"]
} }
} }
} }
import { Hello } from '@mycomponent'
export default function SingleAlias() {
return (
<div>
<Hello />
</div>
)
}
...@@ -37,5 +37,10 @@ describe('TypeScript Features', () => { ...@@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback') const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/) 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/)
})
}) })
}) })
import React from 'react'
export function Hello() {
return <>Hello</>
}
import { Hello } from '@mycomponent'
export default function SingleAlias() {
return (
<div>
<Hello />
</div>
)
}
...@@ -37,5 +37,10 @@ describe('TypeScript Features', () => { ...@@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback') const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/) 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,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@c/*": ["components/*"], "@c/*": ["components/*"],
"@lib/*": ["lib/a/*", "lib/b/*"] "@lib/*": ["lib/a/*", "lib/b/*"],
"@mycomponent": ["components/hello.tsx"]
}, },
"esModuleInterop": true, "esModuleInterop": true,
"module": "esnext", "module": "esnext",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment