|
1 | 1 | import path, { resolve } from 'node:path';
|
2 | 2 | import type { Rollup } from 'vite';
|
3 |
| -import { assert, test } from 'vitest'; |
| 3 | +import { assert, describe, test } from 'vitest'; |
4 | 4 | import { normalizePath } from '../../../testing/util';
|
5 | 5 | import type { OptimizerOptions } from '../types';
|
6 | 6 | import { qwikVite, type QwikVitePlugin, type QwikVitePluginOptions } from './vite';
|
@@ -523,3 +523,35 @@ test('command: build, --mode lib with multiple outputs', async () => {
|
523 | 523 | assert.deepEqual(build.emptyOutDir, undefined);
|
524 | 524 | assert.deepEqual(opts.resolveQwikBuild, true);
|
525 | 525 | });
|
| 526 | + |
| 527 | +describe('input config', () => { |
| 528 | + const initOpts = { |
| 529 | + optimizerOptions: mockOptimizerOptions(), |
| 530 | + client: { |
| 531 | + input: './src/widget/counter.tsx', |
| 532 | + outDir: './dist/client', |
| 533 | + }, |
| 534 | + ssr: { |
| 535 | + input: './src/widget/ssr.tsx', |
| 536 | + outDir: './dist/server', |
| 537 | + }, |
| 538 | + } as QwikVitePluginOptions; |
| 539 | + test('should handle client target', async () => { |
| 540 | + const plugin = getPlugin(initOpts); |
| 541 | + const c: any = (await plugin.config.call( |
| 542 | + configHookPluginContext, |
| 543 | + {}, |
| 544 | + { command: 'build', mode: 'development' } |
| 545 | + ))!; |
| 546 | + assert.deepEqual(c.build.rollupOptions.input, ['./src/widget/counter.tsx']); |
| 547 | + }); |
| 548 | + test('should handle ssr target', async () => { |
| 549 | + const plugin = getPlugin(initOpts); |
| 550 | + const c: any = (await plugin.config.call( |
| 551 | + configHookPluginContext, |
| 552 | + {}, |
| 553 | + { command: 'build', mode: 'ssr' } |
| 554 | + ))!; |
| 555 | + assert.deepEqual(c.build.rollupOptions.input, ['./src/widget/ssr.tsx']); |
| 556 | + }); |
| 557 | +}); |
0 commit comments