Modified Tests as suggested.

This commit is contained in:
Navi Marella 2018-12-28 16:21:24 -07:00
parent 5b5f1d49b6
commit 01281184d9
2 changed files with 30 additions and 23 deletions

View File

@ -0,0 +1,30 @@
"use strict";
const path = require("path");
const fs = require("fs");
const webpack = require("../");
const rimraf = require("rimraf");
describe("Profiling Plugin", function() {
it("should handle output path with folder creation", done => {
const finalPath = "test/js/profilingPath/events.json";
const outputPath = path.join(__dirname, "/js/profilingPath");
rimraf(outputPath, () => {
const compiler = webpack({
context: "/",
entry: "./fixtures/a.js",
plugins: [
new webpack.debug.ProfilingPlugin({
outputPath: finalPath
})
]
});
compiler.run(err => {
if (err) return done(err);
if (!fs.existsSync(outputPath))
return done(new Error("Folder should be created."));
done();
});
});
});
});

View File

@ -1,9 +1,6 @@
"use strict";
const ProfilingPlugin = require("../lib/debug/ProfilingPlugin");
const path = require("path");
const fs = require("fs");
const webpack = require("../");
describe("Profiling Plugin", () => {
it("should persist the passed outpath", () => {
@ -18,26 +15,6 @@ describe("Profiling Plugin", () => {
expect(plugin.outputPath).toBe("events.json");
});
it("should handle outpath with folder", done => {
const finalPath = "test/fixtures/profilingPath/events.json";
const compiler = webpack({
context: "/",
entry: "./fixtures/a.js",
plugins: [
new webpack.debug.ProfilingPlugin({
outputPath: finalPath
})
]
});
const outputPath = path.join(__dirname, "/fixtures/profilingPath");
compiler.run(err => {
if (err) return done(err);
if (!fs.existsSync(outputPath))
return done(new Error("Folder should be created."));
done();
});
});
it("should handle when unable to require the inspector", () => {
const profiler = new ProfilingPlugin.Profiler();
return profiler.startProfiling();