avyvar's picture
Add Vite Selfbench 27-task evaluation
8579f8a verified
Raw
History Blame Contribute Delete
1.71 kB
diff --git a/packages/vite/src/node/ssr/runtime/__tests__/fixtures/oxc-runtime-helper.ts b/packages/vite/src/node/ssr/runtime/__tests__/fixtures/oxc-runtime-helper.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c4e5d4d23c5fec4c02639384a9f7fee53f179ccb
--- /dev/null
+++ b/packages/vite/src/node/ssr/runtime/__tests__/fixtures/oxc-runtime-helper.ts
@@ -0,0 +1,6 @@
+function html(strings: TemplateStringsArray, ...values: unknown[]) {
+ return strings.join('')
+}
+export const result = html`<script>
+ console.log('hi')
+</script>`
diff --git a/packages/vite/src/node/ssr/runtime/__tests__/server-runtime.spec.ts b/packages/vite/src/node/ssr/runtime/__tests__/server-runtime.spec.ts
index 5114dab3b593bcf9ac8a021786af2aaae624571d..b659dd67f9f6c3b0f033cdb785c367ea15876209 100644
--- a/packages/vite/src/node/ssr/runtime/__tests__/server-runtime.spec.ts
+++ b/packages/vite/src/node/ssr/runtime/__tests__/server-runtime.spec.ts
@@ -12,6 +12,7 @@ describe('module runner initialization', async () => {
const it = await createModuleRunnerTester({
resolve: {
external: ['tinyglobby'],
+ noExternal: ['@oxc-project/runtime'],
},
})
@@ -396,6 +397,15 @@ describe('module runner initialization', async () => {
)
})
+ it('oxc runtime helpers are loadable', async ({ runner }) => {
+ const mod = await runner.import('/fixtures/oxc-runtime-helper.ts')
+ expect(mod.result).toMatchInlineSnapshot(`
+ "<script>
+ console.log('hi')
+ </script>"
+ `)
+ })
+
it(`handle Object variable`, async ({ runner }) => {
const mod = await runner.import('/fixtures/top-level-object.js')
expect(mod).toMatchInlineSnapshot(`