From: Jérôme Benoit Date: Mon, 25 Sep 2023 19:52:26 +0000 (+0200) Subject: fix: fix coverage report by disabling sourcemap in build used in UTs X-Git-Tag: v2.7.5~43 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f8496b2247cb7e47192173307d690c33c4deaf2c;p=poolifier.git fix: fix coverage report by disabling sourcemap in build used in UTs Signed-off-by: Jérôme Benoit --- diff --git a/@types/events.d.ts b/@types/events.d.ts index ae0f8f50..1432a57e 100644 --- a/@types/events.d.ts +++ b/@types/events.d.ts @@ -14,7 +14,7 @@ declare module 'events' { EventEmitterOptions { /** * The type of async event. - * @default new.target.name + * @default new.target.name if instantiated from a child class. */ name?: string } @@ -30,7 +30,7 @@ declare module 'events' { * @since v17.4.0, v16.14.0 */ export class EventEmitterAsyncResource extends EventEmitter { - constructor (options?: EventEmitterAsyncResourceOptions) + constructor (options: EventEmitterAsyncResourceOptions) /** * Call all `destroy` hooks. This should only ever be called once. An error will * be thrown if it is called more than once. This **must** be manually called. If diff --git a/package.json b/package.json index 1a8d9617..396c9e5b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "benchmark": "pnpm build && node -r source-map-support/register benchmarks/internal/bench.mjs", "benchmark:debug": "pnpm build && node -r source-map-support/register --inspect benchmarks/internal/bench.mjs", "benchmark:prod": "pnpm build:prod && node benchmarks/internal/bench.mjs", - "test": "pnpm build && c8 mocha 'tests/**/*.test.js'", + "test": "pnpm build --environment SOURCEMAP:false && c8 mocha 'tests/**/*.test.js'", "test:debug": "pnpm build && mocha --no-parallel --inspect 'tests/**/*.test.js'", "coverage": "c8 report --reporter=lcov", "coverage:html": "c8 report --reporter=html", diff --git a/rollup.config.mjs b/rollup.config.mjs index 8f1f2656..3d069f7f 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -24,6 +24,7 @@ const availableParallelism = () => { const isDevelopmentBuild = env.BUILD === 'development' const isAnalyzeBuild = env.ANALYZE const isDocumentationBuild = env.DOCUMENTATION +const sourcemap = env.SOURCEMAP !== 'false' const maxWorkers = Math.floor(availableParallelism() / 2) @@ -36,21 +37,21 @@ export default defineConfig([ format: 'cjs', ...(isDevelopmentBuild && { dir: './lib', - sourcemap: true, preserveModules: true, preserveModulesRoot: './src' }), ...(!isDevelopmentBuild && { file: './lib/index.js', - sourcemap: true, plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) }, { format: 'esm', ...(isDevelopmentBuild && { dir: './lib', - sourcemap: true, entryFileNames: '[name].mjs', chunkFileNames: '[name]-[hash].mjs', preserveModules: true, @@ -58,8 +59,10 @@ export default defineConfig([ }), ...(!isDevelopmentBuild && { file: './lib/index.mjs', - sourcemap: true, plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) } ],