Skip to content

Commit

Permalink
Refactor to silence debug logs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 21, 2023
1 parent 9cb26fd commit 99fff06
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions packages/rollup/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,37 +62,43 @@ test('@mdx-js/rollup', async function (t) {
await t.test('vite production', async () => {
const result = /** @type {Array<RollupOutput>} */ (
await build({
plugins: [rollupMdx()],
build: {
write: false,
rollupOptions: {external: [/node_modules/]},
lib: {
entry: fileURLToPath(new URL('vite-entry.mdx', import.meta.url)),
name: 'production'
}
}
},
write: false
},
logLevel: 'silent',
plugins: [rollupMdx()]
})
)

assert.match(result[0].output[0].code, /react\/jsx-runtime/)
const code = result[0].output[0].code

assert.match(code, /jsxs?\(/)
assert.doesNotMatch(code, /jsxDEV\(/)
})

await t.test('vite development', async () => {
const result = /** @type {Array<RollupOutput>} */ (
await build({
mode: 'development',
plugins: [rollupMdx()],
build: {
write: false,
rollupOptions: {external: [/node_modules/]},
lib: {
entry: fileURLToPath(new URL('vite-entry.mdx', import.meta.url)),
name: 'production'
}
}
},
write: false
},
logLevel: 'silent',
mode: 'development',
plugins: [rollupMdx()]
})
)

assert.match(result[0].output[0].code, /react\/jsx-dev-runtime/)
const code = result[0].output[0].code

assert.doesNotMatch(code, /jsxs?\(/)
assert.match(code, /jsxDEV\(/)
})
})

0 comments on commit 99fff06

Please sign in to comment.