From 6016d6006c9c34bd8baf86fbdc9a426288e62ff0 Mon Sep 17 00:00:00 2001 From: Novout Date: Sat, 17 Jun 2023 12:42:59 -0300 Subject: [PATCH] fix(runner): base options --- packages/pdfeasy/src/resolvers.ts | 2 +- packages/pdfeasy/src/runner.ts | 7 +++---- packages/pdfeasy/vitest.config.ts | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/pdfeasy/src/resolvers.ts b/packages/pdfeasy/src/resolvers.ts index 4a94f3a..28deaf2 100644 --- a/packages/pdfeasy/src/resolvers.ts +++ b/packages/pdfeasy/src/resolvers.ts @@ -19,7 +19,7 @@ export const resolveRunnerOptions = ( ): RunOptions => { return { type: options.type || isBrowser ? 'client' : 'server', - clientEmit: options.clientEmit || isBrowser ? 'blob' : 'none', + clientEmit: options.clientEmit || 'blob', serverPath: options.serverPath || '/', colorSchema: options.colorSchema || 'RGB', cwd: options?.cwd || !isBrowser ? process.cwd() : '/', diff --git a/packages/pdfeasy/src/runner.ts b/packages/pdfeasy/src/runner.ts index 8e78b8b..66517c4 100644 --- a/packages/pdfeasy/src/runner.ts +++ b/packages/pdfeasy/src/runner.ts @@ -321,9 +321,8 @@ export class PDFEasy { if (this.runOptions?.type === 'server') { this.pdfkit?.pipe( createWriteStream( - path.resolve( - (options?.cwd || process.cwd()) + this.runOptions.serverPath - ) + `/${this.options?.exports?.name || 'New PDF'}.pdf` + path.resolve(this.runOptions.cwd + this.runOptions.serverPath) + + `/${this.options?.exports?.name || 'New PDF'}.pdf` ) ) @@ -366,7 +365,7 @@ export class PDFEasy { }) stream.on('finish', (): void => { - switch (options?.clientEmit || 'blob') { + switch (this.runOptions?.clientEmit) { case 'blob': res(stream.toBlobURL('application/pdf') as string) break diff --git a/packages/pdfeasy/vitest.config.ts b/packages/pdfeasy/vitest.config.ts index 2f9bf1f..9cd8670 100644 --- a/packages/pdfeasy/vitest.config.ts +++ b/packages/pdfeasy/vitest.config.ts @@ -3,6 +3,7 @@ import { defineConfig } from 'vite' export default defineConfig({ test: { + testTimeout: 10000, environment: 'happy-dom', coverage: { include: ['src'],