Skip to content

Commit

Permalink
chore: remove problematic test
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 26, 2021
1 parent 1c713f0 commit 3f5c39a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
import { untilUpdated } from '../../testUtils'
import { isBuild, untilUpdated } from '../../testUtils'

test('should load literal dynamic import', async () => {
await page.click('.baz')
await untilUpdated(() => page.textContent('.view'), 'Baz view')
await untilUpdated(() => page.textContent('.view'), 'Baz view', true)
})

test('should load full dynamic import from public', async () => {
await page.click('.qux')
await untilUpdated(() => page.textContent('.view'), 'Qux view')
await untilUpdated(() => page.textContent('.view'), 'Qux view', true)
})

// since this test has a timeout, it should be put last so that it
// does not bleed on the last
test('should load dynamic import with vars', async () => {
await page.click('.foo')
await untilUpdated(() => page.textContent('.view'), 'Foo view')
await untilUpdated(() => page.textContent('.view'), 'Foo view', true)

// first page click will not load the remote message
// because vite needs to compile the lodash dependency
await page.click('.bar')
await untilUpdated(() => page.textContent('.view'), '')

// wait until reload and click again
setTimeout(async () => {
await page.click('.bar')
await untilUpdated(() => page.textContent('.view'), 'Bar view')
}, 10)
await untilUpdated(() => page.textContent('.view'), 'Bar view', true)
})
3 changes: 0 additions & 3 deletions packages/playground/dynamic-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"build": "vite build",
"debug": "node --inspect-brk ../../vite/bin/vite",
"serve": "vite preview"
},
"dependencies": {
"lodash": "4.17.21"
}
}
4 changes: 0 additions & 4 deletions packages/playground/dynamic-import/views/bar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import { n } from '../nested/shared'
import { isBoolean } from 'lodash'
console.log('bar' + isBoolean(n))

export const msg = 'Bar view'
5 changes: 3 additions & 2 deletions packages/playground/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ export function readManifest(base = '') {
*/
export async function untilUpdated(
poll: () => string | Promise<string>,
expected: string
expected: string,
runInBuild = false
) {
if (isBuild) return
if (isBuild && !runInBuild) return
const maxTries = process.env.CI ? 100 : 50
for (let tries = 0; tries < maxTries; tries++) {
const actual = (await poll()) || ''
Expand Down

0 comments on commit 3f5c39a

Please sign in to comment.