Skip to content

Commit bb953a6

Browse files
Fix GitHub issue 3881 (#3898)
Co-authored-by: Cursor Agent <[email protected]>
1 parent 7000c1f commit bb953a6

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@module-federation/rsbuild-plugin': patch
3+
---
4+
5+
fix: add missing vitest imports to rsbuild-plugin test file
6+
7+
Fixes CI test failure by adding missing `describe`, `expect`, and `it` imports from vitest to the test file. This resolves the "ReferenceError: describe is not defined" error that was causing the rsbuild-plugin tests to fail.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { pluginModuleFederation } from './index';
3+
import type { moduleFederationPlugin } from '@module-federation/sdk';
4+
5+
describe('pluginModuleFederation', () => {
6+
const mockMFConfig: moduleFederationPlugin.ModuleFederationPluginOptions = {
7+
name: 'test',
8+
exposes: {
9+
'./Button': './src/Button',
10+
},
11+
};
12+
13+
it('should work without rsbuildOptions parameter', () => {
14+
const plugin = pluginModuleFederation(mockMFConfig);
15+
expect(plugin).toBeDefined();
16+
expect(plugin.name).toBe('rsbuild:module-federation-enhanced');
17+
});
18+
19+
it('should work with rsbuildOptions parameter', () => {
20+
const plugin = pluginModuleFederation(mockMFConfig, { ssr: true });
21+
expect(plugin).toBeDefined();
22+
expect(plugin.name).toBe('rsbuild:module-federation-enhanced');
23+
});
24+
25+
it('should work with empty rsbuildOptions', () => {
26+
const plugin = pluginModuleFederation(mockMFConfig, {});
27+
expect(plugin).toBeDefined();
28+
expect(plugin.name).toBe('rsbuild:module-federation-enhanced');
29+
});
30+
});

packages/rsbuild-plugin/src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const isRspressSSGConfig = (bundlerConfigName?: string) => {
9999

100100
export const pluginModuleFederation = (
101101
moduleFederationOptions: ModuleFederationOptions,
102-
rsbuildOptions: RSBUILD_PLUGIN_OPTIONS,
102+
rsbuildOptions?: RSBUILD_PLUGIN_OPTIONS,
103103
): RsbuildPlugin => ({
104104
name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
105105
setup: (api) => {

0 commit comments

Comments
 (0)