2017-03-25 05:17:47 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const WebpackError = require("../lib/WebpackError");
|
|
|
|
|
|
|
|
describe("WebpackError", () => {
|
|
|
|
class CustomError extends WebpackError {
|
|
|
|
constructor(message) {
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.name = "CustomError";
|
|
|
|
this.message = "CustomMessage";
|
|
|
|
this.details = "CustomDetails";
|
|
|
|
|
|
|
|
Error.captureStackTrace(this, this.constructor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-24 20:17:21 +08:00
|
|
|
it("Should provide inspect method for use by for util.inspect", () => {
|
2018-12-15 22:20:51 +08:00
|
|
|
const error = new CustomError("Message");
|
|
|
|
expect(error.toString()).toContain("CustomError: CustomMessage");
|
|
|
|
expect(error.stack).toContain(__filename);
|
2017-03-25 05:17:47 +08:00
|
|
|
});
|
|
|
|
});
|