Skip to content

Commit 6441a35

Browse files
committed
use makerelative method in test
1 parent 385769b commit 6441a35

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

‎test/RecordIdsPlugin.test.js‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* globals describe, before, it */
12
"use strict";
23

34
const should = require("should");
@@ -7,19 +8,6 @@ const webpack = require("../lib/webpack");
78

89
const RecordIdsPlugin = require("../lib/RecordIdsPlugin");
910

10-
const looksLikeAbsolutePath = (maybeAbsolutePath) => /^(?:[a-z]:\\|\/)/i.test(maybeAbsolutePath);
11-
12-
function makeRelative(compiler, identifier) {
13-
const context = compiler.context;
14-
return identifier.split("|")
15-
.map(str => str.split("!")
16-
.map(str => str.split(" ")
17-
.map(str => looksLikeAbsolutePath(str) ? path.relative(context, str) : str)
18-
.join(" "))
19-
.join("!"))
20-
.join("|");
21-
}
22-
2311
describe("RecordIdsPlugin", () => {
2412

2513
let compiler;
@@ -46,7 +34,7 @@ describe("RecordIdsPlugin", () => {
4634
for(let i = 0; i < compilation.modules.length; i++) {
4735
try {
4836
should.exist(compilation.modules[i].portableId);
49-
compilation.modules[i].portableId.should.equal(makeRelative(compiler, compilation.modules[i].identifier()));
37+
compilation.modules[i].portableId.should.equal(RecordIdsPlugin.makeRelative(compiler.context, compilation.modules[i].identifier()));
5038
} catch(e) {
5139
done(e);
5240
pass = false;

0 commit comments

Comments
 (0)