Skip to content

Commit 862ea7d

Browse files
committedOct 20, 2021
fix: allow interpolateName works without options
1 parent f37156e commit 862ea7d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
 

‎lib/interpolateName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const path = require("path");
44
const getHashDigest = require("./getHashDigest");
55

6-
function interpolateName(loaderContext, name, options) {
6+
function interpolateName(loaderContext, name, options = {}) {
77
let filename;
88

99
const hasQuery =

‎test/interpolateName.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,11 @@ describe("interpolateName()", () => {
263263
],
264264
]);
265265

266-
it("should return the same emoji for the same string", () => {
267-
const args = [{}, "[emoji:5]", { content: "same_emoji" }];
268-
const result1 = loaderUtils.interpolateName.apply(loaderUtils, args);
269-
const result2 = loaderUtils.interpolateName.apply(loaderUtils, args);
266+
it("should work without options", () => {
267+
const args = [{}, "foo/bar/[hash]"];
268+
const result = loaderUtils.interpolateName.apply(loaderUtils, args);
270269

271-
expect(result1).toBe(result2);
270+
expect(result).toBe("foo/bar/[hash]");
272271
});
273272

274273
describe("no loader context", () => {

0 commit comments

Comments
 (0)
Please sign in to comment.