Skip to content

Commit 0128118

Browse files
committed
Modified Tests as suggested.
1 parent 5b5f1d4 commit 0128118

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

test/ProfilingPlugin.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
3+
const path = require("path");
4+
const fs = require("fs");
5+
const webpack = require("../");
6+
const rimraf = require("rimraf");
7+
8+
describe("Profiling Plugin", function() {
9+
it("should handle output path with folder creation", done => {
10+
const finalPath = "test/js/profilingPath/events.json";
11+
const outputPath = path.join(__dirname, "/js/profilingPath");
12+
rimraf(outputPath, () => {
13+
const compiler = webpack({
14+
context: "/",
15+
entry: "./fixtures/a.js",
16+
plugins: [
17+
new webpack.debug.ProfilingPlugin({
18+
outputPath: finalPath
19+
})
20+
]
21+
});
22+
compiler.run(err => {
23+
if (err) return done(err);
24+
if (!fs.existsSync(outputPath))
25+
return done(new Error("Folder should be created."));
26+
done();
27+
});
28+
});
29+
});
30+
});

test/ProfilingPlugin.unittest.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"use strict";
22

33
const ProfilingPlugin = require("../lib/debug/ProfilingPlugin");
4-
const path = require("path");
5-
const fs = require("fs");
6-
const webpack = require("../");
74

85
describe("Profiling Plugin", () => {
96
it("should persist the passed outpath", () => {
@@ -18,26 +15,6 @@ describe("Profiling Plugin", () => {
1815
expect(plugin.outputPath).toBe("events.json");
1916
});
2017

21-
it("should handle outpath with folder", done => {
22-
const finalPath = "test/fixtures/profilingPath/events.json";
23-
const compiler = webpack({
24-
context: "/",
25-
entry: "./fixtures/a.js",
26-
plugins: [
27-
new webpack.debug.ProfilingPlugin({
28-
outputPath: finalPath
29-
})
30-
]
31-
});
32-
const outputPath = path.join(__dirname, "/fixtures/profilingPath");
33-
compiler.run(err => {
34-
if (err) return done(err);
35-
if (!fs.existsSync(outputPath))
36-
return done(new Error("Folder should be created."));
37-
done();
38-
});
39-
});
40-
4118
it("should handle when unable to require the inspector", () => {
4219
const profiler = new ProfilingPlugin.Profiler();
4320
return profiler.startProfiling();

0 commit comments

Comments
 (0)