Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Sep 11, 2024
1 parent eb65074 commit 6cd3afb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ exports[`environment config > should support modify single environment config by
}
`;

exports[`environment config > tools.rspack / bundlerChain can be used in environment config 1`] = `
exports[`environment config > tools.rspack / bundlerChain can be configured in environment config 1`] = `
[
{
"context": "<ROOT>",
Expand Down
27 changes: 26 additions & 1 deletion packages/core/tests/environments.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'node:path';
import { matchPlugin } from '@scripts/test-helper';
import { type RsbuildPlugin, createRsbuild } from '../src';

describe('environment config', () => {
Expand Down Expand Up @@ -327,7 +328,7 @@ describe('environment config', () => {
expect(environmentConfigs).toMatchSnapshot();
});

it('tools.rspack / bundlerChain can be used in environment config', async () => {
it('tools.rspack / bundlerChain can be configured in environment config', async () => {
const rsbuild = await createRsbuild({
rsbuildConfig: {
tools: {
Expand Down Expand Up @@ -366,4 +367,28 @@ describe('environment config', () => {
const configs = await rsbuild.initConfigs();
expect(configs).toMatchSnapshot();
});

it('dev.hmr can be configured in environment config', async () => {
const rsbuild = await createRsbuild({
rsbuildConfig: {
environments: {
web: {
dev: {
hmr: false,
},
},
web2: {
dev: {
hmr: true,
},
},
},
},
});

const configs = await rsbuild.initConfigs();

expect(matchPlugin(configs[0], 'HotModuleReplacementPlugin')).toBeFalsy();
expect(matchPlugin(configs[1], 'HotModuleReplacementPlugin')).toBeTruthy();
});
});

0 comments on commit 6cd3afb

Please sign in to comment.