From 5900de618477c40e9bd0427296b1d8f4342a75cf Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 15 Jul 2022 15:59:07 +0200 Subject: [PATCH] Show deprecation warning for maxParallelFileReads --- src/utils/options/normalizeInputOptions.ts | 2 +- .../max-parallel-file-reads/infinity/_config.js | 9 ++++++++- .../deprecated/max-parallel-file-reads/set/_config.js | 9 ++++++++- .../max-parallel-file-reads/with-plugin/_config.js | 9 ++++++++- test/misc/sanity-checks.js | 7 +++++-- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/utils/options/normalizeInputOptions.ts b/src/utils/options/normalizeInputOptions.ts index 5353f2ed7ed..abd4e48264f 100644 --- a/src/utils/options/normalizeInputOptions.ts +++ b/src/utils/options/normalizeInputOptions.ts @@ -185,7 +185,7 @@ const getmaxParallelFileOps = ( if (typeof maxParallelFileReads === 'number') { warnDeprecationWithOptions( 'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', - false, + true, warn, strictDeprecations ); diff --git a/test/function/samples/deprecated/max-parallel-file-reads/infinity/_config.js b/test/function/samples/deprecated/max-parallel-file-reads/infinity/_config.js index 675b373f52d..60ff67b917f 100644 --- a/test/function/samples/deprecated/max-parallel-file-reads/infinity/_config.js +++ b/test/function/samples/deprecated/max-parallel-file-reads/infinity/_config.js @@ -25,5 +25,12 @@ module.exports = { after() { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 5, 'Wrong number of parallel file reads: ' + maxReads); - } + }, + warnings: [ + { + code: 'DEPRECATED_FEATURE', + message: + 'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.' + } + ] }; diff --git a/test/function/samples/deprecated/max-parallel-file-reads/set/_config.js b/test/function/samples/deprecated/max-parallel-file-reads/set/_config.js index b7e23dd4c46..70e85c00285 100644 --- a/test/function/samples/deprecated/max-parallel-file-reads/set/_config.js +++ b/test/function/samples/deprecated/max-parallel-file-reads/set/_config.js @@ -25,5 +25,12 @@ module.exports = { after() { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 3, 'Wrong number of parallel file reads: ' + maxReads); - } + }, + warnings: [ + { + code: 'DEPRECATED_FEATURE', + message: + 'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.' + } + ] }; diff --git a/test/function/samples/deprecated/max-parallel-file-reads/with-plugin/_config.js b/test/function/samples/deprecated/max-parallel-file-reads/with-plugin/_config.js index 23524bf811d..709a8fd3ef9 100644 --- a/test/function/samples/deprecated/max-parallel-file-reads/with-plugin/_config.js +++ b/test/function/samples/deprecated/max-parallel-file-reads/with-plugin/_config.js @@ -32,5 +32,12 @@ module.exports = { after() { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 3, 'Wrong number of parallel file reads: ' + maxReads); - } + }, + warnings: [ + { + code: 'DEPRECATED_FEATURE', + message: + 'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.' + } + ] }; diff --git a/test/misc/sanity-checks.js b/test/misc/sanity-checks.js index e7534f1826d..1a36f02f680 100644 --- a/test/misc/sanity-checks.js +++ b/test/misc/sanity-checks.js @@ -197,10 +197,13 @@ describe('sanity checks', () => { it('does not throw when using dynamic imports with the "file" option and "inlineDynamicImports"', async () => { const bundle = await rollup.rollup({ input: 'x', - inlineDynamicImports: true, plugins: [loader({ x: 'console.log( "x" );import("y");', y: 'console.log( "y" );' })] }); - await bundle.generate({ file: 'x', format: 'es' }); + await bundle.generate({ + file: 'x', + format: 'es', + inlineDynamicImports: true + }); }); it('throws when using the object form of "input" together with the "file" option', async () => {