Skip to content

Commit

Permalink
test: group e2e test cases (web-infra-dev#3810)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sang-Sang33 authored Oct 24, 2024
1 parent 5c1e896 commit 25dea8f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/plugin-less/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,31 @@ describe('plugin-less', () => {
const bundlerConfigs = await rsbuild.initConfigs();
expect(matchRules(bundlerConfigs[0], 'a.less')).toMatchSnapshot();
});

it('should add less-loader with plugins', async () => {
class MockPlugin {
options?: any;
constructor(options?: any) {
this.options = options;
}
install(less: any, pluginManager: any) {}
}
const mockPlugin = new MockPlugin();
const rsbuild = await createRsbuild({
rsbuildConfig: {
plugins: [
pluginLess({
lessLoaderOptions: {
lessOptions: {
plugins: [mockPlugin],
},
},
}),
],
},
});
const bundlerConfigs = await rsbuild.initConfigs();
expect(matchRules(bundlerConfigs[0], 'a.less')).toMatchSnapshot();
expect(mockPlugin.install).toHaveBeenCalledOnce();
});
});

0 comments on commit 25dea8f

Please sign in to comment.