Skip to content

Commit

Permalink
test: fix timeout hiding runtime build error (vitejs#3185)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev authored and TobiasMelen committed May 3, 2021
1 parent 8c942f3 commit fb46a33
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/playground/ssr-react/__tests__/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports.serve = async function serve(root, isProd) {
// client build
await build({
root,
logLevel: 'error',
logLevel: 'silent', // exceptions are logged by Jest
build: {
target: 'esnext',
minify: false,
Expand All @@ -28,7 +28,7 @@ exports.serve = async function serve(root, isProd) {
// server build
await build({
root,
logLevel: 'error',
logLevel: 'silent',
build: {
target: 'esnext',
ssr: 'src/entry-server.jsx',
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/ssr-vue/__tests__/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports.serve = async function serve(root, isProd) {
// client build
await build({
root,
logLevel: 'error',
logLevel: 'silent', // exceptions are logged by Jest
build: {
target: 'esnext',
minify: false,
Expand All @@ -28,7 +28,7 @@ exports.serve = async function serve(root, isProd) {
// server build
await build({
root,
logLevel: 'error',
logLevel: 'silent',
build: {
target: 'esnext',
ssr: 'src/entry-server.js',
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-legacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ async function buildPolyfillChunk(
// so that everything is resolved from here
root: __dirname,
configFile: false,
logLevel: 'error',
logLevel: 'silent', // exceptions are logged by Jest
plugins: [polyfillsPlugin(imports)],
build: {
write: false,
Expand Down
8 changes: 7 additions & 1 deletion scripts/jestPerTestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ beforeAll(async () => {

const options: UserConfig = {
root: tempDir,
logLevel: 'error',
logLevel: 'silent',
server: {
watch: {
// During tests we edit the files too fast and sometimes chokidar
Expand Down Expand Up @@ -100,6 +100,12 @@ beforeAll(async () => {
// jest doesn't exit if our setup has error here
// https://github.com/facebook/jest/issues/2713
err = e

// Closing the page since an error in the setup, for example a runtime error
// when building the playground should skip further tests.
// If the page remains open, a command like `await page.click(...)` produces
// a timeout with an exception that hides the real error in the console.
await page.close()
}
}, 30000)

Expand Down

0 comments on commit fb46a33

Please sign in to comment.