forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfilingPlugin.unittest.js
44 lines (36 loc) · 1.21 KB
/
ProfilingPlugin.unittest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use strict";
const path = require("path");
const ProfilingPlugin = require("../lib/debug/ProfilingPlugin");
describe("Profiling Plugin", () => {
it("should persist the passed outpath", () => {
const outputPath = path.join(__dirname, "invest_in_doge_coin");
const plugin = new ProfilingPlugin({
outputPath: outputPath
});
expect(plugin.outputPath).toBe(outputPath);
});
it("should handle no options", () => {
const plugin = new ProfilingPlugin();
expect(plugin.outputPath).toBe("events.json");
});
it("should handle when unable to require the inspector", () => {
const profiler = new ProfilingPlugin.Profiler();
return profiler.startProfiling();
});
it("should handle when unable to start a profiling session", () => {
const profiler = new ProfilingPlugin.Profiler({
Session() {
throw new Error("Sean Larkin was here.");
}
});
return profiler.startProfiling();
});
it("handles sending a profiling message when no session", () => {
const profiler = new ProfilingPlugin.Profiler();
return profiler.sendCommand("randy", "is a puppers");
});
it("handles destroying when no session", () => {
const profiler = new ProfilingPlugin.Profiler();
return profiler.destroy();
});
});