Skip to content

Commit

Permalink
test: Assert that multi-level match works
Browse files Browse the repository at this point in the history
Closes #153.
  • Loading branch information
bebraw committed Dec 11, 2020
1 parent 6d8f6a4 commit 7231d6c
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions test/merge-with-rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,77 @@ describe("Merge with rules", function () {

expect(_mergeWithExplicitRule(a, b)).toEqual(result);
});

it("should work with multi-level match (#153)", function () {
const a = {
module: {
rules: [
{
test: /\.(sa|sc|c)ss/,
use: [
{
loader: "css-loader",
options: {
importLoaders: 2,
modules: { auto: true },
},
},
],
},
],
},
};
const b = {
module: {
rules: [
{
test: /\.(sa|sc|c)ss/,
use: [
{
loader: "css-loader",
options: {
modules: {
localIdentName: "[hash:base64]",
},
},
},
],
},
],
},
};
const result = {
module: {
rules: [
{
test: /\.(sa|sc|c)ss/,
use: [
{
loader: "css-loader",
options: {
importLoaders: 2,
modules: { auto: true },
},
},
],
},
],
},
};
const mergeRules = mergeWithRules({
module: {
rules: {
test: CustomizeRule.Match,
use: {
loader: CustomizeRule.Match,
options: {
modules: CustomizeRule.Append,
},
},
},
},
});

expect(mergeRules(a, b)).toEqual(result);
});
});

0 comments on commit 7231d6c

Please sign in to comment.