diff --git a/ts/export/packer/local.ts b/ts/export/packer/local.ts index afdf1c5255..63d13179da 100644 --- a/ts/export/packer/local.ts +++ b/ts/export/packer/local.ts @@ -14,6 +14,5 @@ export class LocalPacker extends Packer { pack(path: string): void { this.stream = fs.createWriteStream(path); super.pack(this.stream); - this.stream.close(); } } \ No newline at end of file diff --git a/ts/tests/export/localPackerTest.ts b/ts/tests/export/localPackerTest.ts index bad36cba4c..af034e6653 100644 --- a/ts/tests/export/localPackerTest.ts +++ b/ts/tests/export/localPackerTest.ts @@ -3,6 +3,7 @@ /// /// +import * as fs from "fs"; import {LocalPacker} from "../../export/packer/local"; import {assert} from "chai"; import {Document} from "../../docx/document"; @@ -35,8 +36,23 @@ describe("Packer", () => { describe("#pack()", () => { it("should create a standard docx file", function (done) { this.timeout(99999999); - packer.pack("build/tests/test.docx"); - setTimeout(done, 1900); + packer.pack("build-tests/tests/test.docx"); + let int = setInterval(() => { + const stats = fs.statSync("build-tests/tests/test.docx"); + if (stats.size > 2000) { + clearInterval(int); + clearTimeout(out); + done(); + } + }, 1000); + let out = setTimeout(() => { + clearInterval(int); + try { + assert(false, 'did not create a file within the alloted time'); + } catch (e){ + done(e); + } + }, 2000); }); }); }); \ No newline at end of file