Skip to content

Commit

Permalink
Only run tests for serve
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- committed Nov 19, 2021
1 parent c096e3d commit 4f04f4b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/playground/nospa/__tests__/nospa.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ const assertNotIndexHtml = async (path: string) => {
`This file should only ever be served as /index.html`
)
}

test('/index.html is served', async () => {
await page.goto(viteTestUrl + '/index.html')
const html = await page.innerHTML('body')
expect(html).toContain(`This file should only ever be served as /index.html`)
})
test('/ is not served', async () => {
await assertNotIndexHtml('/')
})
test('/foo/ is not served', async () => {
await assertNotIndexHtml('/foo/')
})
test('/foo/index.html is not served', async () => {
await assertNotIndexHtml('/foo/index.html')
})

if (!process.env.VITE_TEST_BUILD) {
test('/ is not served', async () => {
await assertNotIndexHtml('/')
})
test('/foo/ is not served', async () => {
await assertNotIndexHtml('/foo/')
})
test('/foo/index.html is not served', async () => {
await assertNotIndexHtml('/foo/index.html')
})
}

0 comments on commit 4f04f4b

Please sign in to comment.