mirror of https://github.com/webpack/webpack.git
Modified Tests as suggested.
This commit is contained in:
parent
5b5f1d49b6
commit
01281184d9
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue