Fix linting and add new lint rules
This commit is contained in:
@ -25,7 +25,7 @@ describe("Compiler", () => {
|
||||
});
|
||||
|
||||
describe("#compile()", () => {
|
||||
it("should pack all the content", async function () {
|
||||
it("should pack all the content", function () {
|
||||
this.timeout(99999999);
|
||||
const file = new File({
|
||||
sections: [],
|
||||
@ -53,7 +53,7 @@ describe("Compiler", () => {
|
||||
expect(fileNames).to.include("_rels/.rels");
|
||||
});
|
||||
|
||||
it("should pack all additional headers and footers", async function () {
|
||||
it("should pack all additional headers and footers", function () {
|
||||
const file = new File({
|
||||
sections: [
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ describe("Packer", () => {
|
||||
assert.isTrue(buffer.byteLength > 0);
|
||||
});
|
||||
|
||||
it("should handle exception if it throws any", async () => {
|
||||
it("should handle exception if it throws any", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const compiler = stub((Packer as any).compiler, "compile");
|
||||
|
||||
@ -139,7 +139,7 @@ describe("Packer", () => {
|
||||
const stream = await Packer.toStream(file);
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.on("error", () => {
|
||||
reject();
|
||||
reject(new Error());
|
||||
});
|
||||
|
||||
stream.on("end", () => {
|
||||
@ -148,7 +148,7 @@ describe("Packer", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle exception if it throws any", async () => {
|
||||
it("should handle exception if it throws any", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const compiler = stub((Packer as any).compiler, "compile").callsFake(() => ({
|
||||
// tslint:disable-next-line: no-empty
|
||||
@ -160,9 +160,11 @@ describe("Packer", () => {
|
||||
}));
|
||||
|
||||
compiler.throwsException();
|
||||
return Packer.toStream(file).catch((error) => {
|
||||
try {
|
||||
Packer.toStream(file);
|
||||
} catch (error) {
|
||||
assert.isDefined(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -58,7 +58,7 @@ export class Packer {
|
||||
return zipData;
|
||||
}
|
||||
|
||||
public static async toStream(file: File, prettify?: boolean | PrettifyType): Promise<Stream> {
|
||||
public static toStream(file: File, prettify?: boolean | PrettifyType): Stream {
|
||||
const zip = this.compiler.compile(file, prettify);
|
||||
const zipData = zip.generateNodeStream({
|
||||
type: "nodebuffer",
|
||||
|
Reference in New Issue
Block a user