Skip to content

Commit

Permalink
chore(assets): get real base route
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan committed Feb 3, 2023
1 parent 7873356 commit 9759fc2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
viteConfig,
} from '~utils'

const base = viteConfig ? viteConfig?.testConfig?.baseRoute : ''
const getBase = () => (viteConfig ? viteConfig?.testConfig?.baseRoute : '')

const absoluteAssetMatch = isBuild
? /http.*\/other-assets\/asset-\w{8}\.png/
Expand Down Expand Up @@ -140,6 +140,7 @@ describe('css url() references', () => {
describe.runIf(isBuild)('index.css URLs', () => {
let css: string
beforeAll(() => {
const base = getBase()
css = findAssetFile(/index.*\.css$/, base, 'other-assets')
})

Expand Down Expand Up @@ -202,7 +203,7 @@ test('?url import on css', async () => {
isBuild ? /http.*\/other-assets\/icons-\w{8}\.css/ : '/css/icons.css',
)
isBuild &&
expect(findAssetFile(/index.*\.js$/, base, 'entries')).toMatch(
expect(findAssetFile(/index.*\.js$/, getBase(), 'entries')).toMatch(
/icons-.+\.css(?!\?used)/,
)
})
Expand Down

0 comments on commit 9759fc2

Please sign in to comment.