From 64870c31062983a741832d8cd2d4bcdf55e4de55 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 1 May 2023 07:11:30 +0200 Subject: [PATCH] test: enable typecheck for _config files (#4954) * chore: init * chore: basic * chore: revert vscode config * chore: fix syntax error * chore: improve typecheck * feat: different types based on dirs * chore: update * chore: update * fix: fix some type error * chore: disable check js for now * chore: update * chore: update * chore: fix emission issue in WebStorm * Fix some type issues * Use correct properties per test type --------- Co-authored-by: Lukas Taegert-Atkinson --- .eslintrc.js | 6 + .gitignore | 1 + .vscode/settings.json | 4 +- package-lock.json | 13 + package.json | 1 + src/rollup/types.d.ts | 2 +- test/browser/define.d.ts | 5 + test/browser/index.js | 107 ++++---- test/browser/samples/basic/_config.js | 4 +- .../missing-dependency-resolution/_config.js | 4 +- .../missing-entry-resolution/_config.js | 4 +- test/browser/samples/missing-load/_config.js | 5 +- .../renormalizes-external-paths/_config.js | 5 +- .../samples/supports-hashes/_config.js | 4 +- test/browser/tsconfig.json | 8 + test/chunking-form/define.d.ts | 5 + test/chunking-form/index.js | 6 + .../samples/aliasing-extensions/_config.js | 4 +- .../amd-id-auto-base-path-concat/_config.js | 4 +- .../samples/amd-id-auto-base-path/_config.js | 4 +- .../samples/amd-id-auto/_config.js | 4 +- .../_config.js | 4 +- .../asset-needs-code-reference/_config.js | 4 +- .../avoid-chunk-import-hoisting/_config.js | 4 +- .../samples/basic-chunking/_config.js | 4 +- .../chunk-deshadowing-reassignment/_config.js | 4 +- .../samples/chunk-execution-order/_config.js | 4 +- .../chunk-export-deshadowing/_config.js | 4 +- .../samples/chunk-export-renaming/_config.js | 4 +- .../chunk-import-deshadowing/_config.js | 4 +- .../samples/chunk-live-bindings/_config.js | 4 +- .../chunk-namespace-boundary/_config.js | 4 +- .../samples/chunk-naming/_config.js | 4 +- .../chunk-variable-name-conflict/_config.js | 4 +- .../samples/chunking-compact/_config.js | 4 +- .../samples/chunking-externals/_config.js | 4 +- .../samples/chunking-reexport/_config.js | 4 +- .../samples/chunking-source-maps/_config.js | 4 +- .../samples/chunking-star-external/_config.js | 4 +- .../samples/circular-entry-points/_config.js | 4 +- .../samples/circular-entry-points2/_config.js | 4 +- .../samples/circular-entry-points3/_config.js | 4 +- .../samples/circular-manual-chunks/_config.js | 4 +- .../combined-namespace-reexport/_config.js | 4 +- .../samples/custom-sanitizer/_config.js | 5 +- .../samples/deconflict-globals/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../default-export-name-conflict/_config.js | 4 +- .../default-identifier-renaming/_config.js | 4 +- .../default-reexport-namespace/_config.js | 4 +- .../avoid-imports-preserve-modules/_config.js | 4 +- .../circular-manual-chunks/_config.js | 4 +- .../dynamic-import-comments/_config.js | 4 +- .../dynamic-import-inlining-object/_config.js | 4 +- .../deprecated/dynamic-import-name/_config.js | 4 +- .../emit-file-chunk-facade/_config.js | 4 +- .../empty-module-no-treeshake/_config.js | 5 +- .../_config.js | 4 +- .../manual-chunk-avoid-facade/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../manual-chunk-is-entry-conflict/_config.js | 4 +- .../manual-chunk-is-entry-match/_config.js | 4 +- .../manual-chunks-different-nested/_config.js | 4 +- .../manual-chunks-dynamic-facades/_config.js | 4 +- .../_config.js | 4 +- .../manual-chunks-dynamic/_config.js | 4 +- .../manual-chunks-function/_config.js | 4 +- .../manual-chunks-nested/_config.js | 4 +- .../deprecated/manual-chunks/_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-default-mode/_config.js | 4 +- .../dynamic-import/_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-commonjs/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-empty/_config.js | 4 +- .../preserve-modules-export-alias/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-nested-export/_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-proxy-import/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-single-entry/_config.js | 4 +- .../_config.js | 4 +- .../deprecated/preserve-modules/_config.js | 4 +- .../samples/dynamic-import-chained/_config.js | 4 +- .../dynamic-import-chunking/_config.js | 4 +- .../dynamic-import-comments/_config.js | 4 +- .../samples/dynamic-import-dynamic/_config.js | 4 +- .../dynamic-import-external/_config.js | 4 +- .../samples/dynamic-import-facade/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-inlining-object/_config.js | 4 +- .../dynamic-import-only-default/_config.js | 4 +- .../dynamic-import-only-reexports/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-tree-shaking-1/_config.js | 4 +- .../dynamic-import-tree-shaking-2/_config.js | 4 +- .../samples/dynamic-import/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../emit-file/asset-file-names/_config.js | 4 +- .../deconflict-against-named-files/_config.js | 4 +- .../emit-file/deduplicate-assets/_config.js | 4 +- .../emit-asset-without-name/_config.js | 4 +- .../emit-file/emit-chunk-facade/_config.js | 4 +- .../emit-file/emit-chunk-filename/_config.js | 4 +- .../emit-chunk-name-conflict/_config.js | 4 +- .../emit-file/emit-chunk-named/_config.js | 4 +- .../emit-file/emit-chunk-order1/_config.js | 4 +- .../emit-file/emit-chunk-order2/_config.js | 4 +- .../emit-chunk-with-importer/_config.js | 4 +- .../emit-file/emit-chunk-worker/_config.js | 4 +- .../emit-file/emit-chunk-worklet/_config.js | 4 +- .../samples/emit-file/emit-chunk/_config.js | 4 +- .../emit-file/emits-existing-chunk/_config.js | 4 +- .../emits-files-from-various-hooks/_config.js | 4 +- .../_config.js | 4 +- .../filenames-function-patterns/_config.js | 5 +- .../emit-file/named-user-chunks/_config.js | 4 +- .../emit-file/reference-files/_config.js | 7 +- .../emit-file/sanitize-file-name/_config.js | 4 +- .../emit-file/set-asset-source/_config.js | 4 +- .../samples/empty-chunks/_config.js | 4 +- .../empty-module-no-treeshake/_config.js | 5 +- .../samples/entry-aliases/_config.js | 4 +- .../entry-chunk-export-mode/_config.js | 4 +- .../entry-point-without-own-code/_config.js | 4 +- .../samples/entrypoint-aliasing/_config.js | 4 +- .../samples/entrypoint-facade/_config.js | 4 +- .../export-default-from-entry/_config.js | 4 +- .../samples/external-imports/_config.js | 4 +- .../samples/external-reexports/_config.js | 4 +- .../samples/filenames-patterns/_config.js | 4 +- .../arrow-functions-false/_config.js | 4 +- .../arrow-functions-true/_config.js | 4 +- .../reserved-names-as-props-false/_config.js | 4 +- .../reserved-names-as-props-true/_config.js | 4 +- .../hashing/deconflict-hashes/_config.js | 4 +- .../samples/hashing/double-hash/_config.js | 4 +- .../samples/hashing/hash-size/_config.js | 4 +- .../samples/hashing/random-match/_config.js | 4 +- .../tree-shaken-dynamic-hash/_config.js | 4 +- .../ignore-chunk-name-query/_config.js | 4 +- .../dependant-entry-no-effects/_config.js | 4 +- .../_config.js | 4 +- .../implicitly-dependent-entry/_config.js | 4 +- .../multiple-dependencies/_config.js | 4 +- .../_config.js | 4 +- .../preserve-signature-false/_config.js | 4 +- .../preserve-signature-strict/_config.js | 4 +- .../same-chunk-dependency/_config.js | 4 +- .../_config.js | 4 +- .../shared-dependency-reexport/_config.js | 4 +- .../single-dependency/_config.js | 4 +- .../import-meta-numeric-paths/_config.js | 4 +- .../samples/import-meta-url/_config.js | 4 +- .../import-variable-duplicates/_config.js | 4 +- .../chained-dynamic-with-shared/_config.js | 4 +- .../circular-dynamic-imports/_config.js | 4 +- .../cut-off/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-dynamic/_config.js | 4 +- .../dynamic-not-in-memory/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../single-dynamic/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../manual-chunk-avoid-facade/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../manual-chunk-is-entry-conflict/_config.js | 4 +- .../manual-chunk-is-entry-match/_config.js | 4 +- .../manual-chunk-not-included/_config.js | 4 +- .../manual-chunks-different-nested/_config.js | 4 +- .../manual-chunks-dynamic-facades/_config.js | 4 +- .../_config.js | 4 +- .../samples/manual-chunks-dynamic/_config.js | 4 +- .../samples/manual-chunks-function/_config.js | 4 +- .../samples/manual-chunks-nested/_config.js | 4 +- .../samples/manual-chunks/_config.js | 4 +- .../max-parallel-file-operations/_config.js | 4 +- .../avoid-circular-dependencies/_config.js | 4 +- .../avoid-transitive-side-effects/_config.js | 4 +- .../best-merge-target/_config.js | 4 +- .../ignore-correlated-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../merge-chunk-into-shared/_config.js | 4 +- .../merge-correlated-side-effects/_config.js | 4 +- .../merge-dependency-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../merge-dynamic-imports/_config.js | 4 +- .../merge-small-side-effect-chunks/_config.js | 4 +- .../min-chunk-size/merge-unrelated/_config.js | 4 +- .../no-merge-for-big-chunks/_config.js | 4 +- .../no-merge-side-effects/_config.js | 4 +- .../prefer-close-merge-target-a/_config.js | 4 +- .../prefer-close-merge-target-b/_config.js | 4 +- .../prefer-small-merge-target-a/_config.js | 4 +- .../prefer-small-merge-target-b/_config.js | 4 +- .../minify-internal-exports/_config.js | 4 +- .../samples/missing-export-compact/_config.js | 4 +- .../_config.js | 4 +- .../samples/missing-export/_config.js | 4 +- .../samples/multi-chunking/_config.js | 4 +- .../samples/multiple-entry-points/_config.js | 4 +- .../namespace-imports-from-chunks/_config.js | 4 +- .../namespace-object-import/_config.js | 4 +- .../_config.js | 4 +- .../samples/namespace-reexports/_config.js | 4 +- .../samples/namespace-retracing/_config.js | 4 +- .../dynamic-import-default-mode/_config.js | 4 +- .../dynamic-import/_config.js | 4 +- .../samples/namespace-tracing/_config.js | 4 +- .../samples/nested-chunks/_config.js | 4 +- .../samples/nested-dynamic-imports/_config.js | 4 +- .../no-minify-internal-exports/_config.js | 4 +- .../samples/no-treeshake-imports/_config.js | 4 +- .../allow-extension/_config.js | 4 +- .../exports-only-no-exports/_config.js | 4 +- .../exports-only/_config.js | 4 +- .../false/_config.js | 4 +- .../override-via-plugin/_config.js | 4 +- .../strict/_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-commonjs/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/preserve-modules-empty/_config.js | 4 +- .../preserve-modules-export-alias/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-nested-export/_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-proxy-import/_config.js | 4 +- .../_config.js | 4 +- .../samples/preserve-modules-root/_config.js | 4 +- .../_config.js | 4 +- .../preserve-modules-single-entry/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/preserve-modules/_config.js | 4 +- .../samples/reexport-from-entry/_config.js | 4 +- .../samples/reexport-shortpaths/_config.js | 4 +- .../samples/render-chunk-transform/_config.js | 4 +- .../samples/render-chunk/_config.js | 4 +- .../samples/render-dynamic-import/_config.js | 4 +- .../samples/resolve-dynamic-import/_config.js | 4 +- .../samples/resolve-file-url/_config.js | 4 +- .../samples/sanitize-chunk-names/_config.js | 4 +- .../sanitize-internal-exports/_config.js | 4 +- .../avoid-imports-preserve-modules/_config.js | 4 +- .../_config.js | 4 +- .../hoist-side-effect-modules/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../single-file-manual-chunk/_config.js | 4 +- .../chained-default-reexport/_config.js | 4 +- .../_config.js | 4 +- .../default-reexport/_config.js | 4 +- .../dynamic-import/_config.js | 4 +- .../synthetic-named-exports/entry/_config.js | 4 +- .../global-conflict/_config.js | 4 +- .../_config.js | 5 +- .../mixed-synthetic-named-exports/_config.js | 6 +- .../multi-level/_config.js | 4 +- .../namespace/_config.js | 4 +- .../_config.js | 4 +- test/chunking-form/tsconfig.json | 8 + test/cli/define.d.ts | 5 + test/cli/index.js | 11 +- .../samples/allow-output-prefix/_config.js | 4 +- test/cli/samples/amd/_config.js | 4 +- .../banner-intro-outro-footer/_config.js | 4 +- .../_config.js | 4 +- .../code-splitting-named-inputs/_config.js | 4 +- .../samples/config-async-function/_config.js | 4 +- .../cli/samples/config-cjs-dirname/_config.js | 4 +- .../_config.js | 4 +- .../config-cwd-case-insensitive/_config.js | 4 +- .../config-defineConfig-cjs/_config.js | 4 +- .../config-defineConfig-mjs/_config.js | 4 +- .../samples/config-env-multiple/_config.js | 4 +- test/cli/samples/config-env/_config.js | 4 +- test/cli/samples/config-es6/_config.js | 4 +- .../config-external-function/_config.js | 4 +- test/cli/samples/config-external/_config.js | 4 +- .../config-function-modify-command/_config.js | 4 +- test/cli/samples/config-function/_config.js | 4 +- .../cli/samples/config-import-meta/_config.js | 4 +- test/cli/samples/config-json/_config.js | 4 +- .../samples/config-missing-export/_config.js | 4 +- .../cli/samples/config-mjs-plugins/_config.js | 4 +- test/cli/samples/config-mjs/_config.js | 4 +- .../config-multiple-getfilename/_config.js | 4 +- .../config-multiple-source-maps/_config.js | 4 +- test/cli/samples/config-no-output/_config.js | 4 +- test/cli/samples/config-override/_config.js | 4 +- .../samples/config-plugin-entry/_config.js | 4 +- .../cli/samples/config-promise-cjs/_config.js | 4 +- .../cli/samples/config-promise-mjs/_config.js | 4 +- test/cli/samples/config-promise/_config.js | 4 +- test/cli/samples/config-true/_config.js | 4 +- test/cli/samples/config-ts/_config.js | 4 +- .../cli/samples/config-type-module/_config.js | 5 +- test/cli/samples/config-warnings/_config.js | 4 +- test/cli/samples/config/_config.js | 4 +- test/cli/samples/context/_config.js | 4 +- .../samples/custom-frame-with-pos/_config.js | 4 +- test/cli/samples/custom-frame/_config.js | 4 +- .../_config.js | 4 +- .../duplicate-import-options/_config.js | 4 +- .../emit-file-multiple-dirs/_config.js | 4 +- .../samples/empty-chunk-multiple/_config.js | 4 +- test/cli/samples/empty-chunk/_config.js | 4 +- .../external-modules-auto-global/_config.js | 4 +- test/cli/samples/external-modules/_config.js | 4 +- .../samples/fail-after-warnings/_config.js | 4 +- test/cli/samples/format-aliases/_config.js | 4 +- .../generated-code-preset-override/_config.js | 4 +- .../generated-code-unknown-preset/_config.js | 4 +- .../cli/samples/import-esm-package/_config.js | 4 +- test/cli/samples/indent-none/_config.js | 4 +- test/cli/samples/interop/_config.js | 4 +- test/cli/samples/log-side-effects/_config.js | 4 +- .../cli/samples/merge-deprecations/_config.js | 4 +- .../samples/merge-treeshake-false/_config.js | 4 +- test/cli/samples/merge-treeshake/_config.js | 4 +- test/cli/samples/module-name/_config.js | 4 +- test/cli/samples/multiple-configs/_config.js | 4 +- .../_config.js | 4 +- .../multiple-targets-shared-config/_config.js | 4 +- test/cli/samples/multiple-targets/_config.js | 4 +- test/cli/samples/no-color/_config.js | 4 +- test/cli/samples/no-conflict/_config.js | 4 +- test/cli/samples/no-strict/_config.js | 4 +- test/cli/samples/no-treeshake/_config.js | 4 +- .../node-config-auto-prefix/_config.js | 4 +- .../samples/node-config-not-found/_config.js | 4 +- test/cli/samples/node-config/_config.js | 4 +- .../samples/paths-output-option/_config.js | 4 +- .../samples/plugin/absolute-esm/_config.js | 4 +- test/cli/samples/plugin/absolute/_config.js | 4 +- .../samples/plugin/advanced-esm/_config.js | 4 +- test/cli/samples/plugin/advanced/_config.js | 4 +- test/cli/samples/plugin/basic/_config.js | 4 +- .../cli/samples/plugin/cannot-load/_config.js | 4 +- .../samples/plugin/default-export/_config.js | 4 +- .../plugin/export-not-found/_config.js | 4 +- .../plugin/invalid-argument/_config.js | 4 +- test/cli/samples/plugin/object/_config.js | 4 +- .../plugin/relative-camelized/_config.js | 4 +- .../samples/plugin/relative-esm/_config.js | 4 +- test/cli/samples/plugin/relative/_config.js | 4 +- .../property-read-side-effects/_config.js | 4 +- .../propertyReadSideEffects-always/_config.js | 4 +- test/cli/samples/silent-onwarn/_config.js | 4 +- test/cli/samples/silent/_config.js | 4 +- test/cli/samples/sourcemap-hidden/_config.js | 4 +- test/cli/samples/sourcemap-newline/_config.js | 4 +- test/cli/samples/stdin/commonjs/_config.js | 4 +- test/cli/samples/stdin/config-file/_config.js | 4 +- .../samples/stdin/force-stdin-tty/_config.js | 4 +- test/cli/samples/stdin/json/_config.js | 4 +- test/cli/samples/stdin/no-dash/_config.js | 4 +- .../stdin/no-stdin-config-file/_config.js | 4 +- .../cli/samples/stdin/no-stdin-tty/_config.js | 4 +- test/cli/samples/stdin/self-import/_config.js | 4 +- test/cli/samples/stdin/stdin-error/_config.js | 4 +- test/cli/samples/stdin/with-dash/_config.js | 4 +- .../samples/stdout-code-splitting/_config.js | 4 +- .../stdout-only-inline-sourcemaps/_config.js | 4 +- .../samples/stdout-single-input/_config.js | 4 +- test/cli/samples/symlinked-config/_config.js | 4 +- .../samples/symlinked-named-config/_config.js | 4 +- .../treeshake-preset-override/_config.js | 4 +- .../treeshake-unknown-preset/_config.js | 4 +- .../unfulfilled-hook-actions-error/_config.js | 4 +- .../_config.js | 4 +- .../unfulfilled-hook-actions/_config.js | 4 +- test/cli/samples/validate/_config.js | 4 +- .../wait-for-bundle-input-object/_config.js | 4 +- .../samples/wait-for-bundle-input/_config.js | 4 +- .../samples/warn-broken-sourcemap/_config.js | 4 +- .../samples/warn-broken-sourcemaps/_config.js | 4 +- .../samples/warn-circular-multiple/_config.js | 4 +- test/cli/samples/warn-circular/_config.js | 4 +- .../cli/samples/warn-eval-multiple/_config.js | 4 +- test/cli/samples/warn-eval/_config.js | 4 +- .../cli/samples/warn-import-export/_config.js | 4 +- .../warn-missing-global-multiple/_config.js | 4 +- .../samples/warn-missing-global/_config.js | 4 +- .../warn-mixed-exports-multiple/_config.js | 4 +- test/cli/samples/warn-multiple/_config.js | 4 +- test/cli/samples/warn-plugin-loc/_config.js | 4 +- test/cli/samples/warn-plugin/_config.js | 4 +- test/cli/samples/warn-this/_config.js | 4 +- .../samples/warn-unknown-options/_config.js | 4 +- .../cli/samples/watch/bundle-error/_config.js | 4 +- test/cli/samples/watch/clearScreen/_config.js | 4 +- test/cli/samples/watch/close-error/_config.js | 4 +- .../watch/close-on-generate-error/_config.js | 4 +- test/cli/samples/watch/close-stdin/_config.js | 4 +- .../watch/no-clearScreen-command/_config.js | 4 +- .../samples/watch/no-clearScreen/_config.js | 4 +- .../samples/watch/no-config-file/_config.js | 4 +- .../watch/no-watch-by-default/_config.js | 4 +- .../watch/no-watched-config/_config.js | 4 +- .../samples/watch/node-config-file/_config.js | 4 +- .../watch-config-early-update/_config.js | 4 +- .../watch/watch-config-error/_config.js | 4 +- .../watch-config-initial-error/_config.js | 4 +- .../watch/watch-config-no-update/_config.js | 4 +- .../watch/watch-event-hooks-error/_config.js | 4 +- .../watch/watch-event-hooks/_config.js | 4 +- test/cli/tsconfig.json | 8 + test/file-hashes/define.d.ts | 5 + test/file-hashes/index.js | 86 +++--- .../samples/augment-chunk-hash/_config.js | 4 +- test/file-hashes/samples/banner/_config.js | 4 +- .../file-hashes/samples/chunk-name/_config.js | 4 +- test/file-hashes/samples/content/_config.js | 4 +- .../samples/dependency-content/_config.js | 4 +- .../samples/export-order-2/_config.js | 4 +- .../samples/export-order/_config.js | 4 +- test/file-hashes/samples/exports/_config.js | 4 +- .../external-dependency-names/_config.js | 4 +- test/file-hashes/samples/footer/_config.js | 4 +- test/file-hashes/samples/format/_config.js | 4 +- .../samples/internal-exports/_config.js | 4 +- test/file-hashes/samples/intro/_config.js | 4 +- .../samples/name-pattern/_config.js | 4 +- test/file-hashes/samples/outro/_config.js | 4 +- .../samples/render-chunk-changes/_config.js | 4 +- test/file-hashes/tsconfig.json | 8 + test/form/define.d.ts | 5 + test/form/index.js | 141 +++++----- .../samples/absolute-path-resolver/_config.js | 5 +- .../samples/acorn-external-plugins/_config.js | 4 +- test/form/samples/addon-functions/_config.js | 5 +- test/form/samples/amd-id-auto/_config.js | 4 +- test/form/samples/amd-id/_config.js | 4 +- .../samples/amd-keep-extension/_config.js | 4 +- .../no-default-deoptimization/_config.js | 4 +- .../no-global-call-deoptimization/_config.js | 4 +- .../return-function-deoptimization/_config.js | 4 +- .../array-elements/_config.js | 4 +- .../array-mutation/_config.js | 4 +- .../array-spread/_config.js | 4 +- .../spread-element-deoptimization/_config.js | 4 +- .../arrow-function-call-parameters/_config.js | 4 +- .../arrow-function-return-values/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/assignment-to-exports/_config.js | 4 +- .../samples/assignment-to-global/_config.js | 4 +- .../samples/async-function-effects/_config.js | 4 +- .../samples/async-function-unused/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../form/samples/banner-and-footer/_config.js | 7 +- test/form/samples/base64-deshadow/_config.js | 4 +- test/form/samples/big-int/_config.js | 4 +- .../samples/binary-expressions/_config.js | 4 +- test/form/samples/block-comments/_config.js | 4 +- .../samples/body-less-for-loops/_config.js | 4 +- .../_config.js | 4 +- .../break-statement-labels-switch/_config.js | 4 +- .../break-statement-labels/_config.js | 4 +- .../break-statement-loops/_config.js | 4 +- .../caught-errors/_config.js | 4 +- .../hoisted-declarations/_config.js | 4 +- .../if-statement-breaks/_config.js | 4 +- .../if-statement-errors/_config.js | 4 +- .../break-control-flow/loop-errors/_config.js | 4 +- .../return-statements/_config.js | 4 +- .../switch-errors/_config.js | 4 +- .../thrown-errors/_config.js | 4 +- .../array-expression/_config.js | 4 +- .../_config.js | 4 +- .../builtin-prototypes/literal/_config.js | 4 +- .../object-expression/_config.js | 4 +- .../_config.js | 4 +- .../template-literal/_config.js | 4 +- .../catch-parameter-shadowing/_config.js | 4 +- .../samples/chained-assignments/_config.js | 4 +- .../circular-member-expression/_config.js | 4 +- .../class-constructor-side-effect/_config.js | 4 +- test/form/samples/class-fields/_config.js | 4 +- .../samples/class-method-access/_config.js | 4 +- .../_config.js | 4 +- .../form/samples/class-without-new/_config.js | 4 +- .../samples/comment-before-import/_config.js | 4 +- .../comment-start-inside-comment/_config.js | 4 +- .../samples/compact-empty-external/_config.js | 4 +- .../compact-multiple-imports/_config.js | 4 +- .../samples/compact-named-export/_config.js | 4 +- test/form/samples/compact/_config.js | 4 +- .../_config.js | 4 +- .../samples/computed-properties/_config.js | 4 +- .../_config.js | 4 +- .../conditional-expression-paths/_config.js | 4 +- .../samples/conditional-expression/_config.js | 4 +- .../_config.js | 4 +- .../samples/configure-file-url/_config.js | 6 +- .../samples/conflicting-imports/_config.js | 4 +- test/form/samples/curried-function/_config.js | 4 +- test/form/samples/custom-context/_config.js | 4 +- .../_config.js | 5 +- .../custom-module-context-function/_config.js | 4 +- .../samples/custom-module-context/_config.js | 4 +- .../declarations-with-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../deconflict-module-priority/_config.js | 4 +- .../deconflict-nested-tree-shaking/_config.js | 4 +- .../deconflict-tree-shaken-globals/_config.js | 4 +- .../samples/deconflict-tree-shaken/_config.js | 4 +- .../dedupes-external-imports/_config.js | 4 +- .../samples/deep-properties-access/_config.js | 4 +- test/form/samples/deep-properties/_config.js | 4 +- .../deep-switch-declarations/_config.js | 4 +- .../_config.js | 4 +- .../samples/default-export-class/_config.js | 4 +- .../default-export-live-binding/_config.js | 4 +- .../samples/default-export-mode/_config.js | 4 +- .../default-identifier-deshadowing/_config.js | 4 +- .../define-es-modules-false/_config.js | 4 +- .../samples/define-replacement/_config.js | 4 +- .../form/samples/deopt-regexp-type/_config.js | 4 +- .../deopt-string-concatenation/_config.js | 4 +- .../samples/deoptimize-superclass/_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-inlining-array/_config.js | 4 +- .../dynamic-import-inlining/_config.js | 4 +- .../_config.js | 4 +- .../entry-default/_config.js | 4 +- .../namespace-tostring/entry-named/_config.js | 4 +- .../external-namespaces/_config.js | 4 +- .../inlined-namespace/_config.js | 4 +- .../nested-inlined-dynamic-import/_config.js | 4 +- .../deprecated/prefer-const/_config.js | 4 +- .../duplicated-var-declarations/_config.js | 4 +- .../dynamic-import-inlining-array/_config.js | 4 +- .../dynamic-import-inlining/_config.js | 4 +- .../dynamic-import-this-arrow/_config.js | 4 +- .../dynamic-import-this-function/_config.js | 4 +- .../dynamic-import-unresolvable/_config.js | 9 +- .../_config.js | 4 +- .../early-bind-member-expressions/_config.js | 4 +- .../_config.js | 4 +- .../samples/effect-in-for-of-loop/_config.js | 4 +- test/form/samples/emit-asset-file/_config.js | 13 +- .../emit-file-tree-shaken-access/_config.js | 5 +- .../emit-uint8array-no-buffer/_config.js | 5 +- .../samples/empty-block-statement/_config.js | 4 +- .../empty-do-while-statement/_config.js | 4 +- .../samples/empty-for-in-statement/_config.js | 4 +- .../samples/empty-for-statement/_config.js | 4 +- .../samples/empty-if-statement/_config.js | 4 +- .../empty-statement-consequent/_config.js | 4 +- test/form/samples/empty-statement/_config.js | 4 +- .../samples/empty-switch-statement/_config.js | 4 +- .../empty-try-catch-statement/_config.js | 4 +- .../samples/empty-while-statement/_config.js | 4 +- .../samples/enforce-addon-order/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../exponentiation-operator/_config.js | 4 +- .../export-all-before-named/_config.js | 4 +- .../export-all-from-internal/_config.js | 4 +- .../samples/export-all-multiple/_config.js | 4 +- test/form/samples/export-default-2/_config.js | 4 +- test/form/samples/export-default-3/_config.js | 4 +- test/form/samples/export-default-4/_config.js | 4 +- .../_config.js | 4 +- .../samples/export-default-global/_config.js | 4 +- .../samples/export-default-import/_config.js | 4 +- test/form/samples/export-default/_config.js | 4 +- test/form/samples/export-globals/_config.js | 4 +- .../export-internal-namespace-as/_config.js | 4 +- .../samples/export-live-bindings/_config.js | 4 +- .../samples/export-multiple-vars/_config.js | 4 +- .../samples/export-namespace-as/_config.js | 4 +- .../_config.js | 4 +- .../exports-at-end-if-possible/_config.js | 4 +- test/form/samples/extend-exports/_config.js | 4 +- .../extend-namespaced-exports/_config.js | 4 +- .../samples/external-deshadowing/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../external-export-tracing/_config.js | 4 +- .../external-import-alias-shadow/_config.js | 4 +- .../samples/external-import-order/_config.js | 4 +- .../_config.js | 4 +- .../external-imports-custom-names/_config.js | 4 +- test/form/samples/external-imports/_config.js | 4 +- .../external-namespace-and-named/_config.js | 4 +- .../external-namespace-reexport/_config.js | 4 +- test/form/samples/for-in-scopes/_config.js | 4 +- .../samples/for-loop-assignment/_config.js | 4 +- .../for-loop-body-var-declaration/_config.js | 4 +- .../for-loop-with-empty-head/_config.js | 4 +- test/form/samples/for-of-scopes/_config.js | 4 +- test/form/samples/for-scopes/_config.js | 4 +- test/form/samples/freeze/_config.js | 4 +- .../function-body-return-values/_config.js | 4 +- .../function-call-parameters/_config.js | 4 +- .../function-iterable-prototype/_config.js | 4 +- .../form/samples/function-mutation/_config.js | 4 +- test/form/samples/function-scopes/_config.js | 4 +- .../arrow-functions-false/_config.js | 4 +- .../arrow-functions-true/_config.js | 4 +- .../const-bindings-false/_config.js | 5 +- .../const-bindings-true/_config.js | 5 +- .../object-shorthand-false/_config.js | 4 +- .../object-shorthand-true/_config.js | 4 +- .../_config.js | 4 +- .../reserved-names-as-props-false/_config.js | 5 +- .../_config.js | 4 +- .../reserved-names-as-props-true/_config.js | 5 +- .../generated-code-presets/es2015/_config.js | 5 +- .../generated-code-presets/es5/_config.js | 5 +- .../preset-with-override/_config.js | 5 +- .../arrow-functions-false/_config.js | 4 +- .../arrow-functions-true/_config.js | 4 +- .../const-bindings-false/_config.js | 5 +- .../const-bindings-true/_config.js | 5 +- .../object-shorthand-false/_config.js | 4 +- .../object-shorthand-true/_config.js | 4 +- .../_config.js | 4 +- .../reserved-names-as-props-false/_config.js | 5 +- .../_config.js | 4 +- .../reserved-names-as-props-true/_config.js | 5 +- .../samples/getter-return-values/_config.js | 4 +- test/form/samples/globals-function/_config.js | 4 +- .../_config.js | 4 +- .../samples/guessed-global-names/_config.js | 4 +- .../samples/handles-async-await/_config.js | 4 +- .../handles-empty-imports-iife/_config.js | 4 +- .../handles-empty-imports-umd/_config.js | 4 +- test/form/samples/hashbang/_config.js | 4 +- .../hoisted-unused-conditional/_config.js | 4 +- .../hoisted-variable-case-stmt/_config.js | 4 +- .../hoisted-variable-if-stmt/_config.js | 4 +- .../hoisted-vars-in-dead-branches/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../implicit-undefined-assignments/_config.js | 4 +- .../assertion-shapes/_config.js | 5 +- .../keep-dynamic-assertions/_config.js | 7 +- .../keeps-static-assertions/_config.js | 6 +- .../_config.js | 5 +- .../plugin-assertions-resolveid/_config.js | 5 +- .../removes-dynamic-assertions/_config.js | 7 +- .../removes-static-assertions/_config.js | 6 +- .../form/samples/import-expression/_config.js | 4 +- .../_config.js | 4 +- .../samples/import-meta-resolve/_config.js | 4 +- test/form/samples/import-meta-url/_config.js | 4 +- test/form/samples/import-meta/_config.js | 4 +- .../_config.js | 4 +- .../import-namespace-systemjs/_config.js | 4 +- test/form/samples/import-namespace/_config.js | 4 +- .../import-specifier-deshadowing/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- test/form/samples/indent-false/_config.js | 4 +- test/form/samples/indent-spaces/_config.js | 4 +- .../samples/indent-true-spaces/_config.js | 4 +- test/form/samples/indent-true/_config.js | 4 +- .../_config.js | 4 +- .../internal-conflict-resolution/_config.js | 4 +- .../_config.js | 5 +- .../_config.js | 5 +- .../samples/interop-per-dependency/_config.js | 5 +- .../_config.js | 5 +- test/form/samples/intro-and-outro/_config.js | 8 +- .../invalid-binary-expressions/_config.js | 4 +- .../samples/json-parse-is-not-pure/_config.js | 4 +- .../json-stringify-is-not-pure/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- test/form/samples/known-globals/_config.js | 4 +- .../labeled-break-statements/_config.js | 4 +- .../labeled-continue-statements/_config.js | 4 +- .../samples/large-var-cnt-deduping/_config.js | 4 +- .../lazy-assignment-deoptimization/_config.js | 4 +- .../literals-from-class-statics/_config.js | 4 +- .../_config.js | 4 +- .../deopzimize-while-included/_config.js | 4 +- .../mutate-logical-expression/_config.js | 4 +- .../simplify-non-boolean/_config.js | 4 +- .../make-relative-false/_config.js | 5 +- .../make-relative-relative/_config.js | 5 +- .../make-relative-true/_config.js | 5 +- .../samples/manual-pure-functions/_config.js | 4 +- .../merge-namespaces-non-live/_config.js | 4 +- test/form/samples/merge-namespaces/_config.js | 5 +- .../samples/minimal-this-mutation/_config.js | 4 +- test/form/samples/mjs/_config.js | 4 +- .../samples/modify-class-prototype/_config.js | 4 +- .../samples/modify-export-semi/_config.js | 4 +- .../module-name-scoped-package/_config.js | 4 +- test/form/samples/module-name-wat/_config.js | 4 +- .../module-name-with-dashes/_config.js | 4 +- .../samples/module-no-treeshake/_config.js | 4 +- .../samples/multi-expression-calls/_config.js | 4 +- test/form/samples/multiple-exports/_config.js | 4 +- .../samples/mutations-in-imports/_config.js | 4 +- .../samples/namespace-conflict/_config.js | 4 +- .../namespace-import-reexport-2/_config.js | 4 +- .../namespace-import-reexport/_config.js | 4 +- .../_config.js | 4 +- .../namespace-object-import/_config.js | 4 +- .../namespace-optimization-b/_config.js | 4 +- .../_config.js | 4 +- .../samples/namespace-optimization/_config.js | 4 +- .../namespace-reexport-name/_config.js | 4 +- .../samples/namespace-self-import/_config.js | 4 +- .../entry-default/_config.js | 4 +- .../namespace-tostring/entry-named/_config.js | 4 +- .../external-namespaces/_config.js | 4 +- .../_config.js | 4 +- .../inlined-namespace/_config.js | 4 +- .../namespaced-default-exports/_config.js | 4 +- .../namespaced-named-exports/_config.js | 4 +- .../namespaces-have-null-prototype/_config.js | 4 +- .../samples/nested-deoptimization/_config.js | 4 +- .../nested-inlined-dynamic-import/_config.js | 4 +- .../samples/nested-member-access/_config.js | 4 +- .../samples/nested-pure-comments/_config.js | 4 +- .../nested-this-expressions/_config.js | 4 +- .../samples/nested-tree-shaking/_config.js | 4 +- .../new-target-meta-property/_config.js | 4 +- .../_config.js | 4 +- .../no-external-live-bindings/_config.js | 4 +- .../samples/no-imports-or-exports/_config.js | 4 +- .../samples/no-treeshake-conflict/_config.js | 4 +- .../_config.js | 4 +- .../no-treeshake-include-labels/_config.js | 4 +- .../no-treeshake-namespace-object/_config.js | 4 +- test/form/samples/no-treeshake/_config.js | 4 +- .../non-empty-block-statement/_config.js | 4 +- .../ns-external-star-reexport/_config.js | 4 +- .../samples/nullish-coalescing/_config.js | 4 +- .../samples/numeric_separators/_config.js | 4 +- .../samples/object-define-property/_config.js | 4 +- .../_config.js | 4 +- .../computed-properties/_config.js | 4 +- .../method-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../proto-property/_config.js | 4 +- .../reassign-prop-without-proto/_config.js | 4 +- .../return-expressions/_config.js | 4 +- .../unknown-getter-no-side-effect/_config.js | 4 +- .../unknown-setter-no-side-effect/_config.js | 4 +- .../unknown-setter-no-side-effect2/_config.js | 4 +- .../samples/object-freeze-effects/_config.js | 4 +- .../_config.js | 4 +- .../optional-chaining-namespace/_config.js | 4 +- .../form/samples/optional-chaining/_config.js | 4 +- .../samples/output-named-library/_config.js | 4 +- .../override-external-namespace/_config.js | 4 +- test/form/samples/paths-function/_config.js | 4 +- test/form/samples/paths-relative/_config.js | 4 +- test/form/samples/paths/_config.js | 4 +- .../samples/pattern-assignments/_config.js | 4 +- .../pattern-member-expressions/_config.js | 4 +- .../samples/per-output-plugins/_config.js | 4 +- test/form/samples/preserve-asm-js/_config.js | 4 +- .../form/samples/preserve-debugger/_config.js | 4 +- .../_config.js | 4 +- .../probe-external-namespace/_config.js | 4 +- test/form/samples/promises/_config.js | 4 +- .../samples/proper-this-context/_config.js | 4 +- .../access-when-called-effect/_config.js | 4 +- .../early-access-getter-return/_config.js | 4 +- .../early-access-getter-value/_config.js | 4 +- .../shadowed-setters/_config.js | 4 +- .../samples/protect-cjs-globals/_config.js | 4 +- test/form/samples/proto-null/_config.js | 4 +- .../samples/prototype-functions/_config.js | 4 +- .../prune-pure-unused-import-array/_config.js | 4 +- .../_config.js | 4 +- .../prune-pure-unused-import/_config.js | 4 +- test/form/samples/pure-class-field/_config.js | 4 +- .../pure-comment-line-break/_config.js | 4 +- .../pure-comment-scenarios-complex/_config.js | 4 +- .../pure-comment-scenarios-simple/_config.js | 4 +- .../samples/pure-comments-disabled/_config.js | 4 +- .../samples/pure-comments-multiple/_config.js | 4 +- test/form/samples/quote-id/_config.js | 4 +- .../samples/re-export-aliasing/_config.js | 4 +- .../_config.js | 4 +- .../samples/recursive-assignments/_config.js | 4 +- test/form/samples/recursive-calls/_config.js | 4 +- .../recursive-computed-members/_config.js | 4 +- .../recursive-literal-values/_config.js | 4 +- .../recursive-multi-expressions/_config.js | 4 +- .../_config.js | 4 +- .../recursive-this-deoptimization/_config.js | 4 +- test/form/samples/recursive-values/_config.js | 4 +- test/form/samples/redeclarations/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../reexport-external-default/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/reexport-external-name/_config.js | 4 +- .../reexport-external-namespace-as/_config.js | 4 +- .../reexport-external-namespace/_config.js | 4 +- test/form/samples/reexport-self/_config.js | 4 +- .../samples/reexport-star-deshadow/_config.js | 4 +- .../_config.js | 4 +- .../samples/relative-external-ids/_config.js | 4 +- .../relative-external-with-global/_config.js | 4 +- .../remove-invalid-pure-comments/_config.js | 4 +- .../_config.js | 4 +- .../remove-treeshaken-banners/_config.js | 4 +- .../_config.js | 4 +- .../removes-unused-babel-helpers/_config.js | 4 +- .../renamed-pattern-defaults/_config.js | 4 +- .../render-chunk-plugin-sourcemaps/_config.js | 4 +- .../samples/render-chunk-plugin/_config.js | 4 +- .../render-declaration-semicolons/_config.js | 4 +- .../_config.js | 4 +- .../render-removed-declarations/_config.js | 4 +- .../render-removed-statements/_config.js | 4 +- .../_config.js | 4 +- test/form/samples/resolution-order/_config.js | 4 +- .../_config.js | 4 +- .../resolve-import-meta-url-export/_config.js | 4 +- .../resolve-import-meta-url/_config.js | 4 +- .../samples/return-after-error/_config.js | 4 +- .../return-statement/missing-space/_config.js | 4 +- .../_config.js | 4 +- .../runs-output-plugins-last/_config.js | 4 +- .../_config.js | 4 +- .../samples/self-calling-function/_config.js | 4 +- .../samples/self-contained-bundle/_config.js | 4 +- .../samples/self-deoptimization/_config.js | 4 +- .../samples/sequence-expression/_config.js | 4 +- .../samples/shorthand-properties/_config.js | 4 +- test/form/samples/side-effect-b/_config.js | 4 +- test/form/samples/side-effect-c/_config.js | 4 +- test/form/samples/side-effect-d/_config.js | 4 +- .../side-effect-default-reexport/_config.js | 4 +- test/form/samples/side-effect-e/_config.js | 4 +- .../side-effect-es5-classes/_config.js | 4 +- test/form/samples/side-effect-f/_config.js | 4 +- test/form/samples/side-effect-g/_config.js | 4 +- test/form/samples/side-effect-h/_config.js | 4 +- test/form/samples/side-effect-i/_config.js | 4 +- test/form/samples/side-effect-j/_config.js | 4 +- test/form/samples/side-effect-k/_config.js | 4 +- test/form/samples/side-effect-l/_config.js | 4 +- test/form/samples/side-effect-m/_config.js | 4 +- test/form/samples/side-effect-n/_config.js | 4 +- test/form/samples/side-effect-o/_config.js | 4 +- test/form/samples/side-effect-p/_config.js | 4 +- test/form/samples/side-effect-q/_config.js | 4 +- test/form/samples/side-effect-r/_config.js | 4 +- test/form/samples/side-effect-s/_config.js | 4 +- test/form/samples/side-effect-t/_config.js | 4 +- .../_config.js | 4 +- test/form/samples/side-effect/_config.js | 4 +- .../samples/side-effects-await/_config.js | 4 +- .../side-effects-break-statements/_config.js | 4 +- .../side-effects-call-arguments/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/side-effects-delete/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../side-effects-es6-super-classes/_config.js | 4 +- .../_config.js | 4 +- .../side-effects-generators/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../side-effects-internal-modules/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../side-effects-pattern-defaults/_config.js | 4 +- .../_config.js | 4 +- .../side-effects-reassignment/_config.js | 4 +- .../side-effects-return-statements/_config.js | 4 +- .../side-effects-static-methods/_config.js | 4 +- .../side-effects-switch-statements/_config.js | 4 +- .../form/samples/side-effects-this/_config.js | 4 +- .../samples/simplified-initializer/_config.js | 4 +- .../_config.js | 4 +- .../simplify-return-expression/_config.js | 4 +- .../samples/skips-dead-branches-b/_config.js | 4 +- .../samples/skips-dead-branches-c/_config.js | 4 +- .../samples/skips-dead-branches-d/_config.js | 4 +- .../samples/skips-dead-branches-e/_config.js | 4 +- .../samples/skips-dead-branches-f/_config.js | 4 +- .../samples/skips-dead-branches-g/_config.js | 4 +- .../samples/skips-dead-branches-h/_config.js | 4 +- .../samples/skips-dead-branches-i/_config.js | 4 +- .../samples/skips-dead-branches-j/_config.js | 4 +- .../samples/skips-dead-branches/_config.js | 4 +- .../slash-in-function-parameters/_config.js | 4 +- .../sourcemaps-excludesources/_config.js | 4 +- .../samples/sourcemaps-external/_config.js | 4 +- .../form/samples/sourcemaps-hidden/_config.js | 4 +- .../form/samples/sourcemaps-inline/_config.js | 4 +- .../_config.js | 4 +- .../samples/static-block-render/_config.js | 4 +- .../static-class-property-calls/_config.js | 4 +- .../static-method-deoptimization/_config.js | 4 +- test/form/samples/strict-false/_config.js | 4 +- .../samples/string-indentation-b/_config.js | 4 +- .../samples/string-indentation/_config.js | 4 +- .../string-replace-side-effects/_config.js | 4 +- .../super-class-no-side-effects/_config.js | 4 +- .../super-class-prototype-access/_config.js | 4 +- .../_config.js | 4 +- .../super-class-prototype-calls/_config.js | 4 +- .../super-class-prototype-values/_config.js | 4 +- test/form/samples/supports-core-js/_config.js | 4 +- .../form/samples/supports-es5-shim/_config.js | 4 +- .../form/samples/supports-es6-shim/_config.js | 6 +- test/form/samples/switch-scopes/_config.js | 4 +- .../synthetic-named-exports/_config.js | 5 +- test/form/samples/system-comments/_config.js | 4 +- .../system-default-comments/_config.js | 4 +- .../system-export-declarations/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../system-export-rendering/_config.js | 4 +- .../samples/system-module-reserved/_config.js | 4 +- .../_config.js | 4 +- .../samples/system-null-setters/_config.js | 4 +- test/form/samples/system-reexports/_config.js | 6 +- test/form/samples/system-semicolon/_config.js | 4 +- .../samples/system-uninitialized/_config.js | 4 +- .../tdz-access-in-declaration/_config.js | 4 +- test/form/samples/tdz-common/_config.js | 4 +- .../samples/tdz-pattern-access/_config.js | 4 +- .../computed-properties/_config.js | 4 +- .../simplify-conditionals/_config.js | 4 +- .../samples/this-in-class-body/_config.js | 4 +- test/form/samples/this-in-imports/_config.js | 4 +- .../form/samples/this-is-undefined/_config.js | 4 +- test/form/samples/top-level-await/_config.js | 4 +- .../_config.js | 4 +- .../tree-shake-curried-functions/_config.js | 4 +- .../tree-shake-default-exports/_config.js | 4 +- .../tree-shake-if-statements/_config.js | 4 +- .../tree-shake-logical-expressions/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../treeshake-classes-with-fields/_config.js | 4 +- .../argument-side-effects/_config.js | 4 +- .../arguments-variable/_config.js | 4 +- .../arrow-function-arguments/_config.js | 4 +- .../function-arguments/_config.js | 4 +- .../namespace-members/_config.js | 4 +- .../patterns/_config.js | 4 +- .../rest-element/_config.js | 4 +- .../unused-parameters/_config.js | 4 +- .../treeshake-import-meta-props/_config.js | 4 +- .../samples/treeshake-import-meta/_config.js | 4 +- test/form/samples/treeshake-json/_config.js | 6 +- .../treeshake-namespace-access/_config.js | 4 +- .../preset-with-override/_config.js | 10 +- .../treeshake-presets/recommended/_config.js | 10 +- .../treeshake-presets/safest/_config.js | 10 +- .../treeshake-presets/smallest/_config.js | 10 +- .../samples/treeshake-presets/true/_config.js | 10 +- .../treeshake-sequence-expressions/_config.js | 4 +- .../deactivate-via-option/_config.js | 4 +- .../direct-inclusion/_config.js | 4 +- .../follow-parameters/_config.js | 4 +- .../follow-pattern-parameters/_config.js | 4 +- .../follow-variables/_config.js | 4 +- .../include-via-outside-variable/_config.js | 4 +- .../supports-core-js/_config.js | 4 +- .../samples/typeof-side-effect/_config.js | 4 +- .../samples/umd-noconflict-extend/_config.js | 4 +- .../umd-noconflict-namespaced/_config.js | 4 +- .../umd-noconflict-no-exports/_config.js | 4 +- test/form/samples/umd-noconflict/_config.js | 4 +- .../form/samples/unary-expressions/_config.js | 4 +- .../undefined-default-export/_config.js | 4 +- test/form/samples/undefined-var/_config.js | 4 +- .../samples/unknown-token-effects/_config.js | 4 +- .../_config.js | 4 +- .../unmodified-default-exports/_config.js | 4 +- .../samples/unused-called-import/_config.js | 4 +- .../_config.js | 4 +- .../samples/unused-default-exports/_config.js | 4 +- .../_config.js | 4 +- test/form/samples/unused-import/_config.js | 4 +- .../_config.js | 4 +- test/form/samples/unused-var/_config.js | 4 +- .../update-expression-side-effects/_config.js | 4 +- .../samples/updating-assignments/_config.js | 4 +- test/form/samples/url-external/_config.js | 4 +- .../use-class-name-in-static-block/_config.js | 4 +- .../use-global-map-for-export-name/_config.js | 4 +- .../_config.js | 4 +- .../wrap-simplified-expressions/_config.js | 4 +- .../yield-expression/missing-space/_config.js | 4 +- test/form/tsconfig.json | 8 + test/function/define.d.ts | 5 + test/function/index.js | 257 ++++++++++-------- .../samples/access-instance-prop/_config.js | 4 +- .../add-watch-file-generate/_config.js | 4 +- .../_config.js | 4 +- .../adds-semicolons-if-necessary-b/_config.js | 4 +- .../adds-semicolons-if-necessary-c/_config.js | 4 +- .../adds-semicolons-if-necessary-d/_config.js | 4 +- .../adds-semicolons-if-necessary/_config.js | 4 +- .../_config.js | 4 +- .../samples/adds-timings-to-bundle/_config.js | 4 +- .../aliased-not-exported-twice/_config.js | 4 +- .../samples/allow-reserved/_config.js | 4 +- .../allow-undefined-as-parameter/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../already-deshadowed-import/_config.js | 4 +- .../samples/amd-auto-id-id/_config.js | 15 +- .../samples/amd-base-path-id/_config.js | 15 +- .../function/samples/amd-base-path/_config.js | 12 +- .../_config.js | 4 +- .../global-calls/_config.js | 4 +- .../parameter-access-mutation/_config.js | 4 +- .../parameter-call-mutation/_config.js | 4 +- .../parameter-deep-access-mutation/_config.js | 4 +- .../_config.js | 4 +- .../parameter-mutation-spread/_config.js | 4 +- .../parameter-mutation/_config.js | 4 +- .../parameter-variable-merge/_config.js | 4 +- .../return-function-known/_config.js | 4 +- .../return-function-unknown/_config.js | 4 +- .../unknown-global-assignment/_config.js | 4 +- .../unknown-global-call/_config.js | 4 +- .../_config.js | 4 +- .../samples/array-double-spread/_config.js | 4 +- .../samples/array-from-side-effect/_config.js | 4 +- test/function/samples/array-getter/_config.js | 4 +- .../samples/array-mutation/_config.js | 4 +- .../_config.js | 4 +- .../assign-namespace-to-var/_config.js | 4 +- .../assignee-is-deoptimized/_config.js | 4 +- .../_config.js | 4 +- .../nested-assignment/_config.js | 4 +- .../try-catch-inclusion/_config.js | 4 +- .../samples/assignment-patterns/_config.js | 4 +- .../assignment-to-exports-b/_config.js | 4 +- .../samples/assignment-to-exports/_config.js | 4 +- .../_config.js | 4 +- .../assignment-to-re-exports/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../associate-getter-return-values/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../associate-setter-parameters/_config.js | 4 +- .../samples/async-function-return/_config.js | 4 +- .../avoid-exports-dot-asterisk/_config.js | 4 +- .../avoid-variable-be-empty/_config.js | 5 +- test/function/samples/aync-options/_config.js | 6 +- .../samples/banner-and-footer/_config.js | 9 +- test/function/samples/bindings/_config.js | 4 +- .../_config.js | 4 +- test/function/samples/break-label/_config.js | 4 +- .../samples/build-promise-chain/_config.js | 4 +- .../argument-side-effects/_config.js | 4 +- .../builtin-prototypes/truthiness/_config.js | 4 +- .../samples/bundle-facade-order/_config.js | 5 +- .../samples/call-external-function/_config.js | 4 +- .../_config.js | 4 +- .../samples/call-marked-pure/_config.js | 4 +- .../_config.js | 4 +- .../can-import-self-treeshake/_config.js | 4 +- .../samples/can-import-self/_config.js | 4 +- .../cannot-call-external-namespace/_config.js | 4 +- .../cannot-call-internal-namespace/_config.js | 4 +- .../_config.js | 4 +- .../samples/catch-block-scope/_config.js | 4 +- .../catch-dynamic-import-failure/_config.js | 4 +- .../samples/catch-scope-shadowing/_config.js | 4 +- .../samples/catch-scope-variables/_config.js | 4 +- .../chained-mutable-array-methods/_config.js | 4 +- .../_config.js | 5 +- .../check-resolve-for-entry/_config.js | 4 +- .../_config.js | 4 +- .../chunking-duplicate-reexport/_config.js | 4 +- .../circular-default-exports/_config.js | 4 +- .../circular-missed-reexports-2/_config.js | 4 +- .../circular-missed-reexports/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../circular-preserve-modules/_config.js | 4 +- .../samples/circular-reexport/_config.js | 4 +- .../class-method-getter-properties/_config.js | 4 +- .../samples/class-method-mutation/_config.js | 4 +- .../samples/class-method-mutations/_config.js | 4 +- .../samples/class-method-returns/_config.js | 4 +- .../class-methods-not-renamed/_config.js | 4 +- .../samples/class-name-conflict-2/_config.js | 4 +- .../samples/class-name-conflict-3/_config.js | 4 +- .../samples/class-name-conflict-4/_config.js | 4 +- .../samples/class-name-conflict/_config.js | 4 +- .../samples/class-prop-returns/_config.js | 4 +- .../_config.js | 4 +- .../compact-multiple-imports/_config.js | 4 +- test/function/samples/compact/_config.js | 4 +- .../samples/conditional-catch/_config.js | 4 +- .../samples/conditional-definition/_config.js | 4 +- .../conditionals-deoptimization/_config.js | 4 +- .../configure-external-module-b/_config.js | 5 +- .../configure-external-module/_config.js | 4 +- .../_config.js | 4 +- .../named-import-external/_config.js | 4 +- .../named-import/_config.js | 4 +- .../namespace-import/_config.js | 4 +- .../same-binding/_config.js | 4 +- .../confused-default-identifier/_config.js | 4 +- .../samples/consistent-renaming-b/_config.js | 4 +- .../samples/consistent-renaming-c/_config.js | 4 +- .../samples/consistent-renaming-d/_config.js | 4 +- .../samples/consistent-renaming-e/_config.js | 4 +- .../samples/consistent-renaming-f/_config.js | 4 +- .../samples/consistent-renaming/_config.js | 4 +- .../_config.js | 4 +- .../context-resolve-skipself/_config.js | 4 +- .../samples/context-resolve/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../cross-chunk-live-binding/_config.js | 4 +- .../custom-external-module-options/_config.js | 4 +- .../custom-external-resolver-async/_config.js | 4 +- .../custom-external-resolver-sync/_config.js | 4 +- .../samples/custom-iterator-2/_config.js | 4 +- .../samples/custom-iterator/_config.js | 4 +- .../samples/custom-loaders/_config.js | 4 +- .../samples/custom-module-options/_config.js | 4 +- .../custom-path-resolver-async/_config.js | 4 +- .../custom-path-resolver-on-entry/_config.js | 4 +- .../custom-path-resolver-plural-b/_config.js | 4 +- .../custom-path-resolver-plural/_config.js | 4 +- .../custom-path-resolver-sync/_config.js | 4 +- .../samples/custom-resolve-options/_config.js | 4 +- .../_config.js | 4 +- .../samples/cycles-defaults/_config.js | 4 +- .../samples/cycles-export-star/_config.js | 4 +- .../samples/cycles-immediate/_config.js | 4 +- .../samples/cycles-pathological-2/_config.js | 4 +- .../samples/cycles-stack-overflow/_config.js | 4 +- .../samples/cyclic-assignments/_config.js | 4 +- .../deconflict-deconflicted/_config.js | 4 +- .../_config.js | 4 +- .../samples/deconflict-ids/_config.js | 4 +- .../deconflict-parameter-defaults/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/deconflicts-classes/_config.js | 4 +- .../samples/deconflicts-exports-2/_config.js | 4 +- .../samples/deconflicts-exports-3/_config.js | 4 +- .../samples/deconflicts-exports/_config.js | 4 +- .../deconflicts-external-imports/_config.js | 4 +- .../_config.js | 4 +- .../samples/deconflicts-globals/_config.js | 4 +- .../samples/deconflicts-interop/_config.js | 4 +- .../deconstructed-exported-vars/_config.js | 4 +- .../default-export-as-is-bound/_config.js | 4 +- .../_config.js | 4 +- .../default-export-is-not-bound-b/_config.js | 4 +- .../default-export-is-not-bound/_config.js | 4 +- .../_config.js | 4 +- .../default-exported-global/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/default-not-reexported/_config.js | 4 +- .../samples/default-on-warn/_config.js | 4 +- test/function/samples/delete/_config.js | 4 +- .../deoptimize-assumes-getters/_config.js | 4 +- .../samples/deoptimize-cached-prop/_config.js | 4 +- .../_config.js | 4 +- .../deoptimize-call-expressions/_config.js | 4 +- .../samples/deoptimize-class/_config.js | 4 +- .../deoptimize-computed-class-keys/_config.js | 4 +- .../deoptimize-computed-keys/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../deoptimize-logical-expressions/_config.js | 4 +- .../deoptimize-loop-element/_config.js | 4 +- .../deoptimize-member-expressions/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../deoptimize-object-expressions/_config.js | 4 +- .../samples/deoptimize-object/_config.js | 4 +- .../_config.js | 4 +- .../deoptimize-this-parameters/_config.js | 4 +- .../samples/deprecated/compact/_config.js | 4 +- .../dynamic-import-duplicates/_config.js | 4 +- .../dynamic-import-inlining/_config.js | 4 +- .../dynamic-import-name-warn/_config.js | 4 +- .../deprecated/dynamic-import-name/_config.js | 4 +- .../inline-dynamic-imports-bundle/_config.js | 4 +- .../inline-imports-with-manual/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../manual-chunks-conflict/_config.js | 4 +- .../deprecated/manual-chunks-info/_config.js | 4 +- .../manual-chunks-preserve-modules/_config.js | 4 +- .../infinity/_config.js | 4 +- .../max-parallel-file-reads/set/_config.js | 4 +- .../with-plugin/_config.js | 4 +- .../name-conflict-symbol/_config.js | 4 +- .../dynamic-import-default-mode/_config.js | 4 +- .../dynamic-import/_config.js | 4 +- .../entry-default/_config.js | 4 +- .../namespace-tostring/entry-named/_config.js | 4 +- .../external-namespaces/_config.js | 4 +- .../inlined-namespace/_config.js | 4 +- .../interop-property-descriptor/_config.js | 4 +- .../property-descriptor/_config.js | 4 +- .../_config.js | 4 +- .../deprecated/plugin-module-ids/_config.js | 4 +- .../inline-dynamic-imports/_config.js | 4 +- .../invalid-default-export-mode/_config.js | 4 +- .../_config.js | 4 +- .../invalid-none-export-mode/_config.js | 4 +- .../preserveModules/manual-chunks/_config.js | 4 +- .../preserveModules/mixed-exports/_config.js | 4 +- .../virtual-modules-conflict/_config.js | 4 +- .../virtual-modules/_config.js | 4 +- .../samples/deprecated/reexport-ns/_config.js | 4 +- .../deprecated/resolve-id-external/_config.js | 4 +- .../samples/deprecated/resolve-id/_config.js | 4 +- .../dynamicImportFunction/_config.js | 4 +- .../_config.js | 4 +- .../hasModuleSideEffects/_config.js | 4 +- .../inlineDynamicImports/_config.js | 4 +- .../deprecations/manualChunks/_config.js | 4 +- .../maxParallelFileReads/_config.js | 4 +- .../namespaceToStringTag/_config.js | 4 +- .../deprecations/plugin-module-ids/_config.js | 4 +- .../deprecations/prefer-const/_config.js | 4 +- .../deprecations/preserveModules/_config.js | 4 +- .../deshadow-respect-existing/_config.js | 4 +- .../deshadow-top-level-declaration/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../deshadowed-namespaced-import/_config.js | 4 +- .../deshadowed-shorthand-property/_config.js | 4 +- .../_config.js | 4 +- .../samples/destructuring-loop/_config.js | 4 +- .../disappearing-exported-value/_config.js | 4 +- .../do-while-conditional-break/_config.js | 4 +- .../does-not-deconflict-undefined/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../does-not-mangle-entry-point/_config.js | 4 +- .../samples/double-default-export/_config.js | 4 +- .../samples/double-named-export/_config.js | 4 +- .../samples/double-named-reexport/_config.js | 4 +- .../double-namespace-reexport/_config.js | 4 +- .../samples/duplicate-import-fails/_config.js | 4 +- .../_config.js | 4 +- .../samples/duplicate-input-entry/_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-duplicates/_config.js | 4 +- .../dynamic-import-existing/_config.js | 4 +- .../dynamic-import-expression/_config.js | 4 +- .../dynamic-import-inlining/_config.js | 4 +- .../dynamic-import-not-found/_config.js | 4 +- .../dynamic-import-only-default/_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-rewriting/_config.js | 4 +- .../dynamic-import-this-arrow/_config.js | 4 +- .../dynamic-import-this-function/_config.js | 4 +- .../dynamic-imports-shared-exports/_config.js | 4 +- .../dynamic-namespace-lookup/_config.js | 4 +- .../samples/emit-chunk-hash/_config.js | 4 +- .../emit-chunk-manual-asset-source/_config.js | 4 +- .../samples/emit-chunk-manual/_config.js | 4 +- .../emit-file/asset-source-invalid/_config.js | 4 +- .../asset-source-invalid2/_config.js | 4 +- .../asset-source-invalid3/_config.js | 4 +- .../asset-source-invalid4/_config.js | 4 +- .../emit-file/asset-source-missing/_config.js | 4 +- .../asset-source-missing2/_config.js | 4 +- .../asset-source-missing3/_config.js | 4 +- .../asset-source-missing4/_config.js | 4 +- .../asset-source-missing5/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../chunk-filename-not-available/_config.js | 4 +- .../emit-file/chunk-not-found/_config.js | 4 +- .../emit-from-output-options/_config.js | 4 +- .../emit-file/emit-same-file/_config.js | 4 +- .../file-references-in-bundle/_config.js | 4 +- .../emit-file/invalid-asset-name/_config.js | 4 +- .../emit-file/invalid-asset-name3/_config.js | 4 +- .../emit-file/invalid-chunk-id/_config.js | 4 +- .../emit-file/invalid-file-type/_config.js | 4 +- .../emit-file/invalid-reference-id/_config.js | 4 +- .../invalid-set-asset-source-id/_config.js | 4 +- .../emit-file/modules-loaded/_config.js | 4 +- .../samples/emit-file/no-input/_config.js | 4 +- .../set-asset-source-chunk/_config.js | 4 +- .../set-asset-source-transform/_config.js | 4 +- .../set-asset-source-twice/_config.js | 4 +- .../set-asset-source-twice2/_config.js | 4 +- .../set-source-in-output-options/_config.js | 4 +- .../_config.js | 4 +- .../empty-string-as-module-name/_config.js | 4 +- .../samples/enforce-plugin-order/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/error-missing-umd-name/_config.js | 4 +- .../samples/error-parse-json/_config.js | 4 +- .../error-parse-unknown-extension/_config.js | 4 +- .../es5-class-called-without-new/_config.js | 4 +- .../samples/escape-arguments/_config.js | 4 +- .../export-all-from-external/_config.js | 4 +- .../samples/export-all-multiple/_config.js | 4 +- test/function/samples/export-all/_config.js | 4 +- .../_config.js | 4 +- test/function/samples/export-as/_config.js | 4 +- .../export-deconflicted-names/_config.js | 4 +- .../_config.js | 4 +- .../samples/export-default-as-b/_config.js | 4 +- .../samples/export-default-as-c/_config.js | 4 +- .../samples/export-default-as/_config.js | 4 +- .../export-default-exported-id/_config.js | 4 +- .../export-default-expression/_config.js | 4 +- .../export-default-from-external/_config.js | 4 +- .../export-default-named-function/_config.js | 4 +- .../export-default-no-space/_config.js | 4 +- .../samples/export-destruction/_config.js | 4 +- .../export-from-default-renamed/_config.js | 4 +- .../samples/export-from-default/_config.js | 4 +- .../samples/export-from-external/_config.js | 4 +- .../export-from-internal-module/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../export-from-no-local-binding/_config.js | 4 +- .../samples/export-from-renamed/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../function/samples/export-global/_config.js | 4 +- .../export-not-at-top-level-fails/_config.js | 4 +- .../export-two-ways-default-b/_config.js | 4 +- .../export-two-ways-default/_config.js | 4 +- .../export-two-ways-function/_config.js | 4 +- .../samples/export-two-ways/_config.js | 4 +- .../samples/export-type-mismatch-b/_config.js | 4 +- .../samples/export-type-mismatch-c/_config.js | 4 +- .../samples/export-type-mismatch/_config.js | 4 +- .../_config.js | 4 +- .../samples/exports-named-values/_config.js | 4 +- .../samples/external-alias-parent/_config.js | 4 +- .../samples/external-alias/_config.js | 4 +- .../samples/external-conflict/_config.js | 4 +- .../external-directory-import/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../external-entry-point-object/_config.js | 4 +- .../samples/external-entry-point/_config.js | 4 +- .../external-function-always-true/_config.js | 4 +- .../samples/external-function/_config.js | 4 +- .../external-ids-not-resolved/_config.js | 4 +- .../_config.js | 4 +- .../external-live-binding-compact/_config.js | 4 +- .../samples/external-live-binding/_config.js | 4 +- .../samples/external-normalization/_config.js | 4 +- .../samples/external-regex-array/_config.js | 4 +- .../samples/external-regex/_config.js | 4 +- .../samples/external-resolve-false/_config.js | 4 +- .../samples/external-resolved/_config.js | 4 +- .../_config.js | 4 +- .../externally-reassigned-globals/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/facade-reexports/_config.js | 4 +- .../samples/fallback-on-warn/_config.js | 4 +- test/function/samples/file-and-dir/_config.js | 4 +- .../samples/for-in-accessors/_config.js | 4 +- .../for-in-loop-head-dependencies/_config.js | 4 +- .../for-loop-head-dependencies/_config.js | 4 +- .../samples/for-loop-parameter/_config.js | 4 +- .../for-loops-as-assignments/_config.js | 4 +- .../samples/for-of-accessors/_config.js | 4 +- .../for-of-loop-head-dependencies/_config.js | 4 +- .../for-of-with-in-operator/_config.js | 4 +- .../samples/function-asm-directive/_config.js | 4 +- .../function-directive-not-first/_config.js | 4 +- .../_config.js | 4 +- .../function-getter-side-effects/_config.js | 4 +- .../samples/function-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../functions-renamed-correctly/_config.js | 4 +- .../generate-bundle-mutation/_config.js | 4 +- .../_config.js | 4 +- .../handle-calling-uncallable/_config.js | 4 +- .../handle-labels-inside-functions/_config.js | 4 +- .../handle-missing-export-source/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../handles-double-declarations/_config.js | 4 +- .../_config.js | 4 +- .../handles-stringified-sourcemaps/_config.js | 4 +- .../samples/has-default-export/_config.js | 4 +- .../samples/has-modules-array/_config.js | 4 +- .../hashing/length-at-non-hash/_config.js | 4 +- .../hashing/maximum-hash-size/_config.js | 4 +- .../hashing/minimum-hash-size/_config.js | 4 +- .../samples/hidden-directories/_config.js | 4 +- .../hoisted-variable-if-else/_config.js | 4 +- .../_config.js | 4 +- .../if-statement-insert-whitespace/_config.js | 4 +- .../if-statement-with-assignment/_config.js | 4 +- .../_config.js | 4 +- .../if-statement-with-update/_config.js | 4 +- .../samples/iife-code-splitting/_config.js | 4 +- .../function/samples/iife-comments/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../dependant-not-part-of-graph/_config.js | 4 +- .../external-dependant/_config.js | 4 +- .../missing-dependant/_config.js | 4 +- test/function/samples/import-as/_config.js | 4 +- .../plugin-assertions-this-resolve/_config.js | 4 +- .../warn-assertion-conflicts/_config.js | 4 +- .../samples/import-binding/_config.js | 4 +- .../samples/import-chain-as/_config.js | 4 +- test/function/samples/import-chain/_config.js | 4 +- .../_config.js | 4 +- .../import-default-as-named/_config.js | 4 +- .../import-default-as-other/_config.js | 4 +- .../samples/import-default-class/_config.js | 4 +- .../import-default-expression/_config.js | 4 +- .../import-default-from-external/_config.js | 4 +- .../import-default-function/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../import-empty-from-external/_config.js | 4 +- .../samples/import-meta-url/_config.js | 4 +- .../samples/import-named-class/_config.js | 4 +- .../import-named-from-external/_config.js | 4 +- .../import-named-function-as-other/_config.js | 4 +- .../samples/import-named-function/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../import-not-at-top-level-fails/_config.js | 4 +- .../import-of-unexported-fails/_config.js | 4 +- .../samples/import-var-declaration/_config.js | 4 +- .../imports-are-deconflicted-b/_config.js | 4 +- .../imports-are-deconflicted-c/_config.js | 4 +- .../imports-are-deconflicted/_config.js | 4 +- .../_config.js | 4 +- .../samples/includes-reassignments/_config.js | 4 +- .../samples/includes-superclass/_config.js | 4 +- .../inline-dynamic-imports-bundle/_config.js | 4 +- .../inline-dynamic-no-treeshake/_config.js | 4 +- .../inline-imports-with-manual/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/input-name-validation/_config.js | 4 +- .../samples/input-name-validation2/_config.js | 4 +- .../samples/input-name-validation3/_config.js | 4 +- .../instanceof/left-hand-effect/_config.js | 4 +- .../instanceof/right-hand-effect/_config.js | 4 +- .../instanceof/used-parameter/_config.js | 4 +- .../samples/instanceof/used/_config.js | 4 +- .../inter-chunk-execution-order/_config.js | 4 +- .../_config.js | 4 +- .../interop-auto-live-bindings/_config.js | 4 +- .../interop-auto-no-live-bindings/_config.js | 4 +- .../interop-default-conflict/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/interop-default-only/_config.js | 4 +- .../samples/interop-default/_config.js | 4 +- .../samples/interop-esmodule/_config.js | 4 +- .../samples/invalid-addon-hook/_config.js | 4 +- .../invalid-default-export-mode/_config.js | 4 +- .../invalid-ignore-list-function/_config.js | 4 +- .../samples/invalid-interop/_config.js | 4 +- .../invalid-pattern-replacement/_config.js | 4 +- .../samples/invalid-pattern/_config.js | 4 +- .../invalid-property-assignments/_config.js | 4 +- .../samples/invalid-property-calls/_config.js | 4 +- .../invalid-top-level-await/_config.js | 4 +- .../_config.js | 4 +- .../keep-cjs-dynamic-import/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../legal-import-modification/_config.js | 4 +- .../samples/legal-suggested-names/_config.js | 4 +- .../load-module-error/buildEnd/_config.js | 4 +- .../load-module-error/buildStart/_config.js | 4 +- .../generateBundle/_config.js | 4 +- .../samples/load-module-error/load/_config.js | 4 +- .../load-module-error/renderChunk/_config.js | 4 +- .../load-module-error/renderStart/_config.js | 4 +- .../load-module-error/resolveId/_config.js | 4 +- .../load-module-error/transform/_config.js | 4 +- .../load-resolve-dependencies/_config.js | 4 +- .../load-returns-empty-string/_config.js | 4 +- .../load-returns-string-or-null/_config.js | 4 +- .../samples/long-path-deopt/_config.js | 4 +- .../samples/manual-chunks-conflict/_config.js | 4 +- .../samples/manual-chunks-info/_config.js | 4 +- .../samples/mark-namespace-members/_config.js | 4 +- .../default/_config.js | 4 +- .../error/_config.js | 4 +- .../infinity/_config.js | 4 +- .../set/_config.js | 4 +- .../with-plugin/_config.js | 4 +- .../_config.js | 4 +- .../merged-namespace-live-bindings/_config.js | 4 +- .../method-call-mutates-this/_config.js | 4 +- .../method-call-side-effects/_config.js | 4 +- .../_config.js | 4 +- .../samples/mixed-external-paths/_config.js | 4 +- .../samples/modify-assumed-global/_config.js | 4 +- test/function/samples/modify-meta/_config.js | 4 +- .../modify-object-via-this-a/_config.js | 4 +- .../modify-object-via-this-b/_config.js | 4 +- .../modify-object-via-this-c/_config.js | 4 +- .../modify-object-via-this-d/_config.js | 4 +- .../deoptimized-props-with-getter/_config.js | 4 +- .../getter-in-assignment/_config.js | 4 +- .../getters-on-this/_config.js | 4 +- .../known-getter/_config.js | 4 +- .../known-super-prop/_config.js | 4 +- .../unknown-prop-getter/_config.js | 4 +- .../unknown-prop-unknown-access/_config.js | 4 +- .../unknown-property-access/_config.js | 4 +- .../unknown-super-prop/_config.js | 4 +- .../deoptimized-props-with-setter/_config.js | 4 +- .../known-setter/_config.js | 4 +- .../known-super-prop/_config.js | 4 +- .../unknown-prop-setter/_config.js | 4 +- .../unknown-prop-unknown-access/_config.js | 4 +- .../unknown-super-prop/_config.js | 4 +- .../samples/module-level-directive/_config.js | 4 +- .../samples/module-parsed-hook/_config.js | 4 +- .../module-parsed-imported-ids/_config.js | 4 +- .../module-side-effect-reexport/_config.js | 4 +- .../module-side-effects/array/_config.js | 4 +- .../external-false/_config.js | 4 +- .../global-false/_config.js | 4 +- .../invalid-option/_config.js | 4 +- .../module-side-effects/load/_config.js | 4 +- .../reexport-from-external/_config.js | 4 +- .../module-side-effects/reexports/_config.js | 4 +- .../resolve-id-external/_config.js | 7 +- .../module-side-effects/resolve-id/_config.js | 4 +- .../module-side-effects/transform/_config.js | 4 +- .../module-side-effects/writable/_config.js | 4 +- .../samples/module-sort-order/_config.js | 4 +- test/function/samples/module-tree/_config.js | 4 +- .../samples/name-conflict-object/_config.js | 4 +- .../samples/name-conflict-promise/_config.js | 4 +- .../samples/name-conflict-symbol/_config.js | 4 +- .../_config.js | 4 +- .../namespace-keys-are-sorted/_config.js | 4 +- .../namespace-literal-value/_config.js | 4 +- .../assignment/_config.js | 4 +- .../call/_config.js | 4 +- .../member-call/_config.js | 4 +- .../missing-access/_config.js | 4 +- .../unknown-access/_config.js | 4 +- .../namespace-missing-export/_config.js | 4 +- .../samples/namespace-override/_config.js | 4 +- .../_config.js | 4 +- .../dynamic-import-default-mode/_config.js | 4 +- .../dynamic-import/_config.js | 4 +- .../entry-default/_config.js | 4 +- .../namespace-tostring/entry-named/_config.js | 4 +- .../external-namespaces/_config.js | 4 +- .../inlined-namespace/_config.js | 4 +- .../interop-property-descriptor/_config.js | 4 +- .../property-descriptor/_config.js | 4 +- .../namespace-update-import-fails/_config.js | 4 +- .../samples/namespaces-are-frozen/_config.js | 4 +- .../namespaces-have-null-prototype/_config.js | 4 +- .../namespacing-collisions-2/_config.js | 4 +- .../samples/namespacing-collisions/_config.js | 4 +- .../namespacing-in-sub-functions/_config.js | 4 +- .../nested-and-async-plugin/_config.js | 4 +- .../samples/nested-foreach/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/new-target-meta/_config.js | 4 +- .../samples/newline-after-comment/_config.js | 4 +- .../_config.js | 4 +- .../no-external-live-bindings/_config.js | 4 +- test/function/samples/no-imports/_config.js | 4 +- .../samples/no-relative-external/_config.js | 4 +- .../samples/non-extension-dot/_config.js | 4 +- .../non-function-hook-async/_config.js | 4 +- .../samples/non-function-hook-sync/_config.js | 4 +- .../samples/non-js-extensions/_config.js | 4 +- .../object-deep-access-effect/_config.js | 4 +- .../object-destructuring-renaming/_config.js | 4 +- .../object-dynamic-properties/_config.js | 4 +- .../_config.js | 4 +- .../samples/object-properties/_config.js | 4 +- .../object-prototype-properties/_config.js | 4 +- .../object-spread-side-effect/_config.js | 4 +- .../samples/optional-catch-binding/_config.js | 4 +- .../optional-chaining-side-effect/_config.js | 4 +- .../samples/options-async-hook/_config.js | 4 +- test/function/samples/options-hook/_config.js | 4 +- .../samples/options-in-renderstart/_config.js | 4 +- .../samples/output-options-hook/_config.js | 4 +- .../override-external-namespace/_config.js | 4 +- .../_config.js | 4 +- .../parameter-defaults/arrays/_config.js | 4 +- .../class-fields/_config.js | 4 +- .../parameter-defaults/exported/_config.js | 4 +- .../function-as-default/_config.js | 4 +- .../function-return/_config.js | 4 +- .../logical-expressions/_config.js | 4 +- .../module-side-effects/_config.js | 4 +- .../parameter-defaults/objects/_config.js | 4 +- .../return-expressions/_config.js | 4 +- .../super-classes/_config.js | 4 +- .../tagged-templates/_config.js | 4 +- .../parameter-defaults/try-catch/_config.js | 4 +- .../samples/parameter-side-effects/_config.js | 4 +- .../parenthesised-default-export/_config.js | 4 +- .../pass-namespace-to-function/_config.js | 4 +- .../paths-are-case-sensitive/_config.js | 4 +- .../per-output-plugins-warn-hooks/_config.js | 4 +- .../_config.js | 4 +- .../perf-supports-object-hooks/_config.js | 4 +- .../plugin-cache/anonymous-delete/_config.js | 4 +- .../plugin-cache/anonymous-get/_config.js | 4 +- .../plugin-cache/anonymous-has/_config.js | 4 +- .../plugin-cache/anonymous-set/_config.js | 4 +- .../duplicate-names-no-cache/_config.js | 4 +- .../plugin-cache/duplicate-names/_config.js | 4 +- .../plugin-error-loc-instead-pos/_config.js | 4 +- .../plugin-error-module-parsed/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../plugin-error-should-transform/_config.js | 4 +- .../samples/plugin-error/buildEnd/_config.js | 4 +- .../plugin-error/buildStart/_config.js | 4 +- .../plugin-error/generateBundle/_config.js | 4 +- .../samples/plugin-error/load/_config.js | 4 +- .../plugin-error/renderChunk/_config.js | 4 +- .../plugin-error/renderStart/_config.js | 4 +- .../samples/plugin-error/resolveId/_config.js | 4 +- .../samples/plugin-error/transform/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../plugin-module-information/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- test/function/samples/plugin-parse/_config.js | 4 +- .../plugin-warn-loc-instead-pos/_config.js | 4 +- test/function/samples/plugin-warn/_config.js | 4 +- .../plugins-can-manipulate-options/_config.js | 4 +- .../samples/preload-after-build/_config.js | 4 +- .../samples/preload-cyclic-module/_config.js | 4 +- .../samples/preload-loading-module/_config.js | 4 +- .../samples/preload-module/_config.js | 4 +- .../preserve-for-of-iterable/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../inline-dynamic-imports/_config.js | 4 +- .../invalid-default-export-mode/_config.js | 4 +- .../_config.js | 4 +- .../invalid-none-export-mode/_config.js | 4 +- .../preserve-modules/manual-chunks/_config.js | 4 +- .../preserve-modules/mixed-exports/_config.js | 4 +- .../virtual-modules-conflict/_config.js | 4 +- .../virtual-modules/_config.js | 4 +- .../samples/preserve-symlink/_config.js | 4 +- .../preserves-catch-argument/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../prevent-asi-with-line-comments/_config.js | 4 +- .../prevent-context-resolve-loop/_config.js | 4 +- .../prevent-tree-shaking-asi/_config.js | 4 +- .../property-keys-not-renamed/_config.js | 4 +- .../propertyReadSideEffects-always/_config.js | 4 +- .../samples/protect-cjs-globals/_config.js | 4 +- .../samples/proto-accessors/_config.js | 4 +- .../re-export-default-import/_config.js | 4 +- .../re-export-namespace-import/_config.js | 4 +- .../_config.js | 4 +- .../reassign-computed-prototype/_config.js | 4 +- .../_config.js | 4 +- .../reassign-double-declarations/_config.js | 4 +- .../samples/reassign-empty-objects/_config.js | 4 +- .../reassign-for-loop-declarations/_config.js | 4 +- .../samples/reassign-import-fails/_config.js | 4 +- .../_config.js | 4 +- .../samples/reassign-namespace/_config.js | 4 +- .../reassign-object-literal-1/_config.js | 4 +- .../reassign-object-literal-2/_config.js | 4 +- .../reassign-parameter-property/_config.js | 4 +- .../samples/reassign-parameter/_config.js | 4 +- .../reassign-pattern-defaults/_config.js | 4 +- .../reassign-return-expression/_config.js | 4 +- .../reassign-return-expressions/_config.js | 4 +- .../reassigned-return-expression/_config.js | 4 +- .../_config.js | 4 +- .../samples/recursive-reexports/_config.js | 4 +- .../samples/redeclare-parameter/_config.js | 4 +- .../reexport-from-synthetic/_config.js | 4 +- .../samples/reexport-missing-error/_config.js | 4 +- test/function/samples/reexport-ns/_config.js | 4 +- .../reexports-from-external/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../relative-external-include-once/_config.js | 4 +- .../relative-outside-external/_config.js | 4 +- .../removes-empty-exported-vars/_config.js | 4 +- .../_config.js | 4 +- .../samples/rename-default-export/_config.js | 4 +- .../samples/renamed-arguments/_config.js | 4 +- .../samples/render-chunk-async/_config.js | 4 +- .../samples/resolve-id-object/_config.js | 4 +- .../resolve-relative-external-id/_config.js | 4 +- .../_config.js | 4 +- .../resolve-unordered-assignments/_config.js | 4 +- .../samples/resolveid-is-entry/_config.js | 4 +- .../resolves-namespace-default/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/retains-sort-order-b/_config.js | 4 +- .../samples/retains-sort-order/_config.js | 4 +- .../_config.js | 4 +- .../returned-array-mutation/_config.js | 4 +- .../samples/reuse-resolve-meta/_config.js | 4 +- .../rewrite-member-expressions/_config.js | 4 +- .../samples/sequence-expression/_config.js | 4 +- .../_config.js | 4 +- .../shadowed-external-export/_config.js | 4 +- .../samples/shadowed-namespace-b/_config.js | 4 +- .../samples/shadowed-namespace/_config.js | 4 +- .../samples/shadowed-variables/_config.js | 4 +- .../samples/shims-missing-exports/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/simplified-nested-if/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../simplify-sequence-expressions/_config.js | 4 +- .../simplify-with-destructuring/_config.js | 4 +- .../simplify-with-function-iife/_config.js | 4 +- .../sourcemap-base-url-invalid/_config.js | 4 +- .../_config.js | 4 +- .../sourcemap-true-generatebundle/_config.js | 4 +- .../sourcemapping-url-comment/_config.js | 4 +- .../sourcemapping-url-multiline/_config.js | 4 +- .../spread-arguments-unused/_config.js | 4 +- .../samples/statement-order/_config.js | 4 +- test/function/samples/switch-break/_config.js | 4 +- .../switch-cases-are-deconflicted/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- test/function/samples/symlink/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../circular-synthetic-exports/_config.js | 4 +- .../circular-synthetic-exports2/_config.js | 4 +- .../dynamic-import/_config.js | 5 +- .../synthetic-named-exports/entry/_config.js | 5 +- .../external-synthetic-exports/_config.js | 5 +- .../namespace-object/_config.js | 4 +- .../namespace-overrides/_config.js | 4 +- .../non-default-export/_config.js | 5 +- .../preserve-modules/_config.js | 4 +- .../synthetic-exports-need-default/_config.js | 5 +- .../_config.js | 5 +- .../_config.js | 5 +- .../synthetic-named-export-entry/_config.js | 5 +- .../tagged-template-deoptimize/_config.js | 4 +- .../samples/this-not-namespace/_config.js | 4 +- .../samples/this-side-effect/_config.js | 4 +- .../throws-not-found-module/_config.js | 4 +- .../top-level-arrow-function/_config.js | 4 +- .../samples/top-level-block/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/track-awaited-object/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/track-reassignments/_config.js | 4 +- .../tracks-alias-mutations-b/_config.js | 4 +- .../samples/tracks-alias-mutations/_config.js | 4 +- .../samples/transform-empty-string/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/transform-without-code/_config.js | 4 +- .../_config.js | 7 +- .../main.js | 1 + .../samples/transformer-async/_config.js | 4 +- .../samples/transformer-multiple/_config.js | 4 +- .../samples/transformer-single/_config.js | 4 +- .../transparent-dynamic-inlining/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/try-catch-scoping/_config.js | 4 +- .../unknown-for-loop-variables/_config.js | 4 +- .../unknown-generated-code-preset/_config.js | 9 +- .../unknown-generated-code-value/_config.js | 5 +- .../unknown-global-side-effects/_config.js | 4 +- .../samples/unknown-statement/_config.js | 4 +- .../unknown-treeshake-preset/_config.js | 9 +- .../unknown-treeshake-value/_config.js | 5 +- .../_config.js | 4 +- .../_config.js | 4 +- .../unused-for-in-loop-declaration/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../unused-for-of-loop-declaration/_config.js | 4 +- .../_config.js | 4 +- .../function/samples/unused-import/_config.js | 4 +- .../unused-parameter-side-effects/_config.js | 4 +- .../unused-parenthesed-assignment/_config.js | 4 +- test/function/samples/unused-var-a/_config.js | 4 +- test/function/samples/unused-var-b/_config.js | 4 +- test/function/samples/unused-var-c/_config.js | 4 +- test/function/samples/unused-var-d/_config.js | 4 +- .../unused-while-loop-declaration/_config.js | 4 +- .../update-expression-accessors/_config.js | 4 +- .../_config.js | 4 +- .../use-class-name-in-static-block/_config.js | 4 +- .../samples/use-var-before-decl/_config.js | 4 +- .../samples/uses-supplied-ast/_config.js | 4 +- .../samples/validate-output/_config.js | 4 +- .../validate-resolved-by-logic/_config.js | 4 +- .../samples/vars-in-for-loop-head/_config.js | 4 +- .../vars-not-removed-in-if-block/_config.js | 4 +- .../samples/vars-not-removed/_config.js | 4 +- .../vars-with-init-in-dead-branch/_config.js | 4 +- .../samples/warn-missing-iife-name/_config.js | 4 +- .../_config.js | 4 +- .../samples/warn-on-empty-bundle/_config.js | 4 +- test/function/samples/warn-on-eval/_config.js | 4 +- .../warn-on-namespace-conflict/_config.js | 4 +- .../samples/warn-on-top-level-this/_config.js | 4 +- .../warn-on-unused-missing-imports/_config.js | 4 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/warnings-to-string/_config.js | 4 +- .../warns-for-invalid-options/_config.js | 4 +- test/function/samples/watch-option/_config.js | 4 +- .../_config.js | 4 +- .../wraps-simplified-expressions/_config.js | 4 +- test/function/tsconfig.json | 8 + test/hooks/index.js | 3 + test/incremental/index.js | 3 + test/leak/index.js | 3 + test/sourcemaps/define.d.ts | 5 + test/sourcemaps/getLocation.js | 5 + test/sourcemaps/index.js | 43 +-- .../samples/basic-support/_config.js | 4 +- .../combined-sourcemap-with-loader/_config.js | 9 +- .../samples/combined-sourcemap/_config.js | 8 +- .../excludes-plugin-helpers/_config.js | 6 +- .../_config.js | 4 +- .../_config.js | 4 +- .../samples/ignore-list-default/_config.js | 4 +- .../samples/ignore-list-false/_config.js | 4 +- .../ignore-list-source-files/_config.js | 4 +- .../ignore-list-sourcemap-path/_config.js | 4 +- test/sourcemaps/samples/loaders/_config.js | 4 +- .../names-transformed-render-chunk/_config.js | 4 +- test/sourcemaps/samples/names/_config.js | 4 +- .../samples/reified-namespace/_config.js | 4 +- .../samples/relative-paths/_config.js | 4 +- .../samples/render-chunk-babili/_config.js | 5 +- .../samples/render-chunk/_config.js | 5 +- .../samples/single-length-segments/_config.js | 5 +- .../samples/sourcemap-base-url/_config.js | 4 +- .../samples/sourcemap-file-hashed/_config.js | 4 +- .../samples/sourcemap-file/_config.js | 5 +- .../transform-full-source-paths/_config.js | 4 +- .../transform-low-resolution/_config.js | 10 +- .../samples/transform-source-paths/_config.js | 4 +- .../main.js | 1 - test/sourcemaps/samples/transforms/_config.js | 8 +- .../samples/untransformed-modules/_config.js | 7 +- test/sourcemaps/tsconfig.json | 8 + test/tsconfig.base.json | 15 + test/tsconfig.json | 29 ++ test/types.d.ts | 233 ++++++++++++++++ test/utils.js | 121 ++++++++- test/watch/index.js | 4 + 1978 files changed, 4943 insertions(+), 4209 deletions(-) create mode 100644 test/browser/define.d.ts create mode 100644 test/browser/tsconfig.json create mode 100644 test/chunking-form/define.d.ts create mode 100644 test/chunking-form/tsconfig.json create mode 100644 test/cli/define.d.ts create mode 100644 test/cli/tsconfig.json create mode 100644 test/file-hashes/define.d.ts create mode 100644 test/file-hashes/tsconfig.json create mode 100644 test/form/define.d.ts create mode 100644 test/form/tsconfig.json create mode 100644 test/function/define.d.ts rename test/{sourcemaps => function}/samples/transform-without-sourcemap-render-chunk/_config.js (91%) create mode 100644 test/function/samples/transform-without-sourcemap-render-chunk/main.js create mode 100644 test/function/tsconfig.json create mode 100644 test/sourcemaps/define.d.ts delete mode 100644 test/sourcemaps/samples/transform-without-sourcemap-render-chunk/main.js create mode 100644 test/sourcemaps/tsconfig.json create mode 100644 test/tsconfig.base.json create mode 100644 test/tsconfig.json create mode 100644 test/types.d.ts diff --git a/.eslintrc.js b/.eslintrc.js index b21c14ddd3a..f52183b8466 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,6 +66,12 @@ module.exports = { 'no-undef': 'off', 'unicorn/prevent-abbreviations': 'off' } + }, + { + files: ['test/**/_config.js'], + rules: { + 'no-undef': 'off' + } } ], parser: '@typescript-eslint/parser', diff --git a/.gitignore b/.gitignore index 9f36b14f659..1c4b59f55d7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ perf/ .github_token .temp docs/.vitepress/graphs +*.tsbuildinfo diff --git a/.vscode/settings.json b/.vscode/settings.json index d84818e43f3..971a04ed371 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,7 @@ "typescript.format.enable": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true - } + }, + "references.preferredLocation": "peek", + "vue.features.codeActions.enable": false } diff --git a/package-lock.json b/package-lock.json index 30fc62a76d5..65cd93ff2a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@rollup/plugin-typescript": "^11.1.0", "@rollup/pluginutils": "^5.0.2", "@types/estree": "1.0.1", + "@types/mocha": "^10.0.1", "@types/node": "^14.18.42", "@types/yargs-parser": "^21.0.0", "@typescript-eslint/eslint-plugin": "^5.59.1", @@ -1379,6 +1380,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "node_modules/@types/node": { "version": "14.18.42", "dev": true, @@ -10258,6 +10265,12 @@ "version": "3.0.5", "dev": true }, + "@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "@types/node": { "version": "14.18.42", "dev": true diff --git a/package.json b/package.json index 7eb1f645f07..f8cd129520b 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "@rollup/plugin-typescript": "^11.1.0", "@rollup/pluginutils": "^5.0.2", "@types/estree": "1.0.1", + "@types/mocha": "^10.0.1", "@types/node": "^14.18.42", "@types/yargs-parser": "^21.0.0", "@typescript-eslint/eslint-plugin": "^5.59.1", diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 94759af04ca..9d38f027e17 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -519,7 +519,7 @@ export type InputPluginOption = MaybePromise; - acornInjectPlugins?: (() => unknown)[] | (() => unknown); + acornInjectPlugins?: ((...arguments_: any[]) => unknown)[] | ((...arguments_: any[]) => unknown); cache?: boolean | RollupCache; context?: string; experimentalCacheExpiry?: number; diff --git a/test/browser/define.d.ts b/test/browser/define.d.ts new file mode 100644 index 00000000000..1fde8f77e5e --- /dev/null +++ b/test/browser/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigBrowser } from '../types'; + +declare global { + function defineTest(config: TestConfigBrowser): TestConfigBrowser; +} diff --git a/test/browser/index.js b/test/browser/index.js index d5177bdcb58..2167a4210a9 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -1,67 +1,80 @@ // since we don't run the browser tests in an actual browser, we need to make `performance` // globally accessible same as in the browser. this can be removed once `performance` is // available globally in all supported platforms. [currently global for node.js v16+]. +// @ts-expect-error ignore global.performance = require('node:perf_hooks').performance; const { basename, resolve } = require('node:path'); const fixturify = require('fixturify'); + +/** + * @type {import('../../src/rollup/types')} Rollup + */ const { rollup } = require('../../browser/dist/rollup.browser.js'); const { assertFilesAreEqual, runTestSuiteWithSamples, compareError } = require('../utils.js'); -runTestSuiteWithSamples('browser', resolve(__dirname, 'samples'), (directory, config) => { - (config.skip ? it.skip : config.solo ? it.only : it)( - basename(directory) + ': ' + config.description, - async () => { - let bundle; - try { - bundle = await rollup({ - input: 'main', - onwarn: warning => { - if (!(config.expectedWarnings && config.expectedWarnings.includes(warning.code))) { - throw new Error( - `Unexpected warnings (${warning.code}): ${warning.message}\n` + - 'If you expect warnings, list their codes in config.expectedWarnings' - ); - } - }, - strictDeprecations: true, - ...config.options - }); - } catch (error) { +runTestSuiteWithSamples( + 'browser', + resolve(__dirname, 'samples'), + /** + * @param {import('../types').TestConfigBrowser} config + */ + (directory, config) => { + (config.skip ? it.skip : config.solo ? it.only : it)( + basename(directory) + ': ' + config.description, + async () => { + let bundle; + try { + bundle = await rollup({ + input: 'main', + onwarn: warning => { + if (!(config.expectedWarnings && config.expectedWarnings.includes(warning.code))) { + throw new Error( + `Unexpected warnings (${warning.code}): ${warning.message}\n` + + 'If you expect warnings, list their codes in config.expectedWarnings' + ); + } + }, + strictDeprecations: true, + ...config.options + }); + } catch (error) { + if (config.error) { + compareError(error, config.error); + return; + } else { + throw error; + } + } if (config.error) { - compareError(error, config.error); - return; - } else { - throw error; + throw new Error('Expected an error while rolling up'); + } + let output; + try { + ({ output } = await bundle.generate({ + exports: 'auto', + format: 'es', + ...(config.options || {}).output + })); + } catch (error) { + if (config.generateError) { + compareError(error, config.generateError); + return; + } else { + throw error; + } } - } - if (config.error) { - throw new Error('Expected an error while rolling up'); - } - let output; - try { - ({ output } = await bundle.generate({ - exports: 'auto', - format: 'es', - ...(config.options || {}).output - })); - } catch (error) { if (config.generateError) { - compareError(error, config.generateError); - return; - } else { - throw error; + throw new Error('Expected an error while generating output'); } + assertOutputMatches(output, directory); } - if (config.generateError) { - throw new Error('Expected an error while generating output'); - } - assertOutputMatches(output, directory); - } - ); -}); + ); + } +); function assertOutputMatches(output, directory) { + /** @type any */ const actual = {}; for (const file of output) { const filePath = file.fileName.split('/'); diff --git a/test/browser/samples/basic/_config.js b/test/browser/samples/basic/_config.js index a1881638888..9697e938457 100644 --- a/test/browser/samples/basic/_config.js +++ b/test/browser/samples/basic/_config.js @@ -1,6 +1,6 @@ const { loader } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'bundles files for the browser', options: { plugins: loader({ @@ -9,4 +9,4 @@ console.log(foo);`, dep: `export const foo = 42;` }) } -}; +}); diff --git a/test/browser/samples/missing-dependency-resolution/_config.js b/test/browser/samples/missing-dependency-resolution/_config.js index c43f1b35637..07da69ed0ef 100644 --- a/test/browser/samples/missing-dependency-resolution/_config.js +++ b/test/browser/samples/missing-dependency-resolution/_config.js @@ -1,6 +1,6 @@ const { loader } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'fails if a dependency cannot be resolved', options: { plugins: loader({ @@ -15,4 +15,4 @@ console.log(foo);` url: 'https://rollupjs.org/plugin-development/#a-simple-example', watchFiles: ['main'] } -}; +}); diff --git a/test/browser/samples/missing-entry-resolution/_config.js b/test/browser/samples/missing-entry-resolution/_config.js index 138125544c4..f122cdb59e1 100644 --- a/test/browser/samples/missing-entry-resolution/_config.js +++ b/test/browser/samples/missing-entry-resolution/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'fails if an entry cannot be resolved', error: { code: 'NO_FS_IN_BROWSER', @@ -6,4 +6,4 @@ module.exports = { 'Cannot access the file system (via "path.resolve") when using the browser build of Rollup. Make sure you supply a plugin with custom resolveId and load hooks to Rollup.', url: 'https://rollupjs.org/plugin-development/#a-simple-example' } -}; +}); diff --git a/test/browser/samples/missing-load/_config.js b/test/browser/samples/missing-load/_config.js index 7e2eeb7521d..6cffb4e5c40 100644 --- a/test/browser/samples/missing-load/_config.js +++ b/test/browser/samples/missing-load/_config.js @@ -1,7 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'fails if a file cannot be loaded', options: { plugins: { + name: 'test', resolveId(source) { return source; } @@ -14,4 +15,4 @@ module.exports = { url: 'https://rollupjs.org/plugin-development/#a-simple-example', watchFiles: ['main'] } -}; +}); diff --git a/test/browser/samples/renormalizes-external-paths/_config.js b/test/browser/samples/renormalizes-external-paths/_config.js index 85e9046542c..cc3de31a68f 100644 --- a/test/browser/samples/renormalizes-external-paths/_config.js +++ b/test/browser/samples/renormalizes-external-paths/_config.js @@ -1,6 +1,6 @@ const { join, dirname } = require('node:path').posix; -module.exports = { +module.exports = defineTest({ description: 'renormalizes external paths if possible', options: { input: ['/main.js', '/nested/entry.js'], @@ -8,6 +8,7 @@ module.exports = { return id.endsWith('ext'); }, plugins: { + name: 'test-plugin', resolveId(source, importer) { if (source.endsWith('ext.js')) { return false; @@ -44,4 +45,4 @@ import './nested-ext.js';`; } } } -}; +}); diff --git a/test/browser/samples/supports-hashes/_config.js b/test/browser/samples/supports-hashes/_config.js index 6079c64980d..c90c50c9bb3 100644 --- a/test/browser/samples/supports-hashes/_config.js +++ b/test/browser/samples/supports-hashes/_config.js @@ -1,6 +1,6 @@ const { loader } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'bundles files for the browser', options: { input: ['main', 'dep'], @@ -13,4 +13,4 @@ console.log(foo);`, entryFileNames: '[name]-[hash].js' } } -}; +}); diff --git a/test/browser/tsconfig.json b/test/browser/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/browser/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/chunking-form/define.d.ts b/test/chunking-form/define.d.ts new file mode 100644 index 00000000000..00b66beb120 --- /dev/null +++ b/test/chunking-form/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigChunkingForm } from '../types'; + +declare global { + function defineTest(config: TestConfigChunkingForm): TestConfigChunkingForm; +} diff --git a/test/chunking-form/index.js b/test/chunking-form/index.js index bf241964a27..f0dd86fcd40 100644 --- a/test/chunking-form/index.js +++ b/test/chunking-form/index.js @@ -1,5 +1,8 @@ const { basename, resolve } = require('node:path'); const { chdir } = require('node:process'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ const { rollup } = require('../../dist/rollup'); const { runTestSuiteWithSamples, assertDirectoriesAreEqual } = require('../utils.js'); @@ -63,6 +66,7 @@ async function generateAndTestBundle(bundle, outputOptions, expectedDirectory, c if (outputOptions.format === 'amd' && config.runAmd) { try { const exports = await new Promise((resolve, reject) => { + // @ts-expect-error global global.assert = require('node:assert'); const requirejs = require('requirejs'); requirejs.config({ baseUrl: outputOptions.dir }); @@ -73,7 +77,9 @@ async function generateAndTestBundle(bundle, outputOptions, expectedDirectory, c } } finally { delete require.cache[require.resolve('requirejs')]; + // @ts-expect-error global delete global.requirejsVars; + // @ts-expect-error global delete global.assert; } } diff --git a/test/chunking-form/samples/aliasing-extensions/_config.js b/test/chunking-form/samples/aliasing-extensions/_config.js index aa5a872d5b7..75668bcd7c4 100644 --- a/test/chunking-form/samples/aliasing-extensions/_config.js +++ b/test/chunking-form/samples/aliasing-extensions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk aliasing with extensions', options: { input: ['main1', 'main2', 'main3.ts'] } -}; +}); diff --git a/test/chunking-form/samples/amd-id-auto-base-path-concat/_config.js b/test/chunking-form/samples/amd-id-auto-base-path-concat/_config.js index 754ccbcbd10..34581fa6241 100644 --- a/test/chunking-form/samples/amd-id-auto-base-path-concat/_config.js +++ b/test/chunking-form/samples/amd-id-auto-base-path-concat/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: "allows to use amd.autoId with amd.basePath and works when concat'd into one file", options: { input: ['main'], @@ -31,4 +31,4 @@ module.exports = { return exports.getA(); } } -}; +}); diff --git a/test/chunking-form/samples/amd-id-auto-base-path/_config.js b/test/chunking-form/samples/amd-id-auto-base-path/_config.js index f8158e4cd6a..9e49a70026b 100644 --- a/test/chunking-form/samples/amd-id-auto-base-path/_config.js +++ b/test/chunking-form/samples/amd-id-auto-base-path/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to use amd.autoId with amd.basePath, and chunks folder', options: { input: ['main'], @@ -16,4 +16,4 @@ module.exports = { return exports.getA(); } } -}; +}); diff --git a/test/chunking-form/samples/amd-id-auto/_config.js b/test/chunking-form/samples/amd-id-auto/_config.js index e2ced9f0459..62dce8813f7 100644 --- a/test/chunking-form/samples/amd-id-auto/_config.js +++ b/test/chunking-form/samples/amd-id-auto/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to use amd.autoId', options: { input: ['main'], @@ -13,4 +13,4 @@ module.exports = { return exports.getA(); } } -}; +}); diff --git a/test/chunking-form/samples/asset-needs-code-reference-same-source/_config.js b/test/chunking-form/samples/asset-needs-code-reference-same-source/_config.js index 158c7510a84..932e0a08294 100644 --- a/test/chunking-form/samples/asset-needs-code-reference-same-source/_config.js +++ b/test/chunking-form/samples/asset-needs-code-reference-same-source/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'emits unreferenced assets if needsCodeReference is true if they are also emitted without that flag', options: { @@ -95,4 +95,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/asset-needs-code-reference/_config.js b/test/chunking-form/samples/asset-needs-code-reference/_config.js index c832eba576a..d593ffa4d11 100644 --- a/test/chunking-form/samples/asset-needs-code-reference/_config.js +++ b/test/chunking-form/samples/asset-needs-code-reference/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const fs = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'does not emit unreferenced assets if needsCodeReference is true', options: { output: { @@ -32,4 +32,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/avoid-chunk-import-hoisting/_config.js b/test/chunking-form/samples/avoid-chunk-import-hoisting/_config.js index e46fa0fd615..1b0d962ce0c 100644 --- a/test/chunking-form/samples/avoid-chunk-import-hoisting/_config.js +++ b/test/chunking-form/samples/avoid-chunk-import-hoisting/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids hoisting transitive dependencies via flag', options: { input: ['main1.js', 'main2.js'], @@ -7,4 +7,4 @@ module.exports = { hoistTransitiveImports: false } } -}; +}); diff --git a/test/chunking-form/samples/basic-chunking/_config.js b/test/chunking-form/samples/basic-chunking/_config.js index a601862651e..0f55acd1edc 100644 --- a/test/chunking-form/samples/basic-chunking/_config.js +++ b/test/chunking-form/samples/basic-chunking/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'simple chunking', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-deshadowing-reassignment/_config.js b/test/chunking-form/samples/chunk-deshadowing-reassignment/_config.js index e0abcec057f..c4a86112011 100644 --- a/test/chunking-form/samples/chunk-deshadowing-reassignment/_config.js +++ b/test/chunking-form/samples/chunk-deshadowing-reassignment/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk reassignment import deshadowing', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-execution-order/_config.js b/test/chunking-form/samples/chunk-execution-order/_config.js index 74ee8f5f11c..53b6ecbb3b1 100644 --- a/test/chunking-form/samples/chunk-execution-order/_config.js +++ b/test/chunking-form/samples/chunk-execution-order/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'maintains execution order ', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-export-deshadowing/_config.js b/test/chunking-form/samples/chunk-export-deshadowing/_config.js index 5301c6b729b..5a9970b0b25 100644 --- a/test/chunking-form/samples/chunk-export-deshadowing/_config.js +++ b/test/chunking-form/samples/chunk-export-deshadowing/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk export deshadowing', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-export-renaming/_config.js b/test/chunking-form/samples/chunk-export-renaming/_config.js index e24d7ae8389..e743bcb4fc0 100644 --- a/test/chunking-form/samples/chunk-export-renaming/_config.js +++ b/test/chunking-form/samples/chunk-export-renaming/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk export renaming', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-import-deshadowing/_config.js b/test/chunking-form/samples/chunk-import-deshadowing/_config.js index 4bfe9e670a7..9b0e303d2ae 100644 --- a/test/chunking-form/samples/chunk-import-deshadowing/_config.js +++ b/test/chunking-form/samples/chunk-import-deshadowing/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk import deshadowing', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-live-bindings/_config.js b/test/chunking-form/samples/chunk-live-bindings/_config.js index 85aeb5f738b..3fc1fb7b7b8 100644 --- a/test/chunking-form/samples/chunk-live-bindings/_config.js +++ b/test/chunking-form/samples/chunk-live-bindings/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'ES module live bindings in chunks', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-namespace-boundary/_config.js b/test/chunking-form/samples/chunk-namespace-boundary/_config.js index 0a1af5188f6..87e946f115a 100644 --- a/test/chunking-form/samples/chunk-namespace-boundary/_config.js +++ b/test/chunking-form/samples/chunk-namespace-boundary/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk with a namespace boundary', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunk-naming/_config.js b/test/chunking-form/samples/chunk-naming/_config.js index 1c4fa182faa..f7f0e219f43 100644 --- a/test/chunking-form/samples/chunk-naming/_config.js +++ b/test/chunking-form/samples/chunk-naming/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'simple chunking', options: { input: { @@ -10,4 +10,4 @@ module.exports = { chunkFileNames: 'chunks/chunk.js' } } -}; +}); diff --git a/test/chunking-form/samples/chunk-variable-name-conflict/_config.js b/test/chunking-form/samples/chunk-variable-name-conflict/_config.js index bded69227e6..2d3898b4196 100644 --- a/test/chunking-form/samples/chunk-variable-name-conflict/_config.js +++ b/test/chunking-form/samples/chunk-variable-name-conflict/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk variable name conflict', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/chunking-compact/_config.js b/test/chunking-form/samples/chunking-compact/_config.js index 341b669ef2f..407e02c1727 100644 --- a/test/chunking-form/samples/chunking-compact/_config.js +++ b/test/chunking-form/samples/chunking-compact/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'chunking compact and mangled output', options: { input: ['main1.js', 'main2.js'], @@ -7,4 +7,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/chunking-form/samples/chunking-externals/_config.js b/test/chunking-form/samples/chunking-externals/_config.js index 31a37faf7e6..f2630b5a279 100644 --- a/test/chunking-form/samples/chunking-externals/_config.js +++ b/test/chunking-form/samples/chunking-externals/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'chunking external module handling', options: { input: ['main1.js', 'main2.js'], external: ['external'] } -}; +}); diff --git a/test/chunking-form/samples/chunking-reexport/_config.js b/test/chunking-form/samples/chunking-reexport/_config.js index 19248895def..ad213495366 100644 --- a/test/chunking-form/samples/chunking-reexport/_config.js +++ b/test/chunking-form/samples/chunking-reexport/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'chunking star external', options: { input: ['main1.js', 'main2.js'], external: ['external'] } -}; +}); diff --git a/test/chunking-form/samples/chunking-source-maps/_config.js b/test/chunking-form/samples/chunking-source-maps/_config.js index 172d5f652b0..b3272e3c679 100644 --- a/test/chunking-form/samples/chunking-source-maps/_config.js +++ b/test/chunking-form/samples/chunking-source-maps/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'source maps', options: { input: ['main1.js', 'main2.js'], @@ -6,4 +6,4 @@ module.exports = { sourcemap: true } } -}; +}); diff --git a/test/chunking-form/samples/chunking-star-external/_config.js b/test/chunking-form/samples/chunking-star-external/_config.js index 854a3591362..2ab2aae45cb 100644 --- a/test/chunking-form/samples/chunking-star-external/_config.js +++ b/test/chunking-form/samples/chunking-star-external/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'chunking star external', options: { input: ['main1.js', 'main2.js'], external: ['external1', 'external2', 'starexternal1', 'starexternal2'] } -}; +}); diff --git a/test/chunking-form/samples/circular-entry-points/_config.js b/test/chunking-form/samples/circular-entry-points/_config.js index c594e1ff53b..b12b129c5df 100644 --- a/test/chunking-form/samples/circular-entry-points/_config.js +++ b/test/chunking-form/samples/circular-entry-points/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'chunking circular entry points', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/circular-entry-points2/_config.js b/test/chunking-form/samples/circular-entry-points2/_config.js index 4894b95c53b..b3da7733aff 100644 --- a/test/chunking-form/samples/circular-entry-points2/_config.js +++ b/test/chunking-form/samples/circular-entry-points2/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'does not create a facade for one circular entry point if possible', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/circular-entry-points3/_config.js b/test/chunking-form/samples/circular-entry-points3/_config.js index 8902b116aef..c73b3d824e6 100644 --- a/test/chunking-form/samples/circular-entry-points3/_config.js +++ b/test/chunking-form/samples/circular-entry-points3/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'creates facades for all circular entry points if they become tainted by another entry', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: ['main1.js', 'main2.js', 'main3.js'] } -}; +}); diff --git a/test/chunking-form/samples/circular-manual-chunks/_config.js b/test/chunking-form/samples/circular-manual-chunks/_config.js index 4a03dcf2c88..29b6382e959 100644 --- a/test/chunking-form/samples/circular-manual-chunks/_config.js +++ b/test/chunking-form/samples/circular-manual-chunks/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'handles manual chunks with circular dependencies', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { input: 'main', output: { manualChunks: { lib1: ['lib1'], lib2: ['lib2'] } } } -}; +}); diff --git a/test/chunking-form/samples/combined-namespace-reexport/_config.js b/test/chunking-form/samples/combined-namespace-reexport/_config.js index 7c41d4f14e8..c7ae8738bf7 100644 --- a/test/chunking-form/samples/combined-namespace-reexport/_config.js +++ b/test/chunking-form/samples/combined-namespace-reexport/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles combined namespace reexports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/custom-sanitizer/_config.js b/test/chunking-form/samples/custom-sanitizer/_config.js index 0abca0b2f08..c556c19f323 100644 --- a/test/chunking-form/samples/custom-sanitizer/_config.js +++ b/test/chunking-form/samples/custom-sanitizer/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'supports custom file name sanitizer functions', options: { plugins: [ { + name: 'test-plugin', buildStart() { this.emitFile({ type: 'asset', name: 'asset.txt', source: 'asset' }); } @@ -15,4 +16,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/deconflict-globals/_config.js b/test/chunking-form/samples/deconflict-globals/_config.js index 9ffbdeef487..cb6c7c55b09 100644 --- a/test/chunking-form/samples/deconflict-globals/_config.js +++ b/test/chunking-form/samples/deconflict-globals/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deconflict due to global variables used in other chunks', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/deconflict-system-default-export-variable/_config.js b/test/chunking-form/samples/deconflict-system-default-export-variable/_config.js index f0300a3c472..f07effdb049 100644 --- a/test/chunking-form/samples/deconflict-system-default-export-variable/_config.js +++ b/test/chunking-form/samples/deconflict-system-default-export-variable/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts SystemJS default export variable with namespace imports', options: { external: 'external', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/deduplicate-imports-referencing-originals-2/_config.js b/test/chunking-form/samples/deduplicate-imports-referencing-originals-2/_config.js index a393eccd704..f938b8172b2 100644 --- a/test/chunking-form/samples/deduplicate-imports-referencing-originals-2/_config.js +++ b/test/chunking-form/samples/deduplicate-imports-referencing-originals-2/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'do not import variables that reference an original if another variable referencing it is already imported', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/deduplicate-imports-referencing-originals/_config.js b/test/chunking-form/samples/deduplicate-imports-referencing-originals/_config.js index 8bf09102383..7053b779517 100644 --- a/test/chunking-form/samples/deduplicate-imports-referencing-originals/_config.js +++ b/test/chunking-form/samples/deduplicate-imports-referencing-originals/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'do not import variables that reference an original if the original is already imported', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/default-export-name-conflict/_config.js b/test/chunking-form/samples/default-export-name-conflict/_config.js index 958b2db90bb..ff47dc7beb5 100644 --- a/test/chunking-form/samples/default-export-name-conflict/_config.js +++ b/test/chunking-form/samples/default-export-name-conflict/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not produce name conflicts when reexporting via default exports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/default-identifier-renaming/_config.js b/test/chunking-form/samples/default-identifier-renaming/_config.js index d6e0502667f..56449217213 100644 --- a/test/chunking-form/samples/default-identifier-renaming/_config.js +++ b/test/chunking-form/samples/default-identifier-renaming/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Default export identifier name handling', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/default-reexport-namespace/_config.js b/test/chunking-form/samples/default-reexport-namespace/_config.js index 20ee29986bd..18616527b0c 100644 --- a/test/chunking-form/samples/default-reexport-namespace/_config.js +++ b/test/chunking-form/samples/default-reexport-namespace/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Properly handle adding a default reexport to a namespace (#3583)', options: { input: ['main.js', 'icons/one.js'] } -}; +}); diff --git a/test/chunking-form/samples/deprecated/avoid-imports-preserve-modules/_config.js b/test/chunking-form/samples/deprecated/avoid-imports-preserve-modules/_config.js index 4f170640cfb..b368e78bc3d 100644 --- a/test/chunking-form/samples/deprecated/avoid-imports-preserve-modules/_config.js +++ b/test/chunking-form/samples/deprecated/avoid-imports-preserve-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids empty imports if they do not have side-effects when preserving modules (#3359)', options: { @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/circular-manual-chunks/_config.js b/test/chunking-form/samples/deprecated/circular-manual-chunks/_config.js index c52339e8003..12a9913ebd6 100644 --- a/test/chunking-form/samples/deprecated/circular-manual-chunks/_config.js +++ b/test/chunking-form/samples/deprecated/circular-manual-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles manual chunks with circular dependencies', expectedWarnings: ['CIRCULAR_DEPENDENCY', 'DEPRECATED_FEATURE'], options: { @@ -6,4 +6,4 @@ module.exports = { input: 'main', manualChunks: { lib1: ['lib1'], lib2: ['lib2'] } } -}; +}); diff --git a/test/chunking-form/samples/deprecated/dynamic-import-comments/_config.js b/test/chunking-form/samples/deprecated/dynamic-import-comments/_config.js index 29065eec4a7..746c725029c 100644 --- a/test/chunking-form/samples/deprecated/dynamic-import-comments/_config.js +++ b/test/chunking-form/samples/deprecated/dynamic-import-comments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'should not remove inline comments inside dynamic import', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/dynamic-import-inlining-object/_config.js b/test/chunking-form/samples/deprecated/dynamic-import-inlining-object/_config.js index a40ae4c75ed..96d7c5a1115 100644 --- a/test/chunking-form/samples/deprecated/dynamic-import-inlining-object/_config.js +++ b/test/chunking-form/samples/deprecated/dynamic-import-inlining-object/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports an object with a single entry when inlining dynamic imports', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { input: { entry: 'main' } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/dynamic-import-name/_config.js b/test/chunking-form/samples/deprecated/dynamic-import-name/_config.js index cd7d733c719..a9f1c4e01de 100644 --- a/test/chunking-form/samples/deprecated/dynamic-import-name/_config.js +++ b/test/chunking-form/samples/deprecated/dynamic-import-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows specifying a custom importer function', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/emit-file-chunk-facade/_config.js b/test/chunking-form/samples/deprecated/emit-file-chunk-facade/_config.js index 1aff87db4b2..dad2efee3d5 100644 --- a/test/chunking-form/samples/deprecated/emit-file-chunk-facade/_config.js +++ b/test/chunking-form/samples/deprecated/emit-file-chunk-facade/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'retrieves the correct name of an emitted chunk in case a facade is created', options: { strictDeprecations: false, @@ -19,4 +19,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/empty-module-no-treeshake/_config.js b/test/chunking-form/samples/deprecated/empty-module-no-treeshake/_config.js index ec6702573ae..bd12a97ad57 100644 --- a/test/chunking-form/samples/deprecated/empty-module-no-treeshake/_config.js +++ b/test/chunking-form/samples/deprecated/empty-module-no-treeshake/_config.js @@ -1,8 +1,9 @@ const assert = require('node:assert'); const path = require('node:path'); +// @ts-expect-error not included in types const { getObject } = require('../../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'associates empty modules with chunks if tree-shaking is disabled for them', options: { strictDeprecations: false, @@ -66,4 +67,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/indirect-reexports-preserve-modules/_config.js b/test/chunking-form/samples/deprecated/indirect-reexports-preserve-modules/_config.js index 41677d57da1..481a1edb510 100644 --- a/test/chunking-form/samples/deprecated/indirect-reexports-preserve-modules/_config.js +++ b/test/chunking-form/samples/deprecated/indirect-reexports-preserve-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not drop indirect reexports when preserving modules', expectedWarnings: ['MIXED_EXPORTS', 'DEPRECATED_FEATURE'], options: { @@ -6,4 +6,4 @@ module.exports = { output: { name: 'bundle' }, preserveModules: true } -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunk-avoid-facade/_config.js b/test/chunking-form/samples/deprecated/manual-chunk-avoid-facade/_config.js index f0d81228885..41df7cd662b 100644 --- a/test/chunking-form/samples/deprecated/manual-chunk-avoid-facade/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunk-avoid-facade/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoid facades if possible when using manual chunks', options: { strictDeprecations: false, @@ -8,4 +8,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-conflict/_config.js b/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-conflict/_config.js index 2a955ff0af5..cac8317c380 100644 --- a/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-conflict/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses entry alias if manual chunks contain entry chunks with different alias', options: { strictDeprecations: false, @@ -11,4 +11,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-match/_config.js b/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-match/_config.js index 5b1b3bd7d42..c13a9584f8b 100644 --- a/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-match/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunk-contains-entry-match/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Identifies the entry chunk with the manual chunk that contains it if the aliases match', options: { @@ -11,4 +11,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunk-is-entry-conflict/_config.js b/test/chunking-form/samples/deprecated/manual-chunk-is-entry-conflict/_config.js index d43369b5207..21f5ba76e6e 100644 --- a/test/chunking-form/samples/deprecated/manual-chunk-is-entry-conflict/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunk-is-entry-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses entry alias if manual chunks are entry chunks with different alias', options: { strictDeprecations: false, @@ -11,4 +11,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunk-is-entry-match/_config.js b/test/chunking-form/samples/deprecated/manual-chunk-is-entry-match/_config.js index 7a8a9aa09d6..3f5ac15538b 100644 --- a/test/chunking-form/samples/deprecated/manual-chunk-is-entry-match/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunk-is-entry-match/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Identifies the entry chunk with the manual chunk that has the same entry if the aliases match', options: { @@ -11,4 +11,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-different-nested/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-different-nested/_config.js index 97bdd7c68aa..e50efec07c7 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-different-nested/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-different-nested/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks can have other manual chunks as dependencies', options: { strictDeprecations: false, @@ -10,4 +10,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-dynamic-facades/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-dynamic-facades/_config.js index 957df0be4f3..b906013dae4 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-dynamic-facades/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-dynamic-facades/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates facades for dynamic manual chunks if necessary', options: { strictDeprecations: false, @@ -8,4 +8,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-dynamic-name-conflict/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-dynamic-name-conflict/_config.js index c7344810ced..e9c932a35e5 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-dynamic-name-conflict/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-dynamic-name-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles name conflicts in manual chunks', options: { strictDeprecations: false, @@ -8,4 +8,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-dynamic/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-dynamic/_config.js index cdf062d322f..2501bda21ac 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-dynamic/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-dynamic/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports dynamic manual chunks', options: { strictDeprecations: false, @@ -8,4 +8,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-function/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-function/_config.js index ab8ca176201..8952acaec79 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-function/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to define manual chunks via a function', options: { strictDeprecations: false, @@ -10,4 +10,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks-nested/_config.js b/test/chunking-form/samples/deprecated/manual-chunks-nested/_config.js index 29e3d7d3db0..e988680a02e 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks-nested/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks-nested/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks can contain nested modules', options: { strictDeprecations: false, @@ -8,4 +8,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/manual-chunks/_config.js b/test/chunking-form/samples/deprecated/manual-chunks/_config.js index bfe73d1c721..08bb1489df0 100644 --- a/test/chunking-form/samples/deprecated/manual-chunks/_config.js +++ b/test/chunking-form/samples/deprecated/manual-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks support', options: { strictDeprecations: false, @@ -9,4 +9,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/missing-export-reused-deconflicting/_config.js b/test/chunking-form/samples/deprecated/missing-export-reused-deconflicting/_config.js index ccf4f87d8d0..3204a18a80c 100644 --- a/test/chunking-form/samples/deprecated/missing-export-reused-deconflicting/_config.js +++ b/test/chunking-form/samples/deprecated/missing-export-reused-deconflicting/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles using dependencies with shimmed missing exports as ', expectedWarnings: ['SHIMMED_EXPORT', 'DEPRECATED_FEATURE'], options: { @@ -7,4 +7,4 @@ module.exports = { preserveModules: true, shimMissingExports: true } -}; +}); diff --git a/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js b/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js index 793d274dd1e..acbfd7b6c2a 100644 --- a/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js +++ b/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports of entry chunks with default export mode', options: { @@ -9,4 +9,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import/_config.js b/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import/_config.js index 6c668f2287e..575cabf506e 100644 --- a/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import/_config.js +++ b/test/chunking-form/samples/deprecated/namespace-tostring/dynamic-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports', options: { strictDeprecations: false, @@ -7,4 +7,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-auto-export-mode/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-auto-export-mode/_config.js index 82c01d0483c..0c0972b78df 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-auto-export-mode/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-auto-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses entry point semantics for all files when preserving modules', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-commonjs/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-commonjs/_config.js index d0a5ee29834..5a551c30ac9 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-commonjs/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-commonjs/_config.js @@ -1,6 +1,6 @@ const commonjs = require('@rollup/plugin-commonjs'); -module.exports = { +module.exports = defineTest({ description: 'Handles output from @rollup/plugin-commonjs', expectedWarnings: ['MIXED_EXPORTS', 'DEPRECATED_FEATURE'], options: { @@ -10,4 +10,4 @@ module.exports = { external: ['external'], plugins: [commonjs()] } -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-dynamic-imports/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-dynamic-imports/_config.js index 9d22f1265be..565a7037a0f 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-dynamic-imports/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-dynamic-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'dynamic imports are handled correctly when preserving modules', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-dynamic-namespace/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-dynamic-namespace/_config.js index 7ee5f88593a..36f30eeec44 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-dynamic-namespace/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-dynamic-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules properly handles internal namespace imports (#2576)', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-empty/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-empty/_config.js index af98a0768a3..9c0b23efcee 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-empty/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-empty/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules remove empty dependencies', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-export-alias/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-export-alias/_config.js index de49b787e78..d544144ad5a 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-export-alias/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-export-alias/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm export aliases are preserved in modules', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js index 45c40e15b67..aa99c0a74f9 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'entryFileNames pattern supported in combination with preserveModules', options: { strictDeprecations: false, @@ -9,4 +9,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-id-case-sensitive/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-id-case-sensitive/_config.js index 4e94da5c1ff..2d68e2aacd9 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-id-case-sensitive/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-id-case-sensitive/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules id case sensitive', options: { strictDeprecations: false, @@ -20,4 +20,4 @@ module.exports = { ] }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-named-export-mode/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-named-export-mode/_config.js index 9a4318fbc5d..6ad3a9ed231 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-named-export-mode/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-named-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'respects "named" export mode in all chunks when preserving modules', options: { strictDeprecations: false, @@ -9,4 +9,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-nested-barrel-es-export/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-nested-barrel-es-export/_config.js index 130b08f42dd..5ec0f76923b 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-nested-barrel-es-export/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-nested-barrel-es-export/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm exports are deconflicted when exporting nested index aliases', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-nested-export/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-nested-export/_config.js index 3f39126a643..2997fa8cf86 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-nested-export/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-nested-export/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm exports are preserved when exporting a module', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-non-entry-imports/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-non-entry-imports/_config.js index 9a74ad23ea9..d7e6ce2702f 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-non-entry-imports/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-non-entry-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'imports and exports of non-entry points are tracked', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-proxy-import/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-proxy-import/_config.js index 277a0d24c49..951a6d939ce 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-proxy-import/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-proxy-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves imports via a proxy module as direct imports when preserving modules', options: { @@ -7,4 +7,4 @@ module.exports = { external: 'external' }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-reaching-outside/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-reaching-outside/_config.js index 0d5c9eb2e76..804c626e7d6 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-reaching-outside/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-reaching-outside/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'change the module destination', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-scriptified-assets/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-scriptified-assets/_config.js index 9d6b22b98da..53398ea6888 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-scriptified-assets/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-scriptified-assets/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'scriptified assets have extension in preserveModules output filename', options: { strictDeprecations: false, @@ -29,4 +29,4 @@ module.exports = { ] }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-single-entry/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-single-entry/_config.js index 4f9cbcbea6d..3391dffa7aa 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-single-entry/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-single-entry/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'single entry names file correctly', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-virtual-modules/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-virtual-modules/_config.js index 163da380583..c9dc6418c08 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-virtual-modules/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-virtual-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { strictDeprecations: false, @@ -21,4 +21,4 @@ module.exports = { ] }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/deprecated/preserve-modules/_config.js b/test/chunking-form/samples/deprecated/preserve-modules/_config.js index 77705540676..f4388489320 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Rewrite modules in-place', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { preserveModules: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-chained/_config.js b/test/chunking-form/samples/dynamic-import-chained/_config.js index 31a03c704ee..e6c2c18e41b 100644 --- a/test/chunking-form/samples/dynamic-import-chained/_config.js +++ b/test/chunking-form/samples/dynamic-import-chained/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'includes chained dynamic imports', options: { input: 'main.js' } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-chunking/_config.js b/test/chunking-form/samples/dynamic-import-chunking/_config.js index b4c10960b3f..d9d17675315 100644 --- a/test/chunking-form/samples/dynamic-import-chunking/_config.js +++ b/test/chunking-form/samples/dynamic-import-chunking/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Code splitting with dynamic import', options: { input: ['main.js'], preserveEntrySignatures: 'strict' } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-comments/_config.js b/test/chunking-form/samples/dynamic-import-comments/_config.js index 9e74bcab779..57d3faa7e5e 100644 --- a/test/chunking-form/samples/dynamic-import-comments/_config.js +++ b/test/chunking-form/samples/dynamic-import-comments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not remove inline comments inside dynamic imports', options: { input: 'main.js', @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-dynamic/_config.js b/test/chunking-form/samples/dynamic-import-dynamic/_config.js index 288d17f8111..c1e7e16a5a8 100644 --- a/test/chunking-form/samples/dynamic-import-dynamic/_config.js +++ b/test/chunking-form/samples/dynamic-import-dynamic/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Code splitting with dynamic import', options: { input: ['main.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-external/_config.js b/test/chunking-form/samples/dynamic-import-external/_config.js index 1e5e80586bd..e3b7b971d89 100644 --- a/test/chunking-form/samples/dynamic-import-external/_config.js +++ b/test/chunking-form/samples/dynamic-import-external/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks dynamic imports as external when resolveDynamicImport returns false', options: { input: 'main.js', @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-facade/_config.js b/test/chunking-form/samples/dynamic-import-facade/_config.js index 62db88c24ef..d95396fa622 100644 --- a/test/chunking-form/samples/dynamic-import-facade/_config.js +++ b/test/chunking-form/samples/dynamic-import-facade/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure dynamic chunks are not tainted', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-from-manual-chunk/_config.js b/test/chunking-form/samples/dynamic-import-from-manual-chunk/_config.js index 626a63f40ab..10571bfac78 100644 --- a/test/chunking-form/samples/dynamic-import-from-manual-chunk/_config.js +++ b/test/chunking-form/samples/dynamic-import-from-manual-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports in manual chunks', options: { input: 'main.js', @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-inline-colouring/_config.js b/test/chunking-form/samples/dynamic-import-inline-colouring/_config.js index b5769882caf..c4f59f85519 100644 --- a/test/chunking-form/samples/dynamic-import-inline-colouring/_config.js +++ b/test/chunking-form/samples/dynamic-import-inline-colouring/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Handle dynamic imports that are part of a static graph', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-inlining-object/_config.js b/test/chunking-form/samples/dynamic-import-inlining-object/_config.js index 7dec64bfdc0..6a6b04a9f5e 100644 --- a/test/chunking-form/samples/dynamic-import-inlining-object/_config.js +++ b/test/chunking-form/samples/dynamic-import-inlining-object/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'supports an object with a single entry when inlining dynamic imports', options: { output: { inlineDynamicImports: true }, input: { entry: 'main' } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-only-default/_config.js b/test/chunking-form/samples/dynamic-import-only-default/_config.js index c96873edaf0..e345872ade5 100644 --- a/test/chunking-form/samples/dynamic-import-only-default/_config.js +++ b/test/chunking-form/samples/dynamic-import-only-default/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly imports dynamic namespaces with only a default export from entry- and non-entry-point chunks', options: { input: ['main', 'entry'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-only-reexports/_config.js b/test/chunking-form/samples/dynamic-import-only-reexports/_config.js index 1848e95f2e8..66aeea5f2f1 100644 --- a/test/chunking-form/samples/dynamic-import-only-reexports/_config.js +++ b/test/chunking-form/samples/dynamic-import-only-reexports/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports when the imported module only reexports from other modules', options: { input: ['main'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-statically-imported-2/_config.js b/test/chunking-form/samples/dynamic-import-statically-imported-2/_config.js index 2da1b771499..29c1025db4a 100644 --- a/test/chunking-form/samples/dynamic-import-statically-imported-2/_config.js +++ b/test/chunking-form/samples/dynamic-import-statically-imported-2/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports of previously statically imported chunks that are also dynamically imported by other chunks', options: { input: ['main.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-statically-imported/_config.js b/test/chunking-form/samples/dynamic-import-statically-imported/_config.js index 4fd6f721ac4..0017ffbb9de 100644 --- a/test/chunking-form/samples/dynamic-import-statically-imported/_config.js +++ b/test/chunking-form/samples/dynamic-import-statically-imported/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports of previously statically imported chunks', options: { input: ['main.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_config.js b/test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_config.js index 9c29bfb5406..f8f4fbc41ad 100644 --- a/test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_config.js +++ b/test/chunking-form/samples/dynamic-import-synthetic-exports-preserve-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handle dynamically importing a module with synthetic named exports when preserving modules', options: { @@ -16,4 +16,4 @@ module.exports = { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-tree-shaking-1/_config.js b/test/chunking-form/samples/dynamic-import-tree-shaking-1/_config.js index dcff9ec11b4..d57e7421e52 100644 --- a/test/chunking-form/samples/dynamic-import-tree-shaking-1/_config.js +++ b/test/chunking-form/samples/dynamic-import-tree-shaking-1/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses tree-shaking information to improve chunking', options: { input: { @@ -6,4 +6,4 @@ module.exports = { entryB: 'main2.js' } } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import-tree-shaking-2/_config.js b/test/chunking-form/samples/dynamic-import-tree-shaking-2/_config.js index 6d2783787e6..31e97827097 100644 --- a/test/chunking-form/samples/dynamic-import-tree-shaking-2/_config.js +++ b/test/chunking-form/samples/dynamic-import-tree-shaking-2/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not expose exports of chunks which were used by tree-shaken dynamic imports', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/dynamic-import/_config.js b/test/chunking-form/samples/dynamic-import/_config.js index c62aae20125..df578ea35a6 100644 --- a/test/chunking-form/samples/dynamic-import/_config.js +++ b/test/chunking-form/samples/dynamic-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports with a shared dependency', options: { input: ['main'], @@ -11,4 +11,4 @@ module.exports = { return exports.promise; } } -}; +}); diff --git a/test/chunking-form/samples/dynamically-import-facaded-entry/_config.js b/test/chunking-form/samples/dynamically-import-facaded-entry/_config.js index 0807ed35e5e..08ba9ac6fc0 100644 --- a/test/chunking-form/samples/dynamically-import-facaded-entry/_config.js +++ b/test/chunking-form/samples/dynamically-import-facaded-entry/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'uses existing entry facades for dynamic imports if present', options: { input: ['main.js', 'importer.js'], preserveEntrySignatures: 'strict' } -}; +}); diff --git a/test/chunking-form/samples/dynamically-import-non-preserved-entry/_config.js b/test/chunking-form/samples/dynamically-import-non-preserved-entry/_config.js index 4a2c34eaccc..e79f7985d56 100644 --- a/test/chunking-form/samples/dynamically-import-non-preserved-entry/_config.js +++ b/test/chunking-form/samples/dynamically-import-non-preserved-entry/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'supports dynamically importing entries with additional exports', options: { input: ['main.js', 'importer.js'], preserveEntrySignatures: false } -}; +}); diff --git a/test/chunking-form/samples/dynamically-import-tainted-entry/_config.js b/test/chunking-form/samples/dynamically-import-tainted-entry/_config.js index a1585477b41..5a68c82ae86 100644 --- a/test/chunking-form/samples/dynamically-import-tainted-entry/_config.js +++ b/test/chunking-form/samples/dynamically-import-tainted-entry/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'supports dynamically importing entries with additional exports', options: { input: ['main.js', 'importer.js'], preserveEntrySignatures: 'allow-extension' } -}; +}); diff --git a/test/chunking-form/samples/dynamically-import-untainted-entry/_config.js b/test/chunking-form/samples/dynamically-import-untainted-entry/_config.js index 423f6c73b4c..05358c08261 100644 --- a/test/chunking-form/samples/dynamically-import-untainted-entry/_config.js +++ b/test/chunking-form/samples/dynamically-import-untainted-entry/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'makes existing entries a proper facade if possible when importing dynamically', options: { input: ['main.js', 'importer.js'], preserveEntrySignatures: false } -}; +}); diff --git a/test/chunking-form/samples/emit-file/asset-file-names/_config.js b/test/chunking-form/samples/emit-file/asset-file-names/_config.js index c1350154cbf..dcdbc1af8cd 100644 --- a/test/chunking-form/samples/emit-file/asset-file-names/_config.js +++ b/test/chunking-form/samples/emit-file/asset-file-names/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports custom asset file names', options: { input: ['main.js'], @@ -12,4 +12,4 @@ module.exports = { assetFileNames: '[ext]/[hash]-[name][extname]' } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/deconflict-against-named-files/_config.js b/test/chunking-form/samples/emit-file/deconflict-against-named-files/_config.js index a3622a8c983..dca0a97b56e 100644 --- a/test/chunking-form/samples/emit-file/deconflict-against-named-files/_config.js +++ b/test/chunking-form/samples/emit-file/deconflict-against-named-files/_config.js @@ -1,6 +1,6 @@ const { loader } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts files against named files', options: { input: 'main', @@ -44,4 +44,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js b/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js index 747fbbadf41..7c018f63174 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js @@ -9,7 +9,7 @@ let string1Id, sameBufferAsStringId, otherBufferId; -module.exports = { +module.exports = defineTest({ description: 'deduplicates asset that have the same source', options: { input: ['main.js'], @@ -105,4 +105,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-asset-without-name/_config.js b/test/chunking-form/samples/emit-file/emit-asset-without-name/_config.js index 94cd5b89b47..73ac501f733 100644 --- a/test/chunking-form/samples/emit-file/emit-asset-without-name/_config.js +++ b/test/chunking-form/samples/emit-file/emit-asset-without-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports emitting an asset without a name', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-facade/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-facade/_config.js index 803f954f9d7..a6fe75a2f3e 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-facade/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-facade/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'retrieves the correct name of an emitted chunk in case a facade is created', options: { input: 'main', @@ -19,4 +19,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-filename/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-filename/_config.js index be6d7e3ad7a..087ea48ce47 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-filename/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-filename/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'supports specifying a file name when emitting a chunk', options: { input: 'main', @@ -24,4 +24,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-name-conflict/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-name-conflict/_config.js index ce14a9334cf..987b2617332 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-name-conflict/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-name-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deduplicates named chunks emitted more than once', options: { // For the second entry, a facade is created @@ -28,4 +28,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-named/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-named/_config.js index a0599023032..d4f66160c67 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-named/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-named/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'allows naming emitted chunks', options: { input: 'main', @@ -14,4 +14,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-order1/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-order1/_config.js index 53b698506da..9bb20f1b293 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-order1/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-order1/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'creates a consistent chunking order (needs to be consistent with the other test of this kind)', options: { @@ -33,4 +33,4 @@ console.log(id, value); } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-order2/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-order2/_config.js index 74f74b0cf9b..0ee9a7a012f 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-order2/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-order2/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'creates a consistent chunking order (needs to be consistent with the other test of this kind)', options: { @@ -39,4 +39,4 @@ console.log(id, value); } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-with-importer/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-with-importer/_config.js index 86d1c79d864..a13bfdc3714 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-with-importer/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-with-importer/_config.js @@ -3,7 +3,7 @@ let noImporterReferenceId; let mainReferenceId; let nestedReferenceId; -module.exports = { +module.exports = defineTest({ description: 'allows specifying an importer when resolving ids', options: { input: 'main', @@ -32,4 +32,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-worker/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-worker/_config.js index f77180193a7..eb3489b8333 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-worker/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-worker/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); let workerId; let proxyId; -module.exports = { +module.exports = defineTest({ description: 'allows adding additional chunks to be used in workers', options: { input: 'main', @@ -51,4 +51,4 @@ requirejs(['${chunkFileName}']);`; } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk-worklet/_config.js b/test/chunking-form/samples/emit-file/emit-chunk-worklet/_config.js index 70bd5ddb829..fce3461112d 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk-worklet/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk-worklet/_config.js @@ -1,6 +1,6 @@ const REGISTER_WORKLET = 'register-paint-worklet:'; -module.exports = { +module.exports = defineTest({ description: 'allows adding additional chunks to be used in worklets', options: { input: 'main', @@ -26,4 +26,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emit-chunk/_config.js b/test/chunking-form/samples/emit-file/emit-chunk/_config.js index 0e416de5b8f..14dbf9d2615 100644 --- a/test/chunking-form/samples/emit-file/emit-chunk/_config.js +++ b/test/chunking-form/samples/emit-file/emit-chunk/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'allows adding additional chunks and retrieving their file name', options: { input: 'main', @@ -22,4 +22,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emits-existing-chunk/_config.js b/test/chunking-form/samples/emit-file/emits-existing-chunk/_config.js index 404461da95e..a7e3a49dc43 100644 --- a/test/chunking-form/samples/emit-file/emits-existing-chunk/_config.js +++ b/test/chunking-form/samples/emit-file/emits-existing-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows adding modules already in the graph as entry points', options: { input: { @@ -16,4 +16,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js index 4ef7b6e67d7..abd31580334 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports emitting assets from plugin hooks', options: { input: ['main.js'], @@ -81,4 +81,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns-preserve-modules/_config.js b/test/chunking-form/samples/emit-file/filenames-function-patterns-preserve-modules/_config.js index 14dd6ed6738..83a8fda58fe 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns-preserve-modules/_config.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns-preserve-modules/_config.js @@ -4,7 +4,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEB = path.join(__dirname, 'deb.js'); -module.exports = { +module.exports = defineTest({ description: 'supports using a function that returns a pattern for entryFileNames, with output.preserveModules option', options: { @@ -53,4 +53,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/filenames-function-patterns/_config.js b/test/chunking-form/samples/emit-file/filenames-function-patterns/_config.js index ca50740d716..cacee4fa8bd 100644 --- a/test/chunking-form/samples/emit-file/filenames-function-patterns/_config.js +++ b/test/chunking-form/samples/emit-file/filenames-function-patterns/_config.js @@ -4,11 +4,12 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEB = path.join(__dirname, 'deb.js'); -module.exports = { +module.exports = defineTest({ description: 'supports using a function that returns a pattern for FileNames', options: { input: ['main.js'], plugins: { + name: 'test-plugin', transform() { this.emitFile({ type: 'asset', name: 'test.txt', source: 'hello world' }); return null; @@ -63,4 +64,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/named-user-chunks/_config.js b/test/chunking-form/samples/emit-file/named-user-chunks/_config.js index fd3a66ca677..b59bc1f5d1f 100644 --- a/test/chunking-form/samples/emit-file/named-user-chunks/_config.js +++ b/test/chunking-form/samples/emit-file/named-user-chunks/_config.js @@ -4,7 +4,7 @@ let referenceIdName; let referenceIdFileName1; let referenceIdFileName2; -module.exports = { +module.exports = defineTest({ description: 'deduplicates with named chunks defined by the user', options: { input: { mainChunk: 'main', mainChunkFacade: 'main' }, @@ -29,4 +29,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/reference-files/_config.js b/test/chunking-form/samples/emit-file/reference-files/_config.js index 8eaf23c4310..7736eceee20 100644 --- a/test/chunking-form/samples/emit-file/reference-files/_config.js +++ b/test/chunking-form/samples/emit-file/reference-files/_config.js @@ -1,7 +1,7 @@ const { readFileSync } = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'allows referencing emitted files', options: { strictDeprecations: false, @@ -11,8 +11,9 @@ module.exports = { chunkFileNames: 'nested/chunk.js' }, plugins: { + name: 'test-plugin', resolveId(id, importee) { - if (id.endsWith('.svg')) { + if (id.endsWith('.svg') && importee) { return path.resolve(path.dirname(importee), id); } }, @@ -27,4 +28,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/sanitize-file-name/_config.js b/test/chunking-form/samples/emit-file/sanitize-file-name/_config.js index 39a76de71d6..0ff640af2f8 100644 --- a/test/chunking-form/samples/emit-file/sanitize-file-name/_config.js +++ b/test/chunking-form/samples/emit-file/sanitize-file-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows adding additional chunks and retrieving their file name', options: { input: 'main', @@ -18,4 +18,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/emit-file/set-asset-source/_config.js b/test/chunking-form/samples/emit-file/set-asset-source/_config.js index 067a3de14bb..aef65a793fe 100644 --- a/test/chunking-form/samples/emit-file/set-asset-source/_config.js +++ b/test/chunking-form/samples/emit-file/set-asset-source/_config.js @@ -13,7 +13,7 @@ let renderChunkNamed; let generateBundle; let generateBundleNamed; -module.exports = { +module.exports = defineTest({ description: 'supports setting the asset source during generate', options: { input: ['main.js'], @@ -88,4 +88,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/empty-chunks/_config.js b/test/chunking-form/samples/empty-chunks/_config.js index 4f26f947897..67b27d78bf0 100644 --- a/test/chunking-form/samples/empty-chunks/_config.js +++ b/test/chunking-form/samples/empty-chunks/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'empty chunk pruning', expectedWarnings: ['EMPTY_BUNDLE'], options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/empty-module-no-treeshake/_config.js b/test/chunking-form/samples/empty-module-no-treeshake/_config.js index 6cbadc55400..625e8c94445 100644 --- a/test/chunking-form/samples/empty-module-no-treeshake/_config.js +++ b/test/chunking-form/samples/empty-module-no-treeshake/_config.js @@ -2,11 +2,12 @@ const assert = require('node:assert'); const path = require('node:path'); const { getObject } = require('../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'associates empty modules with chunks if tree-shaking is disabled for them', options: { input: ['main1.js', 'main2.js'], plugins: { + name: 'test-plugin', resolveId(id) { if (id.startsWith('empty')) { if (id === 'emptyResolved') { @@ -64,4 +65,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/entry-aliases/_config.js b/test/chunking-form/samples/entry-aliases/_config.js index b34e645a489..b80512b545f 100644 --- a/test/chunking-form/samples/entry-aliases/_config.js +++ b/test/chunking-form/samples/entry-aliases/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'alias module dependency inlining', options: { input: { @@ -10,4 +10,4 @@ module.exports = { entryFileNames: '[name]' } } -}; +}); diff --git a/test/chunking-form/samples/entry-chunk-export-mode/_config.js b/test/chunking-form/samples/entry-chunk-export-mode/_config.js index e1044841bf5..540e65182cb 100644 --- a/test/chunking-form/samples/entry-chunk-export-mode/_config.js +++ b/test/chunking-form/samples/entry-chunk-export-mode/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'entry chunk export mode checks', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/entry-point-without-own-code/_config.js b/test/chunking-form/samples/entry-point-without-own-code/_config.js index cdd3035cbc1..16454926433 100644 --- a/test/chunking-form/samples/entry-point-without-own-code/_config.js +++ b/test/chunking-form/samples/entry-point-without-own-code/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Handles entry points that contain no own code except imports and exports', options: { input: ['main.js', 'm1.js', 'm2.js'] } -}; +}); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_config.js b/test/chunking-form/samples/entrypoint-aliasing/_config.js index 19a22686336..b75226f6044 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_config.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'entry point facade creation', options: { input: { @@ -6,4 +6,4 @@ module.exports = { main2alias: 'main2.js' } } -}; +}); diff --git a/test/chunking-form/samples/entrypoint-facade/_config.js b/test/chunking-form/samples/entrypoint-facade/_config.js index c044e70e346..0301e6e748a 100644 --- a/test/chunking-form/samples/entrypoint-facade/_config.js +++ b/test/chunking-form/samples/entrypoint-facade/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'entry point facade creation', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/export-default-from-entry/_config.js b/test/chunking-form/samples/export-default-from-entry/_config.js index 1fa07bc2cf0..1e07de5c314 100644 --- a/test/chunking-form/samples/export-default-from-entry/_config.js +++ b/test/chunking-form/samples/export-default-from-entry/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly imports the default from an entry point', options: { input: ['main', 'dep'] } -}; +}); diff --git a/test/chunking-form/samples/external-imports/_config.js b/test/chunking-form/samples/external-imports/_config.js index 1270c73478a..1271444b037 100644 --- a/test/chunking-form/samples/external-imports/_config.js +++ b/test/chunking-form/samples/external-imports/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct interop per chunk when importing from external modules', options: { external: module => module.includes('external'), input: ['main-default.js', 'main-named.js', 'main-namespace'], output: { interop: 'compat' } } -}; +}); diff --git a/test/chunking-form/samples/external-reexports/_config.js b/test/chunking-form/samples/external-reexports/_config.js index c50aa2ac32a..f142ecda3f3 100644 --- a/test/chunking-form/samples/external-reexports/_config.js +++ b/test/chunking-form/samples/external-reexports/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct interop per chunk when reexporting from external modules', options: { external: module => module.includes('external'), input: ['main-default.js', 'main-named.js', 'main-namespace'], output: { interop: 'compat' } } -}; +}); diff --git a/test/chunking-form/samples/filenames-patterns/_config.js b/test/chunking-form/samples/filenames-patterns/_config.js index 80f91291ada..fee15a8638c 100644 --- a/test/chunking-form/samples/filenames-patterns/_config.js +++ b/test/chunking-form/samples/filenames-patterns/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'filenames custom pattern', options: { input: ['main1.js', 'main2.js'], @@ -7,4 +7,4 @@ module.exports = { chunkFileNames: 'chunk-[name]-[hash]-[format].js' } } -}; +}); diff --git a/test/chunking-form/samples/generated-code/arrow-functions-false/_config.js b/test/chunking-form/samples/generated-code/arrow-functions-false/_config.js index dd376d6ae24..a9b14376de9 100644 --- a/test/chunking-form/samples/generated-code/arrow-functions-false/_config.js +++ b/test/chunking-form/samples/generated-code/arrow-functions-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use arrow functions', options: { input: ['main', 'main2'], @@ -6,4 +6,4 @@ module.exports = { generatedCode: { arrowFunctions: false } } } -}; +}); diff --git a/test/chunking-form/samples/generated-code/arrow-functions-true/_config.js b/test/chunking-form/samples/generated-code/arrow-functions-true/_config.js index 3b00bf4c398..c02ebd7077b 100644 --- a/test/chunking-form/samples/generated-code/arrow-functions-true/_config.js +++ b/test/chunking-form/samples/generated-code/arrow-functions-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses arrow functions', options: { input: ['main', 'main2'], @@ -6,4 +6,4 @@ module.exports = { generatedCode: { arrowFunctions: true } } } -}; +}); diff --git a/test/chunking-form/samples/generated-code/reserved-names-as-props-false/_config.js b/test/chunking-form/samples/generated-code/reserved-names-as-props-false/_config.js index 8aa9eb1f2fc..47b2ec162d3 100644 --- a/test/chunking-form/samples/generated-code/reserved-names-as-props-false/_config.js +++ b/test/chunking-form/samples/generated-code/reserved-names-as-props-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { input: ['main', 'main2'], @@ -9,4 +9,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/chunking-form/samples/generated-code/reserved-names-as-props-true/_config.js b/test/chunking-form/samples/generated-code/reserved-names-as-props-true/_config.js index e1427430320..b82804a1274 100644 --- a/test/chunking-form/samples/generated-code/reserved-names-as-props-true/_config.js +++ b/test/chunking-form/samples/generated-code/reserved-names-as-props-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { input: ['main', 'main2'], @@ -9,4 +9,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/chunking-form/samples/hashing/deconflict-hashes/_config.js b/test/chunking-form/samples/hashing/deconflict-hashes/_config.js index f201f896d67..3cd6ea4cd3a 100644 --- a/test/chunking-form/samples/hashing/deconflict-hashes/_config.js +++ b/test/chunking-form/samples/hashing/deconflict-hashes/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'deduplicates hashes for identical files', options: { input: ['main1', 'main2'], output: { entryFileNames: 'entry-[hash].js' } } -}; +}); diff --git a/test/chunking-form/samples/hashing/double-hash/_config.js b/test/chunking-form/samples/hashing/double-hash/_config.js index 065a56632e9..a024fbf94eb 100644 --- a/test/chunking-form/samples/hashing/double-hash/_config.js +++ b/test/chunking-form/samples/hashing/double-hash/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'supports double hashes in patterns', options: { output: { entryFileNames: '[hash]/entry-[hash].js' } } -}; +}); diff --git a/test/chunking-form/samples/hashing/hash-size/_config.js b/test/chunking-form/samples/hashing/hash-size/_config.js index 885a12e5409..ea26f3ad5a2 100644 --- a/test/chunking-form/samples/hashing/hash-size/_config.js +++ b/test/chunking-form/samples/hashing/hash-size/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows configurable hash size', options: { input: ['main1.js', 'main2.js'], @@ -17,4 +17,4 @@ module.exports = { assetFileNames: '[name]-[hash:18][extname]' } } -}; +}); diff --git a/test/chunking-form/samples/hashing/random-match/_config.js b/test/chunking-form/samples/hashing/random-match/_config.js index 939d7935703..e17d7df99e0 100644 --- a/test/chunking-form/samples/hashing/random-match/_config.js +++ b/test/chunking-form/samples/hashing/random-match/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'leaves random hash matches untransformed', options: { output: { entryFileNames: 'entry-[hash]-!~{001}~-!~{123}~.js' } } -}; +}); diff --git a/test/chunking-form/samples/hashing/tree-shaken-dynamic-hash/_config.js b/test/chunking-form/samples/hashing/tree-shaken-dynamic-hash/_config.js index fde4c170eb6..6a90c90a03a 100644 --- a/test/chunking-form/samples/hashing/tree-shaken-dynamic-hash/_config.js +++ b/test/chunking-form/samples/hashing/tree-shaken-dynamic-hash/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not fail when calculating the hash of a file containing a tree-shaken dynamic import', options: { @@ -7,4 +7,4 @@ module.exports = { entryFileNames: '[hash].js' } } -}; +}); diff --git a/test/chunking-form/samples/ignore-chunk-name-query/_config.js b/test/chunking-form/samples/ignore-chunk-name-query/_config.js index 2109243a262..b214ca2f6b8 100644 --- a/test/chunking-form/samples/ignore-chunk-name-query/_config.js +++ b/test/chunking-form/samples/ignore-chunk-name-query/_config.js @@ -1,6 +1,6 @@ const { loader } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'ignores queries and hashes for chunk names when preserving modules', options: { input: ['a.js?query', 'b.js#hash'], @@ -12,4 +12,4 @@ module.exports = { }) ] } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/dependant-entry-no-effects/_config.js b/test/chunking-form/samples/implicit-dependencies/dependant-entry-no-effects/_config.js index ab57ea9f387..556a8139cf9 100644 --- a/test/chunking-form/samples/implicit-dependencies/dependant-entry-no-effects/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/dependant-entry-no-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly emits a chunk when it is implicitly loaded after an empty entry module', expectedWarnings: ['EMPTY_BUNDLE'], options: { @@ -13,4 +13,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js index 820a9b787d0..23c912f9947 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-emitted-entry/_config.js @@ -5,7 +5,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_LIB = path.join(__dirname, 'lib.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'makes sure emitted entry points are never implicit dependencies', options: { preserveEntrySignatures: 'allow-extension', @@ -195,4 +195,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js index 9ab957666c4..012b74b0d7f 100644 --- a/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/implicitly-dependent-entry/_config.js @@ -5,7 +5,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_LIB = path.join(__dirname, 'lib.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'makes sure actual entry points are never implicit dependencies', options: { input: ['main', 'dep'], @@ -191,4 +191,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js index dcb69f6e9d0..0596b22acbc 100644 --- a/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/multiple-dependencies/_config.js @@ -9,7 +9,7 @@ const ID_LIB2 = path.join(__dirname, 'lib2.js'); const ID_LIB3 = path.join(__dirname, 'lib3.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'supports emitting the same chunk with different and multiple dependencies', options: { input: ['main1', 'main2'], @@ -428,4 +428,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/preserve-signature-allow-extension/_config.js b/test/chunking-form/samples/implicit-dependencies/preserve-signature-allow-extension/_config.js index 63dd296f16e..ff9e2797ae9 100644 --- a/test/chunking-form/samples/implicit-dependencies/preserve-signature-allow-extension/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/preserve-signature-allow-extension/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports implicit dependencies when emitting files', options: { plugins: { @@ -13,4 +13,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/preserve-signature-false/_config.js b/test/chunking-form/samples/implicit-dependencies/preserve-signature-false/_config.js index e55905d0227..8e53b933b32 100644 --- a/test/chunking-form/samples/implicit-dependencies/preserve-signature-false/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/preserve-signature-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports implicit dependencies when emitting files', options: { plugins: { @@ -13,4 +13,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/preserve-signature-strict/_config.js b/test/chunking-form/samples/implicit-dependencies/preserve-signature-strict/_config.js index e86db665836..043608e0981 100644 --- a/test/chunking-form/samples/implicit-dependencies/preserve-signature-strict/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/preserve-signature-strict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports implicit dependencies when emitting files', options: { plugins: { @@ -13,4 +13,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/same-chunk-dependency/_config.js b/test/chunking-form/samples/implicit-dependencies/same-chunk-dependency/_config.js index 15c4f59a241..16f322ebcc5 100644 --- a/test/chunking-form/samples/implicit-dependencies/same-chunk-dependency/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/same-chunk-dependency/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'handles implicit dependencies where the dependant is inlined into the same chunk', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { @@ -20,4 +20,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/shared-dependency-no-side-effect/_config.js b/test/chunking-form/samples/implicit-dependencies/shared-dependency-no-side-effect/_config.js index 564795d4540..fc4638d4966 100644 --- a/test/chunking-form/samples/implicit-dependencies/shared-dependency-no-side-effect/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/shared-dependency-no-side-effect/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles shared dependencies between implicit chunks without side-effects', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/shared-dependency-reexport/_config.js b/test/chunking-form/samples/implicit-dependencies/shared-dependency-reexport/_config.js index c3fa81549a0..5d10f4c5a8c 100644 --- a/test/chunking-form/samples/implicit-dependencies/shared-dependency-reexport/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/shared-dependency-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles shared dependencies when there are only reexports', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js index eb28587ec04..ef874d950c3 100644 --- a/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js +++ b/test/chunking-form/samples/implicit-dependencies/single-dependency/_config.js @@ -5,7 +5,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_LIB = path.join(__dirname, 'lib.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'supports implicit dependencies when emitting files', options: { preserveEntrySignatures: 'allow-extension', @@ -194,4 +194,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_config.js b/test/chunking-form/samples/import-meta-numeric-paths/_config.js index 045146cd4bb..9d622265857 100644 --- a/test/chunking-form/samples/import-meta-numeric-paths/_config.js +++ b/test/chunking-form/samples/import-meta-numeric-paths/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports nested numeric paths without issues on Windows', options: { output: { preserveModules: true }, @@ -13,4 +13,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/import-meta-url/_config.js b/test/chunking-form/samples/import-meta-url/_config.js index e6560873bb7..827ffc9580f 100644 --- a/test/chunking-form/samples/import-meta-url/_config.js +++ b/test/chunking-form/samples/import-meta-url/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports import.meta.url', options: { preserveEntrySignatures: false, @@ -6,4 +6,4 @@ module.exports = { chunkFileNames: 'nested/chunk.js' } } -}; +}); diff --git a/test/chunking-form/samples/import-variable-duplicates/_config.js b/test/chunking-form/samples/import-variable-duplicates/_config.js index 950b01a7535..2d85bf61f09 100644 --- a/test/chunking-form/samples/import-variable-duplicates/_config.js +++ b/test/chunking-form/samples/import-variable-duplicates/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk duplicate import deshadowing', options: { input: ['main1.js', 'main2.js', 'first.js', 'head.js'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/chained-dynamic-with-shared/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/chained-dynamic-with-shared/_config.js index ba9c4c3c981..0a19b3b0fd4 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/chained-dynamic-with-shared/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/chained-dynamic-with-shared/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'chained dynamic import that imports something already loaded' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/circular-dynamic-imports/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/circular-dynamic-imports/_config.js index 86aea7fe346..c0b010a8a2c 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/circular-dynamic-imports/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/circular-dynamic-imports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles circular dynamic imports' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/cut-off/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/cut-off/_config.js index c576b1c3250..5893fd7a651 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/cut-off/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/cut-off/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'does not avoid separate chunks if too many modules dynamically import the same chunk', options: { input: ['main1', 'main2', 'main3', 'main4'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-1/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-1/_config.js index f475a15a739..32d32893c38 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-1/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-1/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'inlines dynamic imports that are already statically imported' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-2/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-2/_config.js index 8fb4c32176c..af17537fdee 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-2/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-already-contained-2/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'inlines dynamic imports that are already statically imported by their importers' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic-multi-stage/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic-multi-stage/_config.js index d8b7a769273..7e113af09c4 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic-multi-stage/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic-multi-stage/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles if a dynamically imported module imports another module dynamically' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic/_config.js index d8b7a769273..7e113af09c4 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-import-dynamic/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles if a dynamically imported module imports another module dynamically' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-not-in-memory/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-not-in-memory/_config.js index 8d679763598..92b07dee16d 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/dynamic-not-in-memory/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/dynamic-not-in-memory/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps chunks separate when not in memory for all dynamic imports', options: { input: ['main1', 'main2', 'main3'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-and-shared-dependencies/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-and-shared-dependencies/_config.js index fd9e687a29a..8493c52ad2f 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-and-shared-dependencies/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-and-shared-dependencies/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids chunks for always loaded dependencies if multiple entry points with different dependencies have dynamic imports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-dependencies/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-dependencies/_config.js index fd9e687a29a..8493c52ad2f 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-dependencies/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-different-dependencies/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids chunks for always loaded dependencies if multiple entry points with different dependencies have dynamic imports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-partly-already-loaded-dynamic/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-partly-already-loaded-dynamic/_config.js index fd9e687a29a..8493c52ad2f 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-partly-already-loaded-dynamic/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-partly-already-loaded-dynamic/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids chunks for always loaded dependencies if multiple entry points with different dependencies have dynamic imports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-shared-static-with-dynamic-import/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-shared-static-with-dynamic-import/_config.js index fd9e687a29a..8493c52ad2f 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-shared-static-with-dynamic-import/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/multi-entry-shared-static-with-dynamic-import/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids chunks for always loaded dependencies if multiple entry points with different dependencies have dynamic imports', options: { input: ['main1', 'main2'] } -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic-multiple-imports/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic-multiple-imports/_config.js index 03f32f46185..9f42c784a4b 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic-multiple-imports/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic-multiple-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not create a separate chunk if a dynamically imported chunk shares a dependency with its importer, and dynamic chunk imported from multiple places' -}; +}); diff --git a/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic/_config.js b/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic/_config.js index 4ca923a9bb0..ceca06a61a8 100644 --- a/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic/_config.js +++ b/test/chunking-form/samples/improved-dynamic-chunks/single-dynamic/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not create a separate chunk if a dynamically imported chunk shares a dependency with its importer' -}; +}); diff --git a/test/chunking-form/samples/indirect-reexports-preserve-modules/_config.js b/test/chunking-form/samples/indirect-reexports-preserve-modules/_config.js index e2616fe4ab7..63434c3b164 100644 --- a/test/chunking-form/samples/indirect-reexports-preserve-modules/_config.js +++ b/test/chunking-form/samples/indirect-reexports-preserve-modules/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'does not drop indirect reexports when preserving modules', expectedWarnings: ['MIXED_EXPORTS'], options: { output: { name: 'bundle', preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/interop-per-reexported-default-dependency/_config.js b/test/chunking-form/samples/interop-per-reexported-default-dependency/_config.js index 128dc1e4400..a780bdd05c2 100644 --- a/test/chunking-form/samples/interop-per-reexported-default-dependency/_config.js +++ b/test/chunking-form/samples/interop-per-reexported-default-dependency/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure the interop type per reexported default from an external dependency', options: { @@ -10,4 +10,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-avoid-facade/_config.js b/test/chunking-form/samples/manual-chunk-avoid-facade/_config.js index b3f1783fee8..7a1847a0e8a 100644 --- a/test/chunking-form/samples/manual-chunk-avoid-facade/_config.js +++ b/test/chunking-form/samples/manual-chunk-avoid-facade/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoid facades if possible when using manual chunks', options: { input: ['main1', 'main2'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-contains-entry-conflict/_config.js b/test/chunking-form/samples/manual-chunk-contains-entry-conflict/_config.js index a37dc57a3b7..2c522de8b4a 100644 --- a/test/chunking-form/samples/manual-chunk-contains-entry-conflict/_config.js +++ b/test/chunking-form/samples/manual-chunk-contains-entry-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ expectedWarnings: ['EMPTY_BUNDLE'], description: 'Uses entry alias if manual chunks contain entry chunks with different alias', options: { @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-contains-entry-match/_config.js b/test/chunking-form/samples/manual-chunk-contains-entry-match/_config.js index 886f2483469..c4ddc6655d4 100644 --- a/test/chunking-form/samples/manual-chunk-contains-entry-match/_config.js +++ b/test/chunking-form/samples/manual-chunk-contains-entry-match/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Identifies the entry chunk with the manual chunk that contains it if the aliases match', options: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-is-entry-conflict/_config.js b/test/chunking-form/samples/manual-chunk-is-entry-conflict/_config.js index ff3ff114277..375bfd9fdde 100644 --- a/test/chunking-form/samples/manual-chunk-is-entry-conflict/_config.js +++ b/test/chunking-form/samples/manual-chunk-is-entry-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses entry alias if manual chunks are entry chunks with different alias', options: { input: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-is-entry-match/_config.js b/test/chunking-form/samples/manual-chunk-is-entry-match/_config.js index e48ab6e5c57..6851f393376 100644 --- a/test/chunking-form/samples/manual-chunk-is-entry-match/_config.js +++ b/test/chunking-form/samples/manual-chunk-is-entry-match/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Identifies the entry chunk with the manual chunk that has the same entry if the aliases match', options: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunk-not-included/_config.js b/test/chunking-form/samples/manual-chunk-not-included/_config.js index 4ad3e9f1e3a..38b02eb3641 100644 --- a/test/chunking-form/samples/manual-chunk-not-included/_config.js +++ b/test/chunking-form/samples/manual-chunk-not-included/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles manual chunks where the root is not part of the module graph', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-different-nested/_config.js b/test/chunking-form/samples/manual-chunks-different-nested/_config.js index b3cb648c6ce..4a9ba21f564 100644 --- a/test/chunking-form/samples/manual-chunks-different-nested/_config.js +++ b/test/chunking-form/samples/manual-chunks-different-nested/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks can have other manual chunks as dependencies', options: { input: ['main.js'], @@ -10,4 +10,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-dynamic-facades/_config.js b/test/chunking-form/samples/manual-chunks-dynamic-facades/_config.js index 4b561f0ff92..91bf1733452 100644 --- a/test/chunking-form/samples/manual-chunks-dynamic-facades/_config.js +++ b/test/chunking-form/samples/manual-chunks-dynamic-facades/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates facades for dynamic manual chunks if necessary', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-dynamic-name-conflict/_config.js b/test/chunking-form/samples/manual-chunks-dynamic-name-conflict/_config.js index 05c5ee743cf..e970a1f3446 100644 --- a/test/chunking-form/samples/manual-chunks-dynamic-name-conflict/_config.js +++ b/test/chunking-form/samples/manual-chunks-dynamic-name-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles name conflicts in manual chunks', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-dynamic/_config.js b/test/chunking-form/samples/manual-chunks-dynamic/_config.js index e41c6eed7a7..97dba71179e 100644 --- a/test/chunking-form/samples/manual-chunks-dynamic/_config.js +++ b/test/chunking-form/samples/manual-chunks-dynamic/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports dynamic manual chunks', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-function/_config.js b/test/chunking-form/samples/manual-chunks-function/_config.js index 13245c87f9d..cb91ed2b095 100644 --- a/test/chunking-form/samples/manual-chunks-function/_config.js +++ b/test/chunking-form/samples/manual-chunks-function/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows to define manual chunks via a function', options: { input: ['main-a'], @@ -25,4 +25,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks-nested/_config.js b/test/chunking-form/samples/manual-chunks-nested/_config.js index 8214e629eaf..f39bf727dfb 100644 --- a/test/chunking-form/samples/manual-chunks-nested/_config.js +++ b/test/chunking-form/samples/manual-chunks-nested/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks can contain nested modules', options: { input: ['main.js'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/manual-chunks/_config.js b/test/chunking-form/samples/manual-chunks/_config.js index 2589e95d79a..2b424e1b73e 100644 --- a/test/chunking-form/samples/manual-chunks/_config.js +++ b/test/chunking-form/samples/manual-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'manual chunks support', options: { input: ['main.js'], @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/max-parallel-file-operations/_config.js b/test/chunking-form/samples/max-parallel-file-operations/_config.js index b68b3518720..9346d8eae40 100644 --- a/test/chunking-form/samples/max-parallel-file-operations/_config.js +++ b/test/chunking-form/samples/max-parallel-file-operations/_config.js @@ -6,7 +6,7 @@ const fsWriteFile = fs.writeFile; let currentWrites = 0; let maxWrites = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps limits write operations', options: { maxParallelFileOps: 3, @@ -25,4 +25,4 @@ module.exports = { fs.writeFile = fsWriteFile; assert.strictEqual(maxWrites, 3, 'Wrong number of parallel file writes: ' + maxWrites); } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/avoid-circular-dependencies/_config.js b/test/chunking-form/samples/min-chunk-size/avoid-circular-dependencies/_config.js index e3d1f21b0ae..801623fc162 100644 --- a/test/chunking-form/samples/min-chunk-size/avoid-circular-dependencies/_config.js +++ b/test/chunking-form/samples/min-chunk-size/avoid-circular-dependencies/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids circular dependencies when merging chunks', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/avoid-transitive-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/avoid-transitive-side-effects/_config.js index a919035dba8..51c86dd250e 100644 --- a/test/chunking-form/samples/min-chunk-size/avoid-transitive-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/avoid-transitive-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not merge chunks if a dependency would introduce a new side effect', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/best-merge-target/_config.js b/test/chunking-form/samples/min-chunk-size/best-merge-target/_config.js index ca1b905a639..d18589d13f0 100644 --- a/test/chunking-form/samples/min-chunk-size/best-merge-target/_config.js +++ b/test/chunking-form/samples/min-chunk-size/best-merge-target/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses the merge target that is closest', options: { input: [ @@ -16,4 +16,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/ignore-correlated-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/ignore-correlated-side-effects/_config.js index 2d21d596898..760704c72af 100644 --- a/test/chunking-form/samples/min-chunk-size/ignore-correlated-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/ignore-correlated-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'ignores correlated side effects if they cannot be merged', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js', 'main5.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-chunk-into-distant-shared/_config.js b/test/chunking-form/samples/min-chunk-size/merge-chunk-into-distant-shared/_config.js index 1b184ed33a0..f9f8b583282 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-chunk-into-distant-shared/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-chunk-into-distant-shared/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges small chunks into shared chunks that are loaded by a non-close super-set of entry points', options: { @@ -7,4 +7,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-chunk-into-shared/_config.js b/test/chunking-form/samples/min-chunk-size/merge-chunk-into-shared/_config.js index a6b8f26fbba..605f5faf55b 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-chunk-into-shared/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-chunk-into-shared/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges small chunks into shared chunks that are loaded by a super-set of entry points', options: { @@ -7,4 +7,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-correlated-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/merge-correlated-side-effects/_config.js index 24e9b6f1fe8..a53c27cb97f 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-correlated-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-correlated-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges correlated side effects with pure chunks', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-dependency-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/merge-dependency-side-effects/_config.js index 5a53def33c2..bd8600b4a71 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-dependency-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-dependency-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges chunks if their dependency side effects are the same', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-despite-correlated-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/merge-despite-correlated-side-effects/_config.js index 6afd5febb9c..858c318d993 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-despite-correlated-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-despite-correlated-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: "merges chunks if their dependency side effects are a subset of the other's correlated side effects", options: { @@ -7,4 +7,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-dynamic-imports/_config.js b/test/chunking-form/samples/min-chunk-size/merge-dynamic-imports/_config.js index 316a0906846..ea2256365f4 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-dynamic-imports/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-dynamic-imports/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'merges small chunks with side effects into suitable pure chunks', options: { output: { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-small-side-effect-chunks/_config.js b/test/chunking-form/samples/min-chunk-size/merge-small-side-effect-chunks/_config.js index 3ae974729b7..7e23f3230e0 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-small-side-effect-chunks/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-small-side-effect-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges small chunks with side effects into suitable pure chunks', options: { input: ['main1.js', 'main2.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/merge-unrelated/_config.js b/test/chunking-form/samples/min-chunk-size/merge-unrelated/_config.js index 7bc0924b1a2..5fabd4dea86 100644 --- a/test/chunking-form/samples/min-chunk-size/merge-unrelated/_config.js +++ b/test/chunking-form/samples/min-chunk-size/merge-unrelated/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges unrelated small chunks if there is no better alternative', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/no-merge-for-big-chunks/_config.js b/test/chunking-form/samples/min-chunk-size/no-merge-for-big-chunks/_config.js index a72a748e3e5..0a5af5cbeb6 100644 --- a/test/chunking-form/samples/min-chunk-size/no-merge-for-big-chunks/_config.js +++ b/test/chunking-form/samples/min-chunk-size/no-merge-for-big-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not merge chunks if all chunks are below the size limit', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 1 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/no-merge-side-effects/_config.js b/test/chunking-form/samples/min-chunk-size/no-merge-side-effects/_config.js index 5146a813748..f45f896c20c 100644 --- a/test/chunking-form/samples/min-chunk-size/no-merge-side-effects/_config.js +++ b/test/chunking-form/samples/min-chunk-size/no-merge-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not merge small chunks that have side effects', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-a/_config.js b/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-a/_config.js index 80ff49b83e7..18809bd51c7 100644 --- a/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-a/_config.js +++ b/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-a/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'when there are two valid merge targets, the one that is loaded under more similar conditions is preferred', options: { @@ -7,4 +7,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-b/_config.js b/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-b/_config.js index 80ff49b83e7..18809bd51c7 100644 --- a/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-b/_config.js +++ b/test/chunking-form/samples/min-chunk-size/prefer-close-merge-target-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'when there are two valid merge targets, the one that is loaded under more similar conditions is preferred', options: { @@ -7,4 +7,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-a/_config.js b/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-a/_config.js index 065171aa5fd..77cd812c0c9 100644 --- a/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-a/_config.js +++ b/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-a/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'when there are two equally valid merge targets, the smaller is preferred', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-b/_config.js b/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-b/_config.js index 065171aa5fd..77cd812c0c9 100644 --- a/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-b/_config.js +++ b/test/chunking-form/samples/min-chunk-size/prefer-small-merge-target-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'when there are two equally valid merge targets, the smaller is preferred', options: { input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], @@ -6,4 +6,4 @@ module.exports = { experimentalMinChunkSize: 100 } } -}; +}); diff --git a/test/chunking-form/samples/minify-internal-exports/_config.js b/test/chunking-form/samples/minify-internal-exports/_config.js index e550586d56d..aff56c6f69d 100644 --- a/test/chunking-form/samples/minify-internal-exports/_config.js +++ b/test/chunking-form/samples/minify-internal-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to force the minification of internal exports', options: { input: ['main1.js', 'main2.js'], @@ -6,4 +6,4 @@ module.exports = { minifyInternalExports: true } } -}; +}); diff --git a/test/chunking-form/samples/missing-export-compact/_config.js b/test/chunking-form/samples/missing-export-compact/_config.js index 236f582eb45..f7b35f0f4e4 100644 --- a/test/chunking-form/samples/missing-export-compact/_config.js +++ b/test/chunking-form/samples/missing-export-compact/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'missing export compact', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -8,4 +8,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/chunking-form/samples/missing-export-reused-deconflicting/_config.js b/test/chunking-form/samples/missing-export-reused-deconflicting/_config.js index fa8ef996a91..1f82231f9ca 100644 --- a/test/chunking-form/samples/missing-export-reused-deconflicting/_config.js +++ b/test/chunking-form/samples/missing-export-reused-deconflicting/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles using dependencies with shimmed missing exports as ', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -6,4 +6,4 @@ module.exports = { shimMissingExports: true, output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/missing-export/_config.js b/test/chunking-form/samples/missing-export/_config.js index bd55b234392..3681e1060c0 100644 --- a/test/chunking-form/samples/missing-export/_config.js +++ b/test/chunking-form/samples/missing-export/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'missing export', expectedWarnings: ['SHIMMED_EXPORT', 'MIXED_EXPORTS'], options: { input: ['main.js', 'dep.js'], shimMissingExports: true } -}; +}); diff --git a/test/chunking-form/samples/multi-chunking/_config.js b/test/chunking-form/samples/multi-chunking/_config.js index 7e89c5b03b0..3ad13c73f33 100644 --- a/test/chunking-form/samples/multi-chunking/_config.js +++ b/test/chunking-form/samples/multi-chunking/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'simple chunking', options: { input: ['main1.js', 'main2.js', 'main3.js'] } -}; +}); diff --git a/test/chunking-form/samples/multiple-entry-points/_config.js b/test/chunking-form/samples/multiple-entry-points/_config.js index e8f588be523..4ca7d1a2563 100644 --- a/test/chunking-form/samples/multiple-entry-points/_config.js +++ b/test/chunking-form/samples/multiple-entry-points/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles multiple entry points with a shared dependency', options: { input: ['main', 'other'], @@ -7,4 +7,4 @@ module.exports = { } }, runAmd: true -}; +}); diff --git a/test/chunking-form/samples/namespace-imports-from-chunks/_config.js b/test/chunking-form/samples/namespace-imports-from-chunks/_config.js index b5ff817c4b6..88847634fb8 100644 --- a/test/chunking-form/samples/namespace-imports-from-chunks/_config.js +++ b/test/chunking-form/samples/namespace-imports-from-chunks/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handle namespace imports from chunks', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/namespace-object-import/_config.js b/test/chunking-form/samples/namespace-object-import/_config.js index c746cbbbf8a..a1e72cbf8ec 100644 --- a/test/chunking-form/samples/namespace-object-import/_config.js +++ b/test/chunking-form/samples/namespace-object-import/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'namespace object import', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/samples/namespace-reexport-name-conflict/_config.js b/test/chunking-form/samples/namespace-reexport-name-conflict/_config.js index 538fbb40363..20533781645 100644 --- a/test/chunking-form/samples/namespace-reexport-name-conflict/_config.js +++ b/test/chunking-form/samples/namespace-reexport-name-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'renders namespaces with reexports that conflict with existing imports', options: { input: ['main1.js', 'main2.js', 'main3.js'], @@ -7,4 +7,4 @@ module.exports = { exports: 'named' } } -}; +}); diff --git a/test/chunking-form/samples/namespace-reexports/_config.js b/test/chunking-form/samples/namespace-reexports/_config.js index 16b17829701..aee9dcd1d1a 100644 --- a/test/chunking-form/samples/namespace-reexports/_config.js +++ b/test/chunking-form/samples/namespace-reexports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'namespace rendering with reexports', options: { input: ['main.js', 'hsl2hsv.js', 'index.js'], @@ -6,4 +6,4 @@ module.exports = { exports: 'named' } } -}; +}); diff --git a/test/chunking-form/samples/namespace-retracing/_config.js b/test/chunking-form/samples/namespace-retracing/_config.js index 6169fb37668..81c0950bea2 100644 --- a/test/chunking-form/samples/namespace-retracing/_config.js +++ b/test/chunking-form/samples/namespace-retracing/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'internal reexported namespaces over chunk boundaries', options: { input: ['main-a.js', 'main-b.js'] } -}; +}); diff --git a/test/chunking-form/samples/namespace-tostring/dynamic-import-default-mode/_config.js b/test/chunking-form/samples/namespace-tostring/dynamic-import-default-mode/_config.js index cce31ed90cf..d396528a6e9 100644 --- a/test/chunking-form/samples/namespace-tostring/dynamic-import-default-mode/_config.js +++ b/test/chunking-form/samples/namespace-tostring/dynamic-import-default-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports of entry chunks with default export mode', options: { @@ -7,4 +7,4 @@ module.exports = { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/chunking-form/samples/namespace-tostring/dynamic-import/_config.js b/test/chunking-form/samples/namespace-tostring/dynamic-import/_config.js index 1e26346fe3b..fd0d299f4a6 100644 --- a/test/chunking-form/samples/namespace-tostring/dynamic-import/_config.js +++ b/test/chunking-form/samples/namespace-tostring/dynamic-import/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports', options: { output: { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/chunking-form/samples/namespace-tracing/_config.js b/test/chunking-form/samples/namespace-tracing/_config.js index 230f2306e52..2e3781c5ad2 100644 --- a/test/chunking-form/samples/namespace-tracing/_config.js +++ b/test/chunking-form/samples/namespace-tracing/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Something', options: { input: ['main-a.js', 'main-b.js', 'main-c.js'] } -}; +}); diff --git a/test/chunking-form/samples/nested-chunks/_config.js b/test/chunking-form/samples/nested-chunks/_config.js index c9c0bdd593b..9d312e61ab8 100644 --- a/test/chunking-form/samples/nested-chunks/_config.js +++ b/test/chunking-form/samples/nested-chunks/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'nested chunks', options: { input: { main1: 'main1', 'nested/main2': 'main2' }, external: './external.js' } -}; +}); diff --git a/test/chunking-form/samples/nested-dynamic-imports/_config.js b/test/chunking-form/samples/nested-dynamic-imports/_config.js index f96b6c536d2..26be48ddbea 100644 --- a/test/chunking-form/samples/nested-dynamic-imports/_config.js +++ b/test/chunking-form/samples/nested-dynamic-imports/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports containing dynamic imports', options: { input: 'main' } -}; +}); diff --git a/test/chunking-form/samples/no-minify-internal-exports/_config.js b/test/chunking-form/samples/no-minify-internal-exports/_config.js index c6a38b51532..a6d329040ea 100644 --- a/test/chunking-form/samples/no-minify-internal-exports/_config.js +++ b/test/chunking-form/samples/no-minify-internal-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to disable the minification of internal exports', options: { input: ['main1.js', 'main2.js'], @@ -6,4 +6,4 @@ module.exports = { minifyInternalExports: false } } -}; +}); diff --git a/test/chunking-form/samples/no-treeshake-imports/_config.js b/test/chunking-form/samples/no-treeshake-imports/_config.js index 091a658f468..260389b9f7e 100644 --- a/test/chunking-form/samples/no-treeshake-imports/_config.js +++ b/test/chunking-form/samples/no-treeshake-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes all imports when setting moduleSideEffects to "no-treeshake"', options: { input: ['main1', 'main2'], @@ -10,4 +10,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/allow-extension/_config.js b/test/chunking-form/samples/preserve-entry-signatures/allow-extension/_config.js index ea3e5f737cf..d62c434a28f 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/allow-extension/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/allow-extension/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Never creates facades for allow-extension', options: { preserveEntrySignatures: 'allow-extension' } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/_config.js b/test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/_config.js index 6fb75a89816..94a26a987c1 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/exports-only-no-exports/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not create a facade for exports-only if there are no exports', options: { preserveEntrySignatures: 'exports-only' } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/exports-only/_config.js b/test/chunking-form/samples/preserve-entry-signatures/exports-only/_config.js index e00716aa766..60bfa49a3a7 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/exports-only/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/exports-only/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Creates a facade if necessary for exports-only if there are exports', options: { preserveEntrySignatures: 'exports-only' } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/false/_config.js b/test/chunking-form/samples/preserve-entry-signatures/false/_config.js index 601608a5d93..f38aeae9f00 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/false/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/false/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not include entry exports and does not preserve the signature', options: { preserveEntrySignatures: false } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/override-via-plugin/_config.js b/test/chunking-form/samples/preserve-entry-signatures/override-via-plugin/_config.js index d4888307bcf..3614e1b10d5 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/override-via-plugin/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/override-via-plugin/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Allows overriding behaviour for emitted chunks', options: { input: [], @@ -32,4 +32,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/preserve-entry-signatures/strict/_config.js b/test/chunking-form/samples/preserve-entry-signatures/strict/_config.js index 858e5fd4d3e..ce374249b17 100644 --- a/test/chunking-form/samples/preserve-entry-signatures/strict/_config.js +++ b/test/chunking-form/samples/preserve-entry-signatures/strict/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Creates a facade if necessary for strict entry signatures', options: { preserveEntrySignatures: 'strict' } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-auto-export-mode/_config.js b/test/chunking-form/samples/preserve-modules-auto-export-mode/_config.js index 7afad981a92..fd549715124 100644 --- a/test/chunking-form/samples/preserve-modules-auto-export-mode/_config.js +++ b/test/chunking-form/samples/preserve-modules-auto-export-mode/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses entry point semantics for all files when preserving modules', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-commonjs/_config.js b/test/chunking-form/samples/preserve-modules-commonjs/_config.js index c748f85794d..9b98044a176 100644 --- a/test/chunking-form/samples/preserve-modules-commonjs/_config.js +++ b/test/chunking-form/samples/preserve-modules-commonjs/_config.js @@ -1,6 +1,6 @@ const commonjs = require('@rollup/plugin-commonjs'); -module.exports = { +module.exports = defineTest({ description: 'Handles output from @rollup/plugin-commonjs', expectedWarnings: ['MIXED_EXPORTS'], options: { @@ -9,4 +9,4 @@ module.exports = { plugins: [commonjs()], output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-default-mode-namespace/_config.js b/test/chunking-form/samples/preserve-modules-default-mode-namespace/_config.js index 12e5ced8b34..3cdaf10c851 100644 --- a/test/chunking-form/samples/preserve-modules-default-mode-namespace/_config.js +++ b/test/chunking-form/samples/preserve-modules-default-mode-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'import namespace from chunks with default export mode when preserving modules', options: { input: ['main', 'lib'], @@ -6,4 +6,4 @@ module.exports = { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-default-mode-namespace2/_config.js b/test/chunking-form/samples/preserve-modules-default-mode-namespace2/_config.js index 12e5ced8b34..3cdaf10c851 100644 --- a/test/chunking-form/samples/preserve-modules-default-mode-namespace2/_config.js +++ b/test/chunking-form/samples/preserve-modules-default-mode-namespace2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'import namespace from chunks with default export mode when preserving modules', options: { input: ['main', 'lib'], @@ -6,4 +6,4 @@ module.exports = { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-dynamic-imports/_config.js b/test/chunking-form/samples/preserve-modules-dynamic-imports/_config.js index cd38717b589..5046f3f8aec 100644 --- a/test/chunking-form/samples/preserve-modules-dynamic-imports/_config.js +++ b/test/chunking-form/samples/preserve-modules-dynamic-imports/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'dynamic imports are handled correctly when preserving modules', options: { input: ['main.js'], output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-dynamic-namespace/_config.js b/test/chunking-form/samples/preserve-modules-dynamic-namespace/_config.js index 10c317cd8fc..a1eb968e676 100644 --- a/test/chunking-form/samples/preserve-modules-dynamic-namespace/_config.js +++ b/test/chunking-form/samples/preserve-modules-dynamic-namespace/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules properly handles internal namespace imports (#2576)', options: { input: ['main.js'], output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-empty/_config.js b/test/chunking-form/samples/preserve-modules-empty/_config.js index 7b9d517b336..1e169c004f9 100644 --- a/test/chunking-form/samples/preserve-modules-empty/_config.js +++ b/test/chunking-form/samples/preserve-modules-empty/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules remove empty dependencies', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-export-alias/_config.js b/test/chunking-form/samples/preserve-modules-export-alias/_config.js index 9c422ba3d6d..e85d07a9b9e 100644 --- a/test/chunking-form/samples/preserve-modules-export-alias/_config.js +++ b/test/chunking-form/samples/preserve-modules-export-alias/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm export aliases are preserved in modules', options: { input: ['main1.js', 'main2.js'], output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js index 9b4472713fb..798beadfb1f 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js @@ -14,7 +14,7 @@ const expectedNames = new Set([ 'no-ext' ]); -module.exports = { +module.exports = defineTest({ description: 'entryFileNames pattern supported in combination with preserveModules', options: { input: 'src/main.js', @@ -41,4 +41,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-id-case-sensitive/_config.js b/test/chunking-form/samples/preserve-modules-id-case-sensitive/_config.js index 7650f6f19b0..ccdcb862f4b 100644 --- a/test/chunking-form/samples/preserve-modules-id-case-sensitive/_config.js +++ b/test/chunking-form/samples/preserve-modules-id-case-sensitive/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserve modules id case sensitive', options: { input: 'main.js', @@ -18,4 +18,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-named-export-mode/_config.js b/test/chunking-form/samples/preserve-modules-named-export-mode/_config.js index 0ad8d5aad54..f122cde6746 100644 --- a/test/chunking-form/samples/preserve-modules-named-export-mode/_config.js +++ b/test/chunking-form/samples/preserve-modules-named-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'respects "named" export mode in all chunks when preserving modules', options: { input: 'main.js', @@ -7,4 +7,4 @@ module.exports = { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-namespace-reexport-reexport/_config.js b/test/chunking-form/samples/preserve-modules-namespace-reexport-reexport/_config.js index 7772cc95c37..5500db098f9 100644 --- a/test/chunking-form/samples/preserve-modules-namespace-reexport-reexport/_config.js +++ b/test/chunking-form/samples/preserve-modules-namespace-reexport-reexport/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'handles doing a namespace reexport of a reexport', options: { output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-nested-barrel-es-export/_config.js b/test/chunking-form/samples/preserve-modules-nested-barrel-es-export/_config.js index 209f77d87a8..35fa916f7ea 100644 --- a/test/chunking-form/samples/preserve-modules-nested-barrel-es-export/_config.js +++ b/test/chunking-form/samples/preserve-modules-nested-barrel-es-export/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm exports are deconflicted when exporting nested index aliases', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-nested-export/_config.js b/test/chunking-form/samples/preserve-modules-nested-export/_config.js index f2cdd1cc149..adec95d353a 100644 --- a/test/chunking-form/samples/preserve-modules-nested-export/_config.js +++ b/test/chunking-form/samples/preserve-modules-nested-export/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'confirm exports are preserved when exporting a module', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-non-entry-imports/_config.js b/test/chunking-form/samples/preserve-modules-non-entry-imports/_config.js index 732fa455ebe..d1e1a6df084 100644 --- a/test/chunking-form/samples/preserve-modules-non-entry-imports/_config.js +++ b/test/chunking-form/samples/preserve-modules-non-entry-imports/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'imports and exports of non-entry points are tracked', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-proxy-import/_config.js b/test/chunking-form/samples/preserve-modules-proxy-import/_config.js index 23a87ffcbec..b4a3b14ba8b 100644 --- a/test/chunking-form/samples/preserve-modules-proxy-import/_config.js +++ b/test/chunking-form/samples/preserve-modules-proxy-import/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves imports via a proxy module as direct imports when preserving modules', options: { external: 'external', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-reaching-outside/_config.js b/test/chunking-form/samples/preserve-modules-reaching-outside/_config.js index 61fa9b612c1..0eeb2359c12 100644 --- a/test/chunking-form/samples/preserve-modules-reaching-outside/_config.js +++ b/test/chunking-form/samples/preserve-modules-reaching-outside/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'change the module destination', options: { input: 'src/lib/main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-root/_config.js b/test/chunking-form/samples/preserve-modules-root/_config.js index 5518c9c5483..f9390f4e298 100644 --- a/test/chunking-form/samples/preserve-modules-root/_config.js +++ b/test/chunking-form/samples/preserve-modules-root/_config.js @@ -1,7 +1,7 @@ const commonjs = require('@rollup/plugin-commonjs'); const resolve = require('@rollup/plugin-node-resolve').default; -module.exports = { +module.exports = defineTest({ description: 'confirm preserveModulesRoot restructures src appropriately', expectedWarnings: ['MIXED_EXPORTS'], options: { @@ -25,4 +25,4 @@ module.exports = { preserveModulesRoot: 'src' } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-scriptified-assets/_config.js b/test/chunking-form/samples/preserve-modules-scriptified-assets/_config.js index 43f0815cba3..3ab8101f7a5 100644 --- a/test/chunking-form/samples/preserve-modules-scriptified-assets/_config.js +++ b/test/chunking-form/samples/preserve-modules-scriptified-assets/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'scriptified assets have extension in preserveModules output filename', options: { input: 'src/main.js', @@ -27,4 +27,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-single-entry/_config.js b/test/chunking-form/samples/preserve-modules-single-entry/_config.js index 05ac0170147..f9d48d1e891 100644 --- a/test/chunking-form/samples/preserve-modules-single-entry/_config.js +++ b/test/chunking-form/samples/preserve-modules-single-entry/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'single entry names file correctly', options: { input: 'main.js', output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js index 3d08854fc4a..8c139e437c0 100644 --- a/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'Supports chunk names from config when preserving modules', options: { input: { 'main-entry': 'main.js' }, @@ -15,4 +15,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js index 304bdc11300..5c22c2167db 100644 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Generates actual files whose filename adheres to entryFileNames for virtual modules when preserving modules', options: { @@ -31,4 +31,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules/_config.js b/test/chunking-form/samples/preserve-modules-virtual-modules/_config.js index bd10fa0ad02..59601cf9557 100644 --- a/test/chunking-form/samples/preserve-modules-virtual-modules/_config.js +++ b/test/chunking-form/samples/preserve-modules-virtual-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { input: 'main.js', @@ -19,4 +19,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/preserve-modules/_config.js b/test/chunking-form/samples/preserve-modules/_config.js index 54d9611466a..6f3d052f35a 100644 --- a/test/chunking-form/samples/preserve-modules/_config.js +++ b/test/chunking-form/samples/preserve-modules/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Rewrite modules in-place', options: { input: ['main1.js', 'main2.js'], output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/reexport-from-entry/_config.js b/test/chunking-form/samples/reexport-from-entry/_config.js index ad0d2c5dfd1..9973acbb734 100644 --- a/test/chunking-form/samples/reexport-from-entry/_config.js +++ b/test/chunking-form/samples/reexport-from-entry/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allows reexporting from other entry points', options: { input: ['main', 'otherEntry'] } -}; +}); diff --git a/test/chunking-form/samples/reexport-shortpaths/_config.js b/test/chunking-form/samples/reexport-shortpaths/_config.js index 965cd2a2c6b..0be61507777 100644 --- a/test/chunking-form/samples/reexport-shortpaths/_config.js +++ b/test/chunking-form/samples/reexport-shortpaths/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Tracing reexport shortpaths to entry points', options: { input: ['main1.js', 'main2.js', 'main3.js'] } -}; +}); diff --git a/test/chunking-form/samples/render-chunk-transform/_config.js b/test/chunking-form/samples/render-chunk-transform/_config.js index b623fa23427..69abcb18320 100644 --- a/test/chunking-form/samples/render-chunk-transform/_config.js +++ b/test/chunking-form/samples/render-chunk-transform/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { replaceDirectoryInStringifiedObject } = require('../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'replaces hashes when mutating chunk info in renderChunk', options: { input: ['main1', 'main2'], @@ -73,4 +73,4 @@ module.exports = { chunkFileNames: 'chunk-[name]-[hash].js' } } -}; +}); diff --git a/test/chunking-form/samples/render-chunk/_config.js b/test/chunking-form/samples/render-chunk/_config.js index 8f9a8bc9b6e..73c0117a60d 100644 --- a/test/chunking-form/samples/render-chunk/_config.js +++ b/test/chunking-form/samples/render-chunk/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { replaceDirectoryInStringifiedObject } = require('../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'transforms chunks in the renderChunk hook, also transforming hashes added in the hook', options: { @@ -30,4 +30,4 @@ module.exports = { assetFileNames: 'asset-[name]-[hash][extname]' } } -}; +}); diff --git a/test/chunking-form/samples/render-dynamic-import/_config.js b/test/chunking-form/samples/render-dynamic-import/_config.js index 2de4e2e67ab..6c4d9f60823 100644 --- a/test/chunking-form/samples/render-dynamic-import/_config.js +++ b/test/chunking-form/samples/render-dynamic-import/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'supports custom rendering for dynamic imports', options: { plugins: { @@ -20,4 +20,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/resolve-dynamic-import/_config.js b/test/chunking-form/samples/resolve-dynamic-import/_config.js index 5dd6e8d73b7..18a97107189 100644 --- a/test/chunking-form/samples/resolve-dynamic-import/_config.js +++ b/test/chunking-form/samples/resolve-dynamic-import/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const EXISTING = path.resolve(__dirname, 'existing.js'); -module.exports = { +module.exports = defineTest({ description: 'Supports all resolution formats for dynamic imports', options: { plugins: { @@ -88,4 +88,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/resolve-file-url/_config.js b/test/chunking-form/samples/resolve-file-url/_config.js index 7116c2b042d..eb4921765c1 100644 --- a/test/chunking-form/samples/resolve-file-url/_config.js +++ b/test/chunking-form/samples/resolve-file-url/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure file urls', options: { output: { @@ -48,4 +48,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/sanitize-chunk-names/_config.js b/test/chunking-form/samples/sanitize-chunk-names/_config.js index a7be50fa92d..88231449099 100644 --- a/test/chunking-form/samples/sanitize-chunk-names/_config.js +++ b/test/chunking-form/samples/sanitize-chunk-names/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'sanitizes chunk names from virtual entry points', options: { input: ['main1'], @@ -17,4 +17,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/sanitize-internal-exports/_config.js b/test/chunking-form/samples/sanitize-internal-exports/_config.js index b387cc182e6..bc1bda3508b 100644 --- a/test/chunking-form/samples/sanitize-internal-exports/_config.js +++ b/test/chunking-form/samples/sanitize-internal-exports/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'make sure internal exports are sanitized', options: { input: ['main.js'] } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/avoid-imports-preserve-modules/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/avoid-imports-preserve-modules/_config.js index 48c8a85b3ff..f705ab8af4b 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/avoid-imports-preserve-modules/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/avoid-imports-preserve-modules/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids empty imports if they do not have side-effects when preserving modules (#3359)', options: { output: { preserveModules: true } } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/avoid-side-effect-free-empty-imports/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/avoid-side-effect-free-empty-imports/_config.js index 78767a46819..c558939ed93 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/avoid-side-effect-free-empty-imports/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/avoid-side-effect-free-empty-imports/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids empty imports if they do not have side-effects', options: { input: ['main1', 'main2'], external: ['external-side-effect'] } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/hoist-side-effect-modules/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/hoist-side-effect-modules/_config.js index 0e131b8996e..96fd2d53044 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/hoist-side-effect-modules/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/hoist-side-effect-modules/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'hoist side-effect imports when avoiding empty imports', options: { input: ['main1', 'main2', 'main3'] }, expectedWarnings: ['CIRCULAR_DEPENDENCY'] -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-empty-imports/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-empty-imports/_config.js index 615562a76d9..6855779e88e 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-empty-imports/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-empty-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids empty imports if moduleSideEffects are false', options: { input: ['main1', 'main2'], @@ -6,4 +6,4 @@ module.exports = { moduleSideEffects: false } } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-1/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-1/_config.js index ba74be8e44a..a47b3d02f34 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-1/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-1/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'handles re-exports in entry points if moduleSideEffects are false', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-2/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-2/_config.js index ba74be8e44a..a47b3d02f34 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-2/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-2/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'handles re-exports in entry points if moduleSideEffects are false', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-3/_config.js b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-3/_config.js index ba74be8e44a..a47b3d02f34 100644 --- a/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-3/_config.js +++ b/test/chunking-form/samples/side-effect-free-dependencies/module-side-effects-reexports-3/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'handles re-exports in entry points if moduleSideEffects are false', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/chunking-form/samples/single-file-manual-chunk/_config.js b/test/chunking-form/samples/single-file-manual-chunk/_config.js index 99a67c2a3e4..ad4828a51a5 100644 --- a/test/chunking-form/samples/single-file-manual-chunk/_config.js +++ b/test/chunking-form/samples/single-file-manual-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'chunk aliasing with extensions', options: { output: { @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/_config.js b/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/_config.js index 78f0aef3f81..a30da76068b 100644 --- a/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles synthetic named exports that are reexported as a default export over several stages', options: { @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/deduplicate-synthetic-named-exports-and-default/_config.js b/test/chunking-form/samples/synthetic-named-exports/deduplicate-synthetic-named-exports-and-default/_config.js index 9553f613606..55d81a22772 100644 --- a/test/chunking-form/samples/synthetic-named-exports/deduplicate-synthetic-named-exports-and-default/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/deduplicate-synthetic-named-exports-and-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles importing a synthetic named export together with the default export', options: { input: ['main1', 'main2', 'main3'], @@ -14,4 +14,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/default-reexport/_config.js b/test/chunking-form/samples/synthetic-named-exports/default-reexport/_config.js index fec9cd1e44b..45fab3730c5 100644 --- a/test/chunking-form/samples/synthetic-named-exports/default-reexport/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/default-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles synthetic named exports that are reexported as a default export where both the default and a named export is used', options: { @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/dynamic-import/_config.js b/test/chunking-form/samples/synthetic-named-exports/dynamic-import/_config.js index 9a5dad50910..a0df85e8d12 100644 --- a/test/chunking-form/samples/synthetic-named-exports/dynamic-import/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/dynamic-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'synthetic named exports', options: { input: ['main.js'], @@ -12,4 +12,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/entry/_config.js b/test/chunking-form/samples/synthetic-named-exports/entry/_config.js index dc6f4350347..f89a194c13b 100644 --- a/test/chunking-form/samples/synthetic-named-exports/entry/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/entry/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not expose the synthetic namespace if an entry point uses a string value', options: { input: ['main', 'other'], @@ -10,4 +10,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/global-conflict/_config.js b/test/chunking-form/samples/synthetic-named-exports/global-conflict/_config.js index 5848d32b403..d1f812437d6 100644 --- a/test/chunking-form/samples/synthetic-named-exports/global-conflict/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/global-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids conflicts with global variables when re-exporting synthetic named exports', options: { plugins: [ @@ -13,4 +13,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports-2/_config.js b/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports-2/_config.js index 9627155afc2..2bfd99aa85f 100644 --- a/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports-2/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports-2/_config.js @@ -1,9 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'mixed synthetic named exports 2', options: { input: ['main.js', 'main2.js'], plugins: [ { + name: 'test-plugin', transform(code, id) { if (id.endsWith('dep1.js') || id.endsWith('dep2.js')) { return { @@ -16,4 +17,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports/_config.js b/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports/_config.js index b13731d1b7d..c1236b71da2 100644 --- a/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/mixed-synthetic-named-exports/_config.js @@ -1,9 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'mixed synthetic named exports', options: { input: ['main.js'], plugins: [ { + name: 'test-plugin', resolveId(id) { if (id.endsWith('dep1.js')) { return { @@ -11,9 +12,8 @@ module.exports = { syntheticNamedExports: true }; } - return null; } } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/multi-level/_config.js b/test/chunking-form/samples/synthetic-named-exports/multi-level/_config.js index 428b9202e06..ca7cb93658c 100644 --- a/test/chunking-form/samples/synthetic-named-exports/multi-level/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/multi-level/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles multiple levels of synthetic named exports', options: { input: ['main.js', 'main2.js', 'main3.js', 'main4.js', 'main5.js'], @@ -14,4 +14,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/synthetic-named-exports/namespace/_config.js b/test/chunking-form/samples/synthetic-named-exports/namespace/_config.js index cfc5383d876..3882d278781 100644 --- a/test/chunking-form/samples/synthetic-named-exports/namespace/_config.js +++ b/test/chunking-form/samples/synthetic-named-exports/namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports re-exported synthetic exports in namespace objects', options: { plugins: [ @@ -15,4 +15,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/chunking-form/samples/system-exports-wrap-pure-annotation/_config.js b/test/chunking-form/samples/system-exports-wrap-pure-annotation/_config.js index 8e4f3669378..ccde3427005 100644 --- a/test/chunking-form/samples/system-exports-wrap-pure-annotation/_config.js +++ b/test/chunking-form/samples/system-exports-wrap-pure-annotation/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'system exports should wrap pure annotations', options: { input: ['main1.js', 'main2.js'] } -}; +}); diff --git a/test/chunking-form/tsconfig.json b/test/chunking-form/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/chunking-form/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/cli/define.d.ts b/test/cli/define.d.ts new file mode 100644 index 00000000000..6e172947d43 --- /dev/null +++ b/test/cli/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigCli } from '../types'; + +declare global { + function defineTest(config: TestConfigCli): TestConfigCli; +} diff --git a/test/cli/index.js b/test/cli/index.js index d59012df8bc..d287bfd3684 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -18,6 +18,9 @@ copySync(resolve(__dirname, 'node_modules_rename_me'), resolve(__dirname, 'node_ runTestSuiteWithSamples( 'cli', resolve(__dirname, 'samples'), + /** + * @param {import('../types').TestConfigCli} config + */ (directory, config) => { (config.skip ? it.skip : config.solo ? it.only : it)( basename(directory) + ': ' + config.description, @@ -54,8 +57,10 @@ async function runTest(config, command) { env: { ...process.env, FORCE_COLOR: '0', ...config.env }, killSignal: 'SIGKILL' }, - (error, code, stderr) => { - if (config.after) config.after(error, code, stderr); + async (error, code, stderr) => { + if (config.after) { + await config.after(error, code, stderr); + } if (error && !error.killed) { if (config.error) { if (!config.error(error)) { @@ -91,7 +96,7 @@ async function runTest(config, command) { } if (config.exports) { - config.exports(module.exports); + await config.exports(module.exports); } } catch (error) { if (config.error) { diff --git a/test/cli/samples/allow-output-prefix/_config.js b/test/cli/samples/allow-output-prefix/_config.js index db33b01555a..4cf8e90b2a6 100644 --- a/test/cli/samples/allow-output-prefix/_config.js +++ b/test/cli/samples/allow-output-prefix/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows output options to be prefixed with "output."', command: 'rollup main.js --output.format es --output.footer "console.log(\'Rollup!\')"' -}; +}); diff --git a/test/cli/samples/amd/_config.js b/test/cli/samples/amd/_config.js index 3a6ddb0ff66..7b84bb42d5e 100644 --- a/test/cli/samples/amd/_config.js +++ b/test/cli/samples/amd/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'sets AMD module ID and define function', command: 'rollup -i main.js -f amd --amd.id foo --amd.define defn' -}; +}); diff --git a/test/cli/samples/banner-intro-outro-footer/_config.js b/test/cli/samples/banner-intro-outro-footer/_config.js index 5c37680a1af..adfc25b205b 100644 --- a/test/cli/samples/banner-intro-outro-footer/_config.js +++ b/test/cli/samples/banner-intro-outro-footer/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'adds banner/intro/outro/footer', command: 'rollup -i main.js -f iife --indent --banner "// banner" --intro "// intro" --outro "// outro" --footer "// footer"' -}; +}); diff --git a/test/cli/samples/code-splitting-named-default-inputs/_config.js b/test/cli/samples/code-splitting-named-default-inputs/_config.js index ce8a380dec3..9bb1db99c46 100644 --- a/test/cli/samples/code-splitting-named-default-inputs/_config.js +++ b/test/cli/samples/code-splitting-named-default-inputs/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows defining names via CLI', command: 'rollup entry1=main1.js "Entry 2"="main 2.js" "main3.js" --entryFileNames [name]-[hash].js -f es', @@ -18,4 +18,4 @@ module.exports = { "console.log('main3');\n" ); } -}; +}); diff --git a/test/cli/samples/code-splitting-named-inputs/_config.js b/test/cli/samples/code-splitting-named-inputs/_config.js index a381d39986b..e22f53d98b2 100644 --- a/test/cli/samples/code-splitting-named-inputs/_config.js +++ b/test/cli/samples/code-splitting-named-inputs/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows defining names via CLI', command: 'rollup --entryFileNames [name]-[hash].js --input entry1=main1.js -i "Entry 2"="main 2.js" -i "main3.js" -f es', @@ -18,4 +18,4 @@ module.exports = { "console.log('main3');\n" ); } -}; +}); diff --git a/test/cli/samples/config-async-function/_config.js b/test/cli/samples/config-async-function/_config.js index 2f42324610a..941479c1dfb 100644 --- a/test/cli/samples/config-async-function/_config.js +++ b/test/cli/samples/config-async-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports using an async function as config', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/config-cjs-dirname/_config.js b/test/cli/samples/config-cjs-dirname/_config.js index 7b8f251fc3e..b9d37f7721a 100644 --- a/test/cli/samples/config-cjs-dirname/_config.js +++ b/test/cli/samples/config-cjs-dirname/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not transpile cjs configs and provides correct __filename', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/config-cwd-case-insensitive-es6/_config.js b/test/cli/samples/config-cwd-case-insensitive-es6/_config.js index 0e5ec766147..62dd7886aeb 100644 --- a/test/cli/samples/config-cwd-case-insensitive-es6/_config.js +++ b/test/cli/samples/config-cwd-case-insensitive-es6/_config.js @@ -2,10 +2,10 @@ function toggleCase(s) { return s == s.toLowerCase() ? s.toUpperCase() : s.toLowerCase(); } -module.exports = { +module.exports = defineTest({ onlyWindows: true, description: "can load ES6 config with cwd that doesn't match realpath", command: 'rollup -c', cwd: __dirname.replace(/^[a-z]:\\/i, toggleCase), execute: true -}; +}); diff --git a/test/cli/samples/config-cwd-case-insensitive/_config.js b/test/cli/samples/config-cwd-case-insensitive/_config.js index 93daf102b21..afda7be92dc 100644 --- a/test/cli/samples/config-cwd-case-insensitive/_config.js +++ b/test/cli/samples/config-cwd-case-insensitive/_config.js @@ -2,10 +2,10 @@ function toggleCase(s) { return s == s.toLowerCase() ? s.toUpperCase() : s.toLowerCase(); } -module.exports = { +module.exports = defineTest({ onlyWindows: true, description: "can load config with cwd that doesn't match realpath", command: 'rollup -c', cwd: __dirname.replace(/^[a-z]:\\/i, toggleCase), execute: true -}; +}); diff --git a/test/cli/samples/config-defineConfig-cjs/_config.js b/test/cli/samples/config-defineConfig-cjs/_config.js index 48bf7c3a5ff..6319cd39237 100644 --- a/test/cli/samples/config-defineConfig-cjs/_config.js +++ b/test/cli/samples/config-defineConfig-cjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses cjs config file which return config wrapped by defineConfig', command: 'rollup --config rollup.config.js', execute: true -}; +}); diff --git a/test/cli/samples/config-defineConfig-mjs/_config.js b/test/cli/samples/config-defineConfig-mjs/_config.js index 5a33e72eea3..f08742d7bd8 100644 --- a/test/cli/samples/config-defineConfig-mjs/_config.js +++ b/test/cli/samples/config-defineConfig-mjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses mjs config file which return config wrapped by defineConfig', command: 'rollup --config rollup.config.mjs', execute: true -}; +}); diff --git a/test/cli/samples/config-env-multiple/_config.js b/test/cli/samples/config-env-multiple/_config.js index c2d2b539981..997fd6227ed 100644 --- a/test/cli/samples/config-env-multiple/_config.js +++ b/test/cli/samples/config-env-multiple/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'passes environment variables to config file via multiple --environment values', command: 'rollup --config --environment PRODUCTION,FOO:bar --environment SECOND,KEY:value --environment FOO:foo', execute: true -}; +}); diff --git a/test/cli/samples/config-env/_config.js b/test/cli/samples/config-env/_config.js index 3036cc208f5..14cd8d6adbd 100644 --- a/test/cli/samples/config-env/_config.js +++ b/test/cli/samples/config-env/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'passes environment variables to config file', command: 'rollup --config --environment PRODUCTION,FOO:bar,HOST:http://localhost:4000', execute: true -}; +}); diff --git a/test/cli/samples/config-es6/_config.js b/test/cli/samples/config-es6/_config.js index 1ed454a1ad9..e575fb5e72e 100644 --- a/test/cli/samples/config-es6/_config.js +++ b/test/cli/samples/config-es6/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses ES6 module config file', command: 'rollup --config rollup.config.js --bundleConfigAsCjs', execute: true -}; +}); diff --git a/test/cli/samples/config-external-function/_config.js b/test/cli/samples/config-external-function/_config.js index 9f21d968ead..05560999890 100644 --- a/test/cli/samples/config-external-function/_config.js +++ b/test/cli/samples/config-external-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external option gets passed from config', command: 'rollup -c -e assert,external-module' -}; +}); diff --git a/test/cli/samples/config-external/_config.js b/test/cli/samples/config-external/_config.js index 59df4b7dbd7..67a0257392f 100644 --- a/test/cli/samples/config-external/_config.js +++ b/test/cli/samples/config-external/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external option gets passed from config', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/config-function-modify-command/_config.js b/test/cli/samples/config-function-modify-command/_config.js index e80816ba3cb..f2343fd941e 100644 --- a/test/cli/samples/config-function-modify-command/_config.js +++ b/test/cli/samples/config-function-modify-command/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'allows cleaning up and modifying the command args in the config file', command: 'rollup --config rollup.config.mjs --some-option="foo" --another-option=42', execute: true -}; +}); diff --git a/test/cli/samples/config-function/_config.js b/test/cli/samples/config-function/_config.js index ad5009c9802..640ddc4f806 100644 --- a/test/cli/samples/config-function/_config.js +++ b/test/cli/samples/config-function/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'if the config file returns a function then this will be called with the command args', command: 'rollup --config rollup.config.mjs --silent', execute: true -}; +}); diff --git a/test/cli/samples/config-import-meta/_config.js b/test/cli/samples/config-import-meta/_config.js index 50b766ab53e..e5a746b0711 100644 --- a/test/cli/samples/config-import-meta/_config.js +++ b/test/cli/samples/config-import-meta/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct import.meta.url in config files', command: 'rollup -c --bundleConfigAsCjs' -}; +}); diff --git a/test/cli/samples/config-json/_config.js b/test/cli/samples/config-json/_config.js index 0c6fb91feae..1791c32172a 100644 --- a/test/cli/samples/config-json/_config.js +++ b/test/cli/samples/config-json/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'allows config file to import json', command: 'rollup --config rollup.config.js --bundleConfigAsCjs', execute: true -}; +}); diff --git a/test/cli/samples/config-missing-export/_config.js b/test/cli/samples/config-missing-export/_config.js index bdc1e039344..b43ae2afdf9 100644 --- a/test/cli/samples/config-missing-export/_config.js +++ b/test/cli/samples/config-missing-export/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'throws error if config does not export an object', command: 'rollup -c', error(error) { assert.ok(/Config file must export an options object/.test(error.message)); } -}; +}); diff --git a/test/cli/samples/config-mjs-plugins/_config.js b/test/cli/samples/config-mjs-plugins/_config.js index a6f62f01ce3..ba7b260f804 100644 --- a/test/cli/samples/config-mjs-plugins/_config.js +++ b/test/cli/samples/config-mjs-plugins/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports native esm as well as CJS plugins when using .mjs in Node 13+', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/config-mjs/_config.js b/test/cli/samples/config-mjs/_config.js index bd9fe8544ed..f86efe57acc 100644 --- a/test/cli/samples/config-mjs/_config.js +++ b/test/cli/samples/config-mjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses config file (.mjs)', command: 'rollup --config rollup.config.mjs', execute: true -}; +}); diff --git a/test/cli/samples/config-multiple-getfilename/_config.js b/test/cli/samples/config-multiple-getfilename/_config.js index 842113b93e1..16d4a577f2b 100644 --- a/test/cli/samples/config-multiple-getfilename/_config.js +++ b/test/cli/samples/config-multiple-getfilename/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'returns correct file names for multiple outputs (#3467)', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/config-multiple-source-maps/_config.js b/test/cli/samples/config-multiple-source-maps/_config.js index 1de74ea00b9..eaaff96129f 100644 --- a/test/cli/samples/config-multiple-source-maps/_config.js +++ b/test/cli/samples/config-multiple-source-maps/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly generates sourcemaps for multiple outputs', command: 'rollup -c --bundleConfigAsCjs' -}; +}); diff --git a/test/cli/samples/config-no-output/_config.js b/test/cli/samples/config-no-output/_config.js index e65b6155526..0e0c3f4d942 100644 --- a/test/cli/samples/config-no-output/_config.js +++ b/test/cli/samples/config-no-output/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { readFileSync, unlinkSync } = require('node:fs'); -module.exports = { +module.exports = defineTest({ description: 'uses -o from CLI', command: 'rollup -c -o output.js', test() { @@ -9,4 +9,4 @@ module.exports = { assert.equal(output.trim(), 'console.log(42);'); unlinkSync('output.js'); } -}; +}); diff --git a/test/cli/samples/config-override/_config.js b/test/cli/samples/config-override/_config.js index 49fc4811440..c0beeadba92 100644 --- a/test/cli/samples/config-override/_config.js +++ b/test/cli/samples/config-override/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'overrides config file with command line arguments', command: 'rollup -c -i main.js -f cjs', execute: true -}; +}); diff --git a/test/cli/samples/config-plugin-entry/_config.js b/test/cli/samples/config-plugin-entry/_config.js index 3f8b027cede..7885059aae8 100644 --- a/test/cli/samples/config-plugin-entry/_config.js +++ b/test/cli/samples/config-plugin-entry/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows plugins to set options.entry', command: 'rollup -c --bundleConfigAsCjs' -}; +}); diff --git a/test/cli/samples/config-promise-cjs/_config.js b/test/cli/samples/config-promise-cjs/_config.js index 75219d417ed..e88cc3f32f0 100644 --- a/test/cli/samples/config-promise-cjs/_config.js +++ b/test/cli/samples/config-promise-cjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses cjs config file which returns a Promise', command: 'rollup --config rollup.config.cjs', execute: true -}; +}); diff --git a/test/cli/samples/config-promise-mjs/_config.js b/test/cli/samples/config-promise-mjs/_config.js index d605500053e..868630206ad 100644 --- a/test/cli/samples/config-promise-mjs/_config.js +++ b/test/cli/samples/config-promise-mjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses mjs config file which returns a Promise', command: 'rollup --config rollup.config.mjs', execute: true -}; +}); diff --git a/test/cli/samples/config-promise/_config.js b/test/cli/samples/config-promise/_config.js index 848c006f2f7..b8dd5a16556 100644 --- a/test/cli/samples/config-promise/_config.js +++ b/test/cli/samples/config-promise/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses config file which returns a Promise', command: 'rollup --config rollup.config.mjs', execute: true -}; +}); diff --git a/test/cli/samples/config-true/_config.js b/test/cli/samples/config-true/_config.js index ca48ad0c303..3b432cd1ac0 100644 --- a/test/cli/samples/config-true/_config.js +++ b/test/cli/samples/config-true/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'defaults to rollup.config.js', command: 'rollup -c --bundleConfigAsCjs', execute: true -}; +}); diff --git a/test/cli/samples/config-ts/_config.js b/test/cli/samples/config-ts/_config.js index b4e2435de4a..ae776a49fab 100644 --- a/test/cli/samples/config-ts/_config.js +++ b/test/cli/samples/config-ts/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'supports loading TypeScript config files via plugin option', command: 'rollup --config rollup.config.ts --configPlugin typescript', execute: true -}; +}); diff --git a/test/cli/samples/config-type-module/_config.js b/test/cli/samples/config-type-module/_config.js index 362bbf54e45..772593d9d2a 100644 --- a/test/cli/samples/config-type-module/_config.js +++ b/test/cli/samples/config-type-module/_config.js @@ -1,6 +1,7 @@ +// @ts-expect-error not included in types const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'tries to load .js config file if package type is "module"', command: 'cd sub && rollup -c rollup.config.js', error: () => true, @@ -15,4 +16,4 @@ module.exports = { 'contains "type": "module". To treat it as a CommonJS script, rename it to use the \'.cjs\' file extension.' ); } -}; +}); diff --git a/test/cli/samples/config-warnings/_config.js b/test/cli/samples/config-warnings/_config.js index f807bb3c129..d61f41abf5f 100644 --- a/test/cli/samples/config-warnings/_config.js +++ b/test/cli/samples/config-warnings/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'displays warnings when a config is loaded', command: 'rollup -c --bundleConfigAsCjs', stderr: stderr => @@ -8,4 +8,4 @@ module.exports = { stderr, 'loaded rollup.config.js with warnings\n(!) Use of eval is strongly discouraged' ) -}; +}); diff --git a/test/cli/samples/config/_config.js b/test/cli/samples/config/_config.js index 4dff8e5be22..542a86cdacc 100644 --- a/test/cli/samples/config/_config.js +++ b/test/cli/samples/config/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses config file', command: 'rollup --config rollup.config.js', execute: true -}; +}); diff --git a/test/cli/samples/context/_config.js b/test/cli/samples/context/_config.js index 9f2d46d6667..5e3baab3e5c 100644 --- a/test/cli/samples/context/_config.js +++ b/test/cli/samples/context/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Uses --context to set `this` value', command: 'rollup main.js --format commonjs --context window' -}; +}); diff --git a/test/cli/samples/custom-frame-with-pos/_config.js b/test/cli/samples/custom-frame-with-pos/_config.js index 2af0a903e4d..a4d39f61ba6 100644 --- a/test/cli/samples/custom-frame-with-pos/_config.js +++ b/test/cli/samples/custom-frame-with-pos/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'custom (plugin generated) code frame taking priority over pos generated one', command: 'rollup -c', error: () => true, @@ -9,4 +9,4 @@ module.exports = { stderr, '[!] (plugin at position 1) Error: My error.\n' + 'main.js (1:5)\n' + 'custom code frame\n' ) -}; +}); diff --git a/test/cli/samples/custom-frame/_config.js b/test/cli/samples/custom-frame/_config.js index bd3f7c35c69..18a92db801a 100644 --- a/test/cli/samples/custom-frame/_config.js +++ b/test/cli/samples/custom-frame/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'errors with plugin generated code frames also contain stack', command: 'rollup -c', error: () => true, @@ -13,4 +13,4 @@ module.exports = { ); assertIncludes(stderr, 'rollup.config.js:9:19'); } -}; +}); diff --git a/test/cli/samples/deconflict-entry-point-in-subdir/_config.js b/test/cli/samples/deconflict-entry-point-in-subdir/_config.js index e45bfaeb3b0..691614b5a9d 100644 --- a/test/cli/samples/deconflict-entry-point-in-subdir/_config.js +++ b/test/cli/samples/deconflict-entry-point-in-subdir/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflict entry points with the same name in different directories', command: 'rollup --input main.js --input sub/main.js --format es --dir _actual' -}; +}); diff --git a/test/cli/samples/duplicate-import-options/_config.js b/test/cli/samples/duplicate-import-options/_config.js index 14ff13ae654..bcc81aa5679 100644 --- a/test/cli/samples/duplicate-import-options/_config.js +++ b/test/cli/samples/duplicate-import-options/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'throws if different types of entries are combined', command: 'rollup main.js --format es --input main.js', error: () => true, stderr(stderr) { assertIncludes(stderr, '[!] Either use --input, or pass input path as argument'); } -}; +}); diff --git a/test/cli/samples/emit-file-multiple-dirs/_config.js b/test/cli/samples/emit-file-multiple-dirs/_config.js index 34c81bf123b..021f8f92fbd 100644 --- a/test/cli/samples/emit-file-multiple-dirs/_config.js +++ b/test/cli/samples/emit-file-multiple-dirs/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'writes files emitted by plugins in different output dirs', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/empty-chunk-multiple/_config.js b/test/cli/samples/empty-chunk-multiple/_config.js index 5b343d1f0c9..9a27c125145 100644 --- a/test/cli/samples/empty-chunk-multiple/_config.js +++ b/test/cli/samples/empty-chunk-multiple/_config.js @@ -1,8 +1,8 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'shows warning when multiple chunks empty', command: 'rollup -c', error: () => true, stderr: stderr => assertIncludes(stderr, '(!) Generated empty chunks\n"a" and "b"') -}; +}); diff --git a/test/cli/samples/empty-chunk/_config.js b/test/cli/samples/empty-chunk/_config.js index 88e55b8b0c0..7a2e3d50f9c 100644 --- a/test/cli/samples/empty-chunk/_config.js +++ b/test/cli/samples/empty-chunk/_config.js @@ -1,8 +1,8 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'shows warning when chunk empty', command: 'rollup -c', error: () => true, stderr: stderr => assertIncludes(stderr, '(!) Generated an empty chunk\n"main"') -}; +}); diff --git a/test/cli/samples/external-modules-auto-global/_config.js b/test/cli/samples/external-modules-auto-global/_config.js index 5f21ae87f33..610d1a88c41 100644 --- a/test/cli/samples/external-modules-auto-global/_config.js +++ b/test/cli/samples/external-modules-auto-global/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'populates options.external with --global keys', command: 'rollup main.js --format iife --globals mathematics:Math,promises:Promise --external promises', @@ -8,4 +8,4 @@ module.exports = { stderr(stderr) { assert.ok(!stderr.includes('(!)')); } -}; +}); diff --git a/test/cli/samples/external-modules/_config.js b/test/cli/samples/external-modules/_config.js index cf38798421d..d4d118c9d7c 100644 --- a/test/cli/samples/external-modules/_config.js +++ b/test/cli/samples/external-modules/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows external modules to be specified with --external=foo,bar,baz', command: 'rollup main.js --format cjs --external=path,util', execute: true, stderr(stderr) { assert.ok(!stderr.includes('(!)')); } -}; +}); diff --git a/test/cli/samples/fail-after-warnings/_config.js b/test/cli/samples/fail-after-warnings/_config.js index a525e9eb155..a691f17f6b0 100644 --- a/test/cli/samples/fail-after-warnings/_config.js +++ b/test/cli/samples/fail-after-warnings/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'errors on warnings with --failAfterWarnings', command: 'rollup -i main.js --failAfterWarnings', error: () => true, @@ -8,4 +8,4 @@ module.exports = { assertIncludes(stderr, '[!] Warnings occurred and --failAfterWarnings flag present'); return true; } -}; +}); diff --git a/test/cli/samples/format-aliases/_config.js b/test/cli/samples/format-aliases/_config.js index f9f9d685f72..3385c838d78 100644 --- a/test/cli/samples/format-aliases/_config.js +++ b/test/cli/samples/format-aliases/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports format aliases', command: 'rollup --config' -}; +}); diff --git a/test/cli/samples/generated-code-preset-override/_config.js b/test/cli/samples/generated-code-preset-override/_config.js index e4a45bceb0b..88324d35763 100644 --- a/test/cli/samples/generated-code-preset-override/_config.js +++ b/test/cli/samples/generated-code-preset-override/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'overrides the generatedCode option when using presets', command: 'rollup --config --generatedCode es5 --generatedCode.arrowFunctions' -}; +}); diff --git a/test/cli/samples/generated-code-unknown-preset/_config.js b/test/cli/samples/generated-code-unknown-preset/_config.js index 1a226f9a2b9..59097909324 100644 --- a/test/cli/samples/generated-code-unknown-preset/_config.js +++ b/test/cli/samples/generated-code-unknown-preset/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'overrides the generatedCode option when using presets', command: 'rollup main.js --format es --generatedCode unknown', error: () => true, @@ -11,4 +11,4 @@ module.exports = { 'https://rollupjs.org/configuration-options/#output-generatedcode' ); } -}; +}); diff --git a/test/cli/samples/import-esm-package/_config.js b/test/cli/samples/import-esm-package/_config.js index 23d127d1d67..799eee235bd 100644 --- a/test/cli/samples/import-esm-package/_config.js +++ b/test/cli/samples/import-esm-package/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to import ESM dependencies from transpiled config files', skipIfWindows: true, command: "rollup --config --configPlugin '{transform:c => c}'" -}; +}); diff --git a/test/cli/samples/indent-none/_config.js b/test/cli/samples/indent-none/_config.js index e37aead6bc1..8012ec9b115 100644 --- a/test/cli/samples/indent-none/_config.js +++ b/test/cli/samples/indent-none/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'disables indentation with --no-indent', command: 'rollup main.js --format umd --no-indent' -}; +}); diff --git a/test/cli/samples/interop/_config.js b/test/cli/samples/interop/_config.js index fc70bd51768..05758269016 100644 --- a/test/cli/samples/interop/_config.js +++ b/test/cli/samples/interop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not include the interop block', command: 'rollup -i main.js -f cjs --external test --interop default' -}; +}); diff --git a/test/cli/samples/log-side-effects/_config.js b/test/cli/samples/log-side-effects/_config.js index 766f465e99c..be96afd8421 100644 --- a/test/cli/samples/log-side-effects/_config.js +++ b/test/cli/samples/log-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'logs side effects', command: 'rollup --config' -}; +}); diff --git a/test/cli/samples/merge-deprecations/_config.js b/test/cli/samples/merge-deprecations/_config.js index 6d0000bd4f5..e2fe3932b16 100644 --- a/test/cli/samples/merge-deprecations/_config.js +++ b/test/cli/samples/merge-deprecations/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges deprecated with current options', command: 'rollup --config rollup.config.js' -}; +}); diff --git a/test/cli/samples/merge-treeshake-false/_config.js b/test/cli/samples/merge-treeshake-false/_config.js index 5ae50196368..0196a32ef0a 100644 --- a/test/cli/samples/merge-treeshake-false/_config.js +++ b/test/cli/samples/merge-treeshake-false/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'sets all tree-shaking to false if one option disables it', command: 'rollup main.js --format es --external external --treeshake.moduleSideEffects no-external --no-treeshake --no-treeshake.unknownGlobalSideEffects' -}; +}); diff --git a/test/cli/samples/merge-treeshake/_config.js b/test/cli/samples/merge-treeshake/_config.js index ace0199f7d2..3ef30501c95 100644 --- a/test/cli/samples/merge-treeshake/_config.js +++ b/test/cli/samples/merge-treeshake/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'merges treeshake options', command: 'rollup main.js --format es --external external --treeshake.moduleSideEffects no-external --treeshake --no-treeshake.unknownGlobalSideEffects' -}; +}); diff --git a/test/cli/samples/module-name/_config.js b/test/cli/samples/module-name/_config.js index 8b5f7e892ff..f00059c308d 100644 --- a/test/cli/samples/module-name/_config.js +++ b/test/cli/samples/module-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generates UMD export with correct name', command: 'rollup main.js --format umd --name myBundle --indent' -}; +}); diff --git a/test/cli/samples/multiple-configs/_config.js b/test/cli/samples/multiple-configs/_config.js index d660cdb064b..2b051280552 100644 --- a/test/cli/samples/multiple-configs/_config.js +++ b/test/cli/samples/multiple-configs/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'generates output file when multiple configurations are specified and one build fails', command: 'rollup -c', @@ -8,4 +8,4 @@ module.exports = { assert.ok(/Unexpected Exception/.test(error.message)); return true; } -}; +}); diff --git a/test/cli/samples/multiple-targets-different-plugins/_config.js b/test/cli/samples/multiple-targets-different-plugins/_config.js index e9ded7da1c6..ef1717d65e5 100644 --- a/test/cli/samples/multiple-targets-different-plugins/_config.js +++ b/test/cli/samples/multiple-targets-different-plugins/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generates multiple output files, only one of which is minified', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/multiple-targets-shared-config/_config.js b/test/cli/samples/multiple-targets-shared-config/_config.js index 6d7125c8d54..c967ec06e1a 100644 --- a/test/cli/samples/multiple-targets-shared-config/_config.js +++ b/test/cli/samples/multiple-targets-shared-config/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses shared config for each target', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/multiple-targets/_config.js b/test/cli/samples/multiple-targets/_config.js index 73d5d28f379..8055513278e 100644 --- a/test/cli/samples/multiple-targets/_config.js +++ b/test/cli/samples/multiple-targets/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generates multiple output files when multiple targets are specified', command: 'rollup -c' -}; +}); diff --git a/test/cli/samples/no-color/_config.js b/test/cli/samples/no-color/_config.js index fc0f082b433..243974c0076 100644 --- a/test/cli/samples/no-color/_config.js +++ b/test/cli/samples/no-color/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'respects the NO_COLOR environment variable', command: 'rollup -i main1.js -i main2.js -f es', env: { FORCE_COLOR: undefined, NO_COLOR: true }, @@ -15,4 +15,4 @@ module.exports = { "console.log('main2');\n" ); } -}; +}); diff --git a/test/cli/samples/no-conflict/_config.js b/test/cli/samples/no-conflict/_config.js index cc870f8a263..1c83f52e828 100644 --- a/test/cli/samples/no-conflict/_config.js +++ b/test/cli/samples/no-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'respects noConflict option', command: 'rollup --config rollup.config.js' -}; +}); diff --git a/test/cli/samples/no-strict/_config.js b/test/cli/samples/no-strict/_config.js index 72d4a3242ee..d3292d10c04 100644 --- a/test/cli/samples/no-strict/_config.js +++ b/test/cli/samples/no-strict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'use no strict option', command: 'rollup -i main.js -f iife --no-strict --indent' -}; +}); diff --git a/test/cli/samples/no-treeshake/_config.js b/test/cli/samples/no-treeshake/_config.js index 9cd57bca6ff..a43b8ff098d 100644 --- a/test/cli/samples/no-treeshake/_config.js +++ b/test/cli/samples/no-treeshake/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generates IIFE export with all code and overrides config', command: 'rollup -c --no-treeshake' -}; +}); diff --git a/test/cli/samples/node-config-auto-prefix/_config.js b/test/cli/samples/node-config-auto-prefix/_config.js index 084ade901da..01a704703aa 100644 --- a/test/cli/samples/node-config-auto-prefix/_config.js +++ b/test/cli/samples/node-config-auto-prefix/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses config file installed from npm, automatically adding a rollup-config- prefix', command: 'rollup --config node:foo', execute: true -}; +}); diff --git a/test/cli/samples/node-config-not-found/_config.js b/test/cli/samples/node-config-not-found/_config.js index f4ad14d9ed4..8f15f8fcefe 100644 --- a/test/cli/samples/node-config-not-found/_config.js +++ b/test/cli/samples/node-config-not-found/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'throws if a config in node_modules cannot be found', command: 'rollup --config node:baz', error: () => true, stderr(stderr) { assertIncludes(stderr, '[!] Could not resolve config file "node:baz"'); } -}; +}); diff --git a/test/cli/samples/node-config/_config.js b/test/cli/samples/node-config/_config.js index fdd13b0cc98..3c64202229b 100644 --- a/test/cli/samples/node-config/_config.js +++ b/test/cli/samples/node-config/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'uses config file installed from npm', command: 'rollup --config node:bar', cwd: __dirname, execute: true -}; +}); diff --git a/test/cli/samples/paths-output-option/_config.js b/test/cli/samples/paths-output-option/_config.js index e0c7edd32a1..bd7e413a3ca 100644 --- a/test/cli/samples/paths-output-option/_config.js +++ b/test/cli/samples/paths-output-option/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows paths to be set as an output option', command: 'rollup --config rollup.config.js' -}; +}); diff --git a/test/cli/samples/plugin/absolute-esm/_config.js b/test/cli/samples/plugin/absolute-esm/_config.js index c72ec2c2329..4d26c4ec133 100644 --- a/test/cli/samples/plugin/absolute-esm/_config.js +++ b/test/cli/samples/plugin/absolute-esm/_config.js @@ -1,6 +1,6 @@ const { sep } = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'ESM CLI --plugin /absolute/path', command: `rollup main.js -p "${__dirname}${sep}my-esm-plugin.mjs={comment: 'Absolute ESM'}"` -}; +}); diff --git a/test/cli/samples/plugin/absolute/_config.js b/test/cli/samples/plugin/absolute/_config.js index 0884fd686c2..63e8931820c 100644 --- a/test/cli/samples/plugin/absolute/_config.js +++ b/test/cli/samples/plugin/absolute/_config.js @@ -1,6 +1,6 @@ const { sep } = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'CLI --plugin /absolute/path', command: `rollup main.js -p "${__dirname}${sep}my-plugin.js={VALUE: 'absolute', ZZZ: 1}"` -}; +}); diff --git a/test/cli/samples/plugin/advanced-esm/_config.js b/test/cli/samples/plugin/advanced-esm/_config.js index ee7545ea184..c5f8b989499 100644 --- a/test/cli/samples/plugin/advanced-esm/_config.js +++ b/test/cli/samples/plugin/advanced-esm/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'load an ESM-only rollup plugin from node_modules as well as CJS plugins', skipIfWindows: true, @@ -6,4 +6,4 @@ module.exports = { // Must copy the ESM plugin into the main node_modules in order to use and test it. command: `rm -rf ../../../../../node_modules/rollup-plugin-esm-test && cp -rp ../../../node_modules_rename_me/rollup-plugin-esm-test ../../../../../node_modules/ && rollup -c -p node-resolve,commonjs,esm-test -p "terser={mangle: false, output: {beautify: true, indent_level: 2}}"` -}; +}); diff --git a/test/cli/samples/plugin/advanced/_config.js b/test/cli/samples/plugin/advanced/_config.js index fa474579270..448ab2ef5af 100644 --- a/test/cli/samples/plugin/advanced/_config.js +++ b/test/cli/samples/plugin/advanced/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'advanced CLI --plugin functionality with rollup config', command: `rollup -c -p node-resolve,commonjs -p "terser={output: {beautify: true, indent_level: 2}}"` -}; +}); diff --git a/test/cli/samples/plugin/basic/_config.js b/test/cli/samples/plugin/basic/_config.js index 4914b4a27a0..9ed1c48800e 100644 --- a/test/cli/samples/plugin/basic/_config.js +++ b/test/cli/samples/plugin/basic/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'basic CLI --plugin functionality', command: `rollup main.js -f cjs --plugin @rollup/plugin-buble` -}; +}); diff --git a/test/cli/samples/plugin/cannot-load/_config.js b/test/cli/samples/plugin/cannot-load/_config.js index 041aec47c0b..0281e5446bc 100644 --- a/test/cli/samples/plugin/cannot-load/_config.js +++ b/test/cli/samples/plugin/cannot-load/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'unknown CLI --plugin results in an error', skipIfWindows: true, command: `echo "console.log(123);" | rollup --plugin foobar`, error(error) { assertIncludes(error.message, '[!] Error: Cannot load plugin "foobar"'); } -}; +}); diff --git a/test/cli/samples/plugin/default-export/_config.js b/test/cli/samples/plugin/default-export/_config.js index 2a74334e40b..c30a5078550 100644 --- a/test/cli/samples/plugin/default-export/_config.js +++ b/test/cli/samples/plugin/default-export/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'CLI --plugin with default export', skipIfWindows: true, command: `echo 'console.log(VALUE);' | rollup -p "./my-plugin={VALUE: 'default', ZZZ: 1}"` -}; +}); diff --git a/test/cli/samples/plugin/export-not-found/_config.js b/test/cli/samples/plugin/export-not-found/_config.js index 54497d00bfb..fbffef44ec8 100644 --- a/test/cli/samples/plugin/export-not-found/_config.js +++ b/test/cli/samples/plugin/export-not-found/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'Throws when the plugin export cannot be found', skipIfWindows: true, command: `echo 'console.log("ignored");' | rollup -p "./my-missing-plugin"`, @@ -14,4 +14,4 @@ module.exports = { )}". The plugin needs to export a function either as "default" or "myMissingPlugin" for Rollup to recognize it.` ); } -}; +}); diff --git a/test/cli/samples/plugin/invalid-argument/_config.js b/test/cli/samples/plugin/invalid-argument/_config.js index 438ffb0ee70..a6e103e73a6 100644 --- a/test/cli/samples/plugin/invalid-argument/_config.js +++ b/test/cli/samples/plugin/invalid-argument/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'invalid CLI --plugin argument format', skipIfWindows: true, command: `echo "console.log(123);" | rollup --plugin 'foo bar'`, error(error) { assertIncludes(error.message, '[!] Error: Invalid --plugin argument format: "foo bar"'); } -}; +}); diff --git a/test/cli/samples/plugin/object/_config.js b/test/cli/samples/plugin/object/_config.js index f102a47afeb..935d3d82c89 100644 --- a/test/cli/samples/plugin/object/_config.js +++ b/test/cli/samples/plugin/object/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'CLI --plugin object', skipIfWindows: true, command: `echo 'console.log(42);' | rollup -f cjs -p '{transform: c => c + String.fromCharCode(10) + c}'` -}; +}); diff --git a/test/cli/samples/plugin/relative-camelized/_config.js b/test/cli/samples/plugin/relative-camelized/_config.js index 6ee87968574..b6f0e4b8fa3 100644 --- a/test/cli/samples/plugin/relative-camelized/_config.js +++ b/test/cli/samples/plugin/relative-camelized/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles plugins where the export name is the camelized file name', skipIfWindows: true, command: @@ -7,4 +7,4 @@ module.exports = { '-p "./plugins/rollup-plugin-my-super-plugin2.js" ' + '-p "./plugins/rollup-plugin-" ' + '-p "./plugins/@rollup/plugin-supreme"' -}; +}); diff --git a/test/cli/samples/plugin/relative-esm/_config.js b/test/cli/samples/plugin/relative-esm/_config.js index 3792a107f3e..2ba56b771ce 100644 --- a/test/cli/samples/plugin/relative-esm/_config.js +++ b/test/cli/samples/plugin/relative-esm/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'ESM CLI --plugin ../relative/path', skipIfWindows: true, command: `echo 'console.log(1 ? 2 : 3);' | rollup -p "../absolute-esm/my-esm-plugin.mjs={comment: 'Relative ESM'}"` -}; +}); diff --git a/test/cli/samples/plugin/relative/_config.js b/test/cli/samples/plugin/relative/_config.js index 177951ac68e..fb09dc5b717 100644 --- a/test/cli/samples/plugin/relative/_config.js +++ b/test/cli/samples/plugin/relative/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'CLI --plugin ../relative/path', skipIfWindows: true, command: `echo 'console.log(VALUE);' | rollup -p "../absolute/my-plugin={VALUE: 'relative', ZZZ: 1}"` -}; +}); diff --git a/test/cli/samples/property-read-side-effects/_config.js b/test/cli/samples/property-read-side-effects/_config.js index 9cb2ce5fd62..3f5fc3d58f9 100644 --- a/test/cli/samples/property-read-side-effects/_config.js +++ b/test/cli/samples/property-read-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows disabling side-effects when accessing properties', command: 'rollup main.js --format es --no-treeshake.propertyReadSideEffects' -}; +}); diff --git a/test/cli/samples/propertyReadSideEffects-always/_config.js b/test/cli/samples/propertyReadSideEffects-always/_config.js index 1c76838ca53..1c1c85a86c4 100644 --- a/test/cli/samples/propertyReadSideEffects-always/_config.js +++ b/test/cli/samples/propertyReadSideEffects-always/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'verify property accesses are retained for getters with side effects', command: `rollup main.js --validate --treeshake.propertyReadSideEffects=always` -}; +}); diff --git a/test/cli/samples/silent-onwarn/_config.js b/test/cli/samples/silent-onwarn/_config.js index c13449930cf..dfde8172a3a 100644 --- a/test/cli/samples/silent-onwarn/_config.js +++ b/test/cli/samples/silent-onwarn/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'triggers onwarn with --silent', command: 'rollup -c --silent', stderr: stderr => { assert.equal(stderr, ''); return true; } -}; +}); diff --git a/test/cli/samples/silent/_config.js b/test/cli/samples/silent/_config.js index 010fa421e13..e16f664b934 100644 --- a/test/cli/samples/silent/_config.js +++ b/test/cli/samples/silent/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not print warnings with --silent', command: 'rollup -i main.js -f cjs --silent', stderr: stderr => { assert.equal(stderr, ''); return true; } -}; +}); diff --git a/test/cli/samples/sourcemap-hidden/_config.js b/test/cli/samples/sourcemap-hidden/_config.js index 4e1020b2990..3b221c556e0 100644 --- a/test/cli/samples/sourcemap-hidden/_config.js +++ b/test/cli/samples/sourcemap-hidden/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { readFileSync, unlinkSync } = require('node:fs'); -module.exports = { +module.exports = defineTest({ description: 'omits sourcemap comments', command: 'rollup -i main.js -f es -m hidden -o output.js', test() { @@ -13,4 +13,4 @@ module.exports = { ); unlinkSync('output.js.map'); } -}; +}); diff --git a/test/cli/samples/sourcemap-newline/_config.js b/test/cli/samples/sourcemap-newline/_config.js index d98d7878b54..4249a9a6dd0 100644 --- a/test/cli/samples/sourcemap-newline/_config.js +++ b/test/cli/samples/sourcemap-newline/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds a newline after the sourceMappingURL comment (#756)', command: 'rollup -i main.js -f es -m inline', result: code => { assert.equal(code.slice(-1), '\n'); } -}; +}); diff --git a/test/cli/samples/stdin/commonjs/_config.js b/test/cli/samples/stdin/commonjs/_config.js index 5ce8ad4a188..1fd14514f58 100644 --- a/test/cli/samples/stdin/commonjs/_config.js +++ b/test/cli/samples/stdin/commonjs/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses stdin to inline a require()', skipIfWindows: true, command: `echo 'console.log(require("./add.js")(2, 1));' | rollup --stdin=js -p commonjs -f cjs --exports=auto` -}; +}); diff --git a/test/cli/samples/stdin/config-file/_config.js b/test/cli/samples/stdin/config-file/_config.js index 09d1acef0bf..ae73172b6dd 100644 --- a/test/cli/samples/stdin/config-file/_config.js +++ b/test/cli/samples/stdin/config-file/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not replace input with stdin but allows referencing it when using a config file', skipIfWindows: true, command: `echo "import {PRINT as p} from './a'; import C from './b'; 0 && fail() || p(C); export {C as value, p as print}" | rollup -c` -}; +}); diff --git a/test/cli/samples/stdin/force-stdin-tty/_config.js b/test/cli/samples/stdin/force-stdin-tty/_config.js index 754e74be351..65d6b5f2314 100644 --- a/test/cli/samples/stdin/force-stdin-tty/_config.js +++ b/test/cli/samples/stdin/force-stdin-tty/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'allows forcing stdin input on TTY interfaces via option', skipIfWindows: true, command: `echo "console.log('PASS');" | ./wrapper.js -f es --stdin` -}; +}); diff --git a/test/cli/samples/stdin/json/_config.js b/test/cli/samples/stdin/json/_config.js index e9443f0667f..00f0d2528d0 100644 --- a/test/cli/samples/stdin/json/_config.js +++ b/test/cli/samples/stdin/json/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'pipe JSON over stdin to create a module', skipIfWindows: true, command: `echo '{"foo": 42, "bar": "ok"}' | rollup --stdin=json -p json` -}; +}); diff --git a/test/cli/samples/stdin/no-dash/_config.js b/test/cli/samples/stdin/no-dash/_config.js index bc97f7e7214..71524f914b5 100644 --- a/test/cli/samples/stdin/no-dash/_config.js +++ b/test/cli/samples/stdin/no-dash/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'uses stdin input when piping into Rollup without an input', skipIfWindows: true, command: `echo "0 && fail() || console.log('PASS');" | rollup` -}; +}); diff --git a/test/cli/samples/stdin/no-stdin-config-file/_config.js b/test/cli/samples/stdin/no-stdin-config-file/_config.js index 069b2eca2ae..ead4a2e286a 100644 --- a/test/cli/samples/stdin/no-stdin-config-file/_config.js +++ b/test/cli/samples/stdin/no-stdin-config-file/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'allows using "-" as a regular file name via flag', skipIfWindows: true, command: `echo "console.log('IGNORED');" | rollup -c --no-stdin` -}; +}); diff --git a/test/cli/samples/stdin/no-stdin-tty/_config.js b/test/cli/samples/stdin/no-stdin-tty/_config.js index c0ac30263b6..3a78e0ab7d8 100644 --- a/test/cli/samples/stdin/no-stdin-tty/_config.js +++ b/test/cli/samples/stdin/no-stdin-tty/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'does not use input as stdin on TTY interfaces', skipIfWindows: true, command: `echo "console.log('PASS');" | ./wrapper.js -f es`, error(error) { assertIncludes(error.message, 'You must supply options.input to rollup'); } -}; +}); diff --git a/test/cli/samples/stdin/self-import/_config.js b/test/cli/samples/stdin/self-import/_config.js index 0d03f53502f..ec1f5195976 100644 --- a/test/cli/samples/stdin/self-import/_config.js +++ b/test/cli/samples/stdin/self-import/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'stdin input of code that imports a copy of itself', skipIfWindows: true, command: `cat input.txt | rollup -f cjs --silent` -}; +}); diff --git a/test/cli/samples/stdin/stdin-error/_config.js b/test/cli/samples/stdin/stdin-error/_config.js index d5efb600b8e..116566d816c 100644 --- a/test/cli/samples/stdin/stdin-error/_config.js +++ b/test/cli/samples/stdin/stdin-error/_config.js @@ -1,9 +1,9 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'handles stdin errors', command: `node wrapper.js`, error(error) { assertIncludes(error.message, 'Could not load -: Stream is broken.'); } -}; +}); diff --git a/test/cli/samples/stdin/with-dash/_config.js b/test/cli/samples/stdin/with-dash/_config.js index 332119cd6ca..780147e9ed8 100644 --- a/test/cli/samples/stdin/with-dash/_config.js +++ b/test/cli/samples/stdin/with-dash/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'stdin input with dash on CLI', skipIfWindows: true, command: `echo "0 && fail() || console.log('PASS');" | rollup -` -}; +}); diff --git a/test/cli/samples/stdout-code-splitting/_config.js b/test/cli/samples/stdout-code-splitting/_config.js index 6b257ffd63f..597aa432073 100644 --- a/test/cli/samples/stdout-code-splitting/_config.js +++ b/test/cli/samples/stdout-code-splitting/_config.js @@ -3,7 +3,7 @@ const assert = require('node:assert'); const COLOR = '\u001B[36m\u001B[1m'; const STANDARD = '\u001B[22m\u001B[39m'; -module.exports = { +module.exports = defineTest({ description: 'bundles multiple files to stdout while adding file names', skipIfWindows: true, command: @@ -24,4 +24,4 @@ module.exports = { 'Hello' ); } -}; +}); diff --git a/test/cli/samples/stdout-only-inline-sourcemaps/_config.js b/test/cli/samples/stdout-only-inline-sourcemaps/_config.js index 4f1d38e41f1..8e945ad5b97 100644 --- a/test/cli/samples/stdout-only-inline-sourcemaps/_config.js +++ b/test/cli/samples/stdout-only-inline-sourcemaps/_config.js @@ -1,10 +1,10 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'fails when using non-inline sourcemaps when bundling to stdout', command: 'rollup -i main.js -f es -m', error: () => true, stderr: stderr => { assertIncludes(stderr, '[!] Only inline sourcemaps are supported when bundling to stdout.\n'); } -}; +}); diff --git a/test/cli/samples/stdout-single-input/_config.js b/test/cli/samples/stdout-single-input/_config.js index f5a8e98af8b..8b28aaf07ab 100644 --- a/test/cli/samples/stdout-single-input/_config.js +++ b/test/cli/samples/stdout-single-input/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'bundles a single input to stdout without modifications', command: 'rollup -i main.js -f es -m inline' -}; +}); diff --git a/test/cli/samples/symlinked-config/_config.js b/test/cli/samples/symlinked-config/_config.js index ca76fa8746f..eac8148ee67 100644 --- a/test/cli/samples/symlinked-config/_config.js +++ b/test/cli/samples/symlinked-config/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'loads a symlinked config file', command: 'rollup -c --bundleConfigAsCjs', execute: true -}; +}); diff --git a/test/cli/samples/symlinked-named-config/_config.js b/test/cli/samples/symlinked-named-config/_config.js index 31b3debd42f..ce2277bf94b 100644 --- a/test/cli/samples/symlinked-named-config/_config.js +++ b/test/cli/samples/symlinked-named-config/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'loads a symlinked config file with the given name', command: 'rollup --config my.rollup.config.js --bundleConfigAsCjs', execute: true -}; +}); diff --git a/test/cli/samples/treeshake-preset-override/_config.js b/test/cli/samples/treeshake-preset-override/_config.js index dc8435858f8..236ccabcf16 100644 --- a/test/cli/samples/treeshake-preset-override/_config.js +++ b/test/cli/samples/treeshake-preset-override/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'overrides the treeshake option when using presets', command: 'rollup --config --treeshake recommended --treeshake.unknownGlobalSideEffects --no-treeshake.moduleSideEffects' -}; +}); diff --git a/test/cli/samples/treeshake-unknown-preset/_config.js b/test/cli/samples/treeshake-unknown-preset/_config.js index 15bed7c194b..4c02801f011 100644 --- a/test/cli/samples/treeshake-unknown-preset/_config.js +++ b/test/cli/samples/treeshake-unknown-preset/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'overrides the treeshake option when using presets', command: 'rollup main.js --format es --treeshake unknown', error: () => true, @@ -11,4 +11,4 @@ module.exports = { 'https://rollupjs.org/configuration-options/#treeshake' ); } -}; +}); diff --git a/test/cli/samples/unfulfilled-hook-actions-error/_config.js b/test/cli/samples/unfulfilled-hook-actions-error/_config.js index d496a31f9c3..a0231f2fbab 100644 --- a/test/cli/samples/unfulfilled-hook-actions-error/_config.js +++ b/test/cli/samples/unfulfilled-hook-actions-error/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { assertIncludes, assertDoesNotInclude } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'does not show unfulfilled hook actions if there are errors', command: 'node build.mjs', after(error) { @@ -12,4 +12,4 @@ module.exports = { assertIncludes(stderr, 'Error: Error must be displayed.'); assertDoesNotInclude(stderr, 'Unfinished'); } -}; +}); diff --git a/test/cli/samples/unfulfilled-hook-actions-manual-exit/_config.js b/test/cli/samples/unfulfilled-hook-actions-manual-exit/_config.js index ff05e013e76..f924a3f4657 100644 --- a/test/cli/samples/unfulfilled-hook-actions-manual-exit/_config.js +++ b/test/cli/samples/unfulfilled-hook-actions-manual-exit/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const { assertDoesNotInclude } = require('../../../utils'); const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'does not show unfulfilled hook actions when exiting manually with a non-zero exit code', command: 'rollup -c --silent', @@ -17,4 +17,4 @@ module.exports = { assertDoesNotInclude(stderr, 'Unfinished'); assertIncludes(stderr, 'Manual exit'); } -}; +}); diff --git a/test/cli/samples/unfulfilled-hook-actions/_config.js b/test/cli/samples/unfulfilled-hook-actions/_config.js index 175d8c4b97d..9a093ed7afe 100644 --- a/test/cli/samples/unfulfilled-hook-actions/_config.js +++ b/test/cli/samples/unfulfilled-hook-actions/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'show errors with non-zero exit code for unfulfilled async plugin actions on exit', command: 'rollup -c --silent', after(error) { @@ -26,4 +26,4 @@ module.exports = { assertIncludes(stderr, '(buggy-plugin) moduleParsed "./d.js"'); assertIncludes(stderr, '(buggy-plugin) shouldTransformCachedModule "./e.js"'); } -}; +}); diff --git a/test/cli/samples/validate/_config.js b/test/cli/samples/validate/_config.js index 5ac726397c6..5fb3da2f69b 100644 --- a/test/cli/samples/validate/_config.js +++ b/test/cli/samples/validate/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'use CLI --validate to test whether output is well formed', skipIfWindows: true, command: `rollup main.js --silent --outro 'console.log("end"); /*' -o _actual/out.js --validate`, @@ -15,4 +15,4 @@ out.js (3:20) 3: console.log("end"); /* ^` ) -}; +}); diff --git a/test/cli/samples/wait-for-bundle-input-object/_config.js b/test/cli/samples/wait-for-bundle-input-object/_config.js index 325aa98ce9e..2596753440f 100644 --- a/test/cli/samples/wait-for-bundle-input-object/_config.js +++ b/test/cli/samples/wait-for-bundle-input-object/_config.js @@ -5,7 +5,7 @@ const { atomicWriteFileSync } = require('../../../utils'); let second; let third; -module.exports = { +module.exports = defineTest({ description: 'waits for multiple named bundle inputs', command: 'rollup -c --waitForBundleInput', before() { @@ -23,4 +23,4 @@ module.exports = { atomicWriteFileSync(third, "export default 'third'"); } } -}; +}); diff --git a/test/cli/samples/wait-for-bundle-input/_config.js b/test/cli/samples/wait-for-bundle-input/_config.js index 2fad94ad28c..1e7538e0c41 100644 --- a/test/cli/samples/wait-for-bundle-input/_config.js +++ b/test/cli/samples/wait-for-bundle-input/_config.js @@ -4,7 +4,7 @@ const { atomicWriteFileSync } = require('../../../utils'); let mainFile; -module.exports = { +module.exports = defineTest({ description: 'waits for bundle input', command: 'rollup -c --waitForBundleInput', before() { @@ -21,4 +21,4 @@ module.exports = { // We wait for a regular abort as we do not watch return false; } -}; +}); diff --git a/test/cli/samples/warn-broken-sourcemap/_config.js b/test/cli/samples/warn-broken-sourcemap/_config.js index 965e3a64e6c..96b1bb07d5a 100644 --- a/test/cli/samples/warn-broken-sourcemap/_config.js +++ b/test/cli/samples/warn-broken-sourcemap/_config.js @@ -2,7 +2,7 @@ const { unlinkSync } = require('node:fs'); const path = require('node:path'); const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'displays warnings for broken sourcemaps', command: 'rollup -c', stderr: stderr => { @@ -15,4 +15,4 @@ module.exports = { 'Plugins that transform code (such as "test-plugin1") should generate accompanying sourcemaps.\n' ); } -}; +}); diff --git a/test/cli/samples/warn-broken-sourcemaps/_config.js b/test/cli/samples/warn-broken-sourcemaps/_config.js index 859bffafe9c..98441384b3e 100644 --- a/test/cli/samples/warn-broken-sourcemaps/_config.js +++ b/test/cli/samples/warn-broken-sourcemaps/_config.js @@ -2,7 +2,7 @@ const { unlinkSync } = require('node:fs'); const path = require('node:path'); const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'displays warnings for broken sourcemaps', command: 'rollup -c', stderr: stderr => { @@ -15,4 +15,4 @@ module.exports = { 'Plugins that transform code (such as "test-plugin1", "test-plugin2" and "test-plugin3") should generate accompanying sourcemaps' ); } -}; +}); diff --git a/test/cli/samples/warn-circular-multiple/_config.js b/test/cli/samples/warn-circular-multiple/_config.js index 49bf737b7f6..6922df7811b 100644 --- a/test/cli/samples/warn-circular-multiple/_config.js +++ b/test/cli/samples/warn-circular-multiple/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for multiple circular dependencies', command: 'rollup -c', stderr: stderr => @@ -13,4 +13,4 @@ module.exports = { '...and 3 more\n' + '' ) -}; +}); diff --git a/test/cli/samples/warn-circular/_config.js b/test/cli/samples/warn-circular/_config.js index 20038499a4a..b92d9f3eecc 100644 --- a/test/cli/samples/warn-circular/_config.js +++ b/test/cli/samples/warn-circular/_config.js @@ -1,9 +1,9 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for circular dependencies', command: 'rollup -c', stderr(stderr) { assertIncludes(stderr, '(!) Circular dependency\nmain.js -> dep.js -> main.js\n'); } -}; +}); diff --git a/test/cli/samples/warn-eval-multiple/_config.js b/test/cli/samples/warn-eval-multiple/_config.js index 69e38b11a95..2366fee118f 100644 --- a/test/cli/samples/warn-eval-multiple/_config.js +++ b/test/cli/samples/warn-eval-multiple/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when eval is used multiple times', command: 'rollup -c', stderr: stderr => @@ -25,4 +25,4 @@ module.exports = { '\n' + '...and 3 other files' ) -}; +}); diff --git a/test/cli/samples/warn-eval/_config.js b/test/cli/samples/warn-eval/_config.js index 7020fb46363..1f3bfdf3927 100644 --- a/test/cli/samples/warn-eval/_config.js +++ b/test/cli/samples/warn-eval/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when eval is used', command: 'rollup -c', stderr: stderr => @@ -12,4 +12,4 @@ module.exports = { "1: eval('foo');\n" + ' ^' ) -}; +}); diff --git a/test/cli/samples/warn-import-export/_config.js b/test/cli/samples/warn-import-export/_config.js index cf33deb78f0..a0509bef540 100644 --- a/test/cli/samples/warn-import-export/_config.js +++ b/test/cli/samples/warn-import-export/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns about import and export related issues', command: 'rollup -c', stderr: stderr => { @@ -51,4 +51,4 @@ module.exports = { 'otherUnresolvedExternal (imported by "dep.js")\n' ); } -}; +}); diff --git a/test/cli/samples/warn-missing-global-multiple/_config.js b/test/cli/samples/warn-missing-global-multiple/_config.js index 8bbc59db71d..2114d64aac0 100644 --- a/test/cli/samples/warn-missing-global-multiple/_config.js +++ b/test/cli/samples/warn-missing-global-multiple/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when there are multiple missing globals', command: 'rollup -c', stderr: stderr => @@ -13,4 +13,4 @@ module.exports = { 'external2 (guessing "foo2")\n' + 'external3 (guessing "foo3")' ) -}; +}); diff --git a/test/cli/samples/warn-missing-global/_config.js b/test/cli/samples/warn-missing-global/_config.js index e503a5203f4..8506ae1f1fb 100644 --- a/test/cli/samples/warn-missing-global/_config.js +++ b/test/cli/samples/warn-missing-global/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when there is a missing global variable name', command: 'rollup -c', stderr: stderr => @@ -11,4 +11,4 @@ module.exports = { 'Use "output.globals" to specify browser global variable names corresponding to external modules:\n' + 'external (guessing "foo")' ) -}; +}); diff --git a/test/cli/samples/warn-mixed-exports-multiple/_config.js b/test/cli/samples/warn-mixed-exports-multiple/_config.js index 7a46e3d649f..3aa16c21fc1 100644 --- a/test/cli/samples/warn-mixed-exports-multiple/_config.js +++ b/test/cli/samples/warn-mixed-exports-multiple/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when mixed exports are used', command: 'rollup -c', stderr: stderr => { @@ -17,4 +17,4 @@ module.exports = { 'Consumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.\n' ); } -}; +}); diff --git a/test/cli/samples/warn-multiple/_config.js b/test/cli/samples/warn-multiple/_config.js index 3e54afe0c85..d069fc6035b 100644 --- a/test/cli/samples/warn-multiple/_config.js +++ b/test/cli/samples/warn-multiple/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'aggregates warnings of different types', command: 'rollup -c', stderr: stderr => { @@ -41,4 +41,4 @@ module.exports = { "3: import url from 'url';\n" ); } -}; +}); diff --git a/test/cli/samples/warn-plugin-loc/_config.js b/test/cli/samples/warn-plugin-loc/_config.js index 8b8f52bb4e9..2e773991428 100644 --- a/test/cli/samples/warn-plugin-loc/_config.js +++ b/test/cli/samples/warn-plugin-loc/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'correctly adds locations to plugin warnings', command: 'rollup -c', stderr: stderr => { @@ -14,4 +14,4 @@ module.exports = { 'file-id3: (3:4)\n' ); } -}; +}); diff --git a/test/cli/samples/warn-plugin/_config.js b/test/cli/samples/warn-plugin/_config.js index c02c8d5b693..2b4760ab4be 100644 --- a/test/cli/samples/warn-plugin/_config.js +++ b/test/cli/samples/warn-plugin/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'displays warnings from plugins', command: 'rollup -c', stderr: stderr => @@ -15,4 +15,4 @@ module.exports = { 'other.js: (1:2)\n' + 'custom frame' ) -}; +}); diff --git a/test/cli/samples/warn-this/_config.js b/test/cli/samples/warn-this/_config.js index b97772132ea..021269a0606 100644 --- a/test/cli/samples/warn-this/_config.js +++ b/test/cli/samples/warn-this/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns "this" is used on the top level', command: 'rollup -c', stderr: stderr => @@ -12,4 +12,4 @@ module.exports = { '1: console.log(this);\n' + ' ^' ) -}; +}); diff --git a/test/cli/samples/warn-unknown-options/_config.js b/test/cli/samples/warn-unknown-options/_config.js index 5b68f78dcce..2f8284348e9 100644 --- a/test/cli/samples/warn-unknown-options/_config.js +++ b/test/cli/samples/warn-unknown-options/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns about unknown CLI options', command: 'rollup --config rollup.config.js --format es --configAnswer 42 --unknownOption' -}; +}); diff --git a/test/cli/samples/watch/bundle-error/_config.js b/test/cli/samples/watch/bundle-error/_config.js index c00b2e0161b..09425be2612 100644 --- a/test/cli/samples/watch/bundle-error/_config.js +++ b/test/cli/samples/watch/bundle-error/_config.js @@ -4,7 +4,7 @@ const { atomicWriteFileSync } = require('../../../../utils'); let mainFile; -module.exports = { +module.exports = defineTest({ description: 'recovers from errors during bundling', command: 'rollup -cw --bundleConfigAsCjs', before() { @@ -24,4 +24,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/clearScreen/_config.js b/test/cli/samples/watch/clearScreen/_config.js index 5716ff3da78..92ee02ced74 100644 --- a/test/cli/samples/watch/clearScreen/_config.js +++ b/test/cli/samples/watch/clearScreen/_config.js @@ -3,7 +3,7 @@ const assert = require('node:assert'); const CLEAR_SCREEN = '\u001Bc'; const UNDERLINE = '\u001B[4m'; -module.exports = { +module.exports = defineTest({ description: 'clears the screen before bundling', command: 'node wrapper.js -cw', env: { FORCE_COLOR: '1', TERM: 'xterm' }, @@ -15,4 +15,4 @@ module.exports = { stderr(stderr) { assert.strictEqual(stderr.slice(0, 12), `${CLEAR_SCREEN}${UNDERLINE}rollup`); } -}; +}); diff --git a/test/cli/samples/watch/close-error/_config.js b/test/cli/samples/watch/close-error/_config.js index 02dbfdd4b9e..c7d16051421 100644 --- a/test/cli/samples/watch/close-error/_config.js +++ b/test/cli/samples/watch/close-error/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'displays errors when closing the watcher', command: 'rollup -cw', abortOnStderr(data) { @@ -6,4 +6,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/close-on-generate-error/_config.js b/test/cli/samples/watch/close-on-generate-error/_config.js index c39fb2fe398..458dda70c51 100644 --- a/test/cli/samples/watch/close-on-generate-error/_config.js +++ b/test/cli/samples/watch/close-on-generate-error/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'closes the bundle on generate errors', command: 'rollup -cw', abortOnStderr(data) { @@ -16,4 +16,4 @@ module.exports = { assertIncludes(stderr, 'Bundle closed'); return false; } -}; +}); diff --git a/test/cli/samples/watch/close-stdin/_config.js b/test/cli/samples/watch/close-stdin/_config.js index cd460e29b4c..9ccc16e4fd8 100644 --- a/test/cli/samples/watch/close-stdin/_config.js +++ b/test/cli/samples/watch/close-stdin/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'closes the watcher when stdin closes', retry: true, command: 'node wrapper.js main.js --watch --format es --file _actual/out.js' -}; +}); diff --git a/test/cli/samples/watch/no-clearScreen-command/_config.js b/test/cli/samples/watch/no-clearScreen-command/_config.js index 7c266e1233d..ca121bf2cdc 100644 --- a/test/cli/samples/watch/no-clearScreen-command/_config.js +++ b/test/cli/samples/watch/no-clearScreen-command/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const UNDERLINE = '\u001B[4m'; -module.exports = { +module.exports = defineTest({ description: 'allows disabling clearing the screen from the command line', command: 'node wrapper.js main.js --format es --file _actual.js --watch --no-watch.clearScreen', env: { FORCE_COLOR: '1', TERM: 'xterm' }, @@ -14,4 +14,4 @@ module.exports = { stderr(stderr) { assert.strictEqual(stderr.slice(0, 10), `${UNDERLINE}rollup`); } -}; +}); diff --git a/test/cli/samples/watch/no-clearScreen/_config.js b/test/cli/samples/watch/no-clearScreen/_config.js index b4fe3acc3e3..e55d9acff3a 100644 --- a/test/cli/samples/watch/no-clearScreen/_config.js +++ b/test/cli/samples/watch/no-clearScreen/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const UNDERLINE = '\u001B[4m'; -module.exports = { +module.exports = defineTest({ description: 'allows disabling clearing the screen', command: 'node wrapper.js -cw', env: { FORCE_COLOR: '1', TERM: 'xterm' }, @@ -14,4 +14,4 @@ module.exports = { stderr(stderr) { assert.strictEqual(stderr.slice(0, 10), `${UNDERLINE}rollup`); } -}; +}); diff --git a/test/cli/samples/watch/no-config-file/_config.js b/test/cli/samples/watch/no-config-file/_config.js index c671e90a607..8c5aeefdd91 100644 --- a/test/cli/samples/watch/no-config-file/_config.js +++ b/test/cli/samples/watch/no-config-file/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'watches without a config file', command: 'rollup main.js --watch --format es --file _actual/main.js', abortOnStderr(data) { @@ -6,4 +6,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/no-watch-by-default/_config.js b/test/cli/samples/watch/no-watch-by-default/_config.js index b43ee5fbb19..7f38a585cad 100644 --- a/test/cli/samples/watch/no-watch-by-default/_config.js +++ b/test/cli/samples/watch/no-watch-by-default/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'does not watch if --watch is missing', command: 'node wrapper.js -c --no-watch.clearScreen', stderr: stderr => assertIncludes(stderr, 'main.js → _actual.js...\ncreated _actual.js in'), @@ -9,4 +9,4 @@ module.exports = { throw new Error('Watch initiated'); } } -}; +}); diff --git a/test/cli/samples/watch/no-watched-config/_config.js b/test/cli/samples/watch/no-watched-config/_config.js index a1bc0153478..16105ce3fec 100644 --- a/test/cli/samples/watch/no-watched-config/_config.js +++ b/test/cli/samples/watch/no-watched-config/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'throws if no config is watched', command: 'rollup -cw', error: () => true, @@ -10,4 +10,4 @@ module.exports = { '[!] RollupError: Invalid value for option "watch" - there must be at least one config where "watch" is not set to "false".' ); } -}; +}); diff --git a/test/cli/samples/watch/node-config-file/_config.js b/test/cli/samples/watch/node-config-file/_config.js index 1cbfcf60c82..cfc9cfd8a06 100644 --- a/test/cli/samples/watch/node-config-file/_config.js +++ b/test/cli/samples/watch/node-config-file/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'watches using a node_modules config files', command: 'rollup --watch --config node:custom', abortOnStderr(data) { @@ -6,4 +6,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/watch-config-early-update/_config.js b/test/cli/samples/watch/watch-config-early-update/_config.js index f308be20524..14407dc9eba 100644 --- a/test/cli/samples/watch/watch-config-early-update/_config.js +++ b/test/cli/samples/watch/watch-config-early-update/_config.js @@ -5,7 +5,7 @@ const { wait, writeAndSync, writeAndRetry } = require('../../../../utils'); const configFile = path.join(__dirname, 'rollup.config.mjs'); let stopUpdate; -module.exports = { +module.exports = defineTest({ description: 'immediately reloads the config file if a change happens while it is parsed', command: 'rollup -cw', before() { @@ -70,4 +70,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/watch-config-error/_config.js b/test/cli/samples/watch/watch-config-error/_config.js index f825b8df8b9..19e46528133 100644 --- a/test/cli/samples/watch/watch-config-error/_config.js +++ b/test/cli/samples/watch/watch-config-error/_config.js @@ -4,7 +4,7 @@ const { atomicWriteFileSync } = require('../../../../utils'); let configFile; -module.exports = { +module.exports = defineTest({ description: 'keeps watching the config file in case the config is changed to an invalid state', command: 'rollup -cw', before() { @@ -52,4 +52,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/watch-config-initial-error/_config.js b/test/cli/samples/watch/watch-config-initial-error/_config.js index a11326beaed..54fd977b695 100644 --- a/test/cli/samples/watch/watch-config-initial-error/_config.js +++ b/test/cli/samples/watch/watch-config-initial-error/_config.js @@ -4,7 +4,7 @@ const { atomicWriteFileSync } = require('../../../../utils'); let configFile; -module.exports = { +module.exports = defineTest({ description: 'keeps watching the config file in case the initial file contains an error', command: 'rollup -cw', before() { @@ -34,4 +34,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/cli/samples/watch/watch-config-no-update/_config.js b/test/cli/samples/watch/watch-config-no-update/_config.js index ad478a90223..5c49f13ca02 100644 --- a/test/cli/samples/watch/watch-config-no-update/_config.js +++ b/test/cli/samples/watch/watch-config-no-update/_config.js @@ -12,7 +12,7 @@ const configContent = '\t}\n' + '};'; -module.exports = { +module.exports = defineTest({ description: 'does not rebuild if the config file is updated without change', command: 'rollup -cw', before() { @@ -38,4 +38,4 @@ module.exports = { throw new Error(`stderr output does not match: ${JSON.stringify(stderr)}`); } } -}; +}); diff --git a/test/cli/samples/watch/watch-event-hooks-error/_config.js b/test/cli/samples/watch/watch-event-hooks-error/_config.js index 06797470b83..7c438f181ca 100644 --- a/test/cli/samples/watch/watch-event-hooks-error/_config.js +++ b/test/cli/samples/watch/watch-event-hooks-error/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'onError event hook shell commands write to stderr', command: 'node wrapper.js -cw --watch.onError "echo error"', abortOnStderr(data) { @@ -15,4 +15,4 @@ module.exports = { error` ); } -}; +}); diff --git a/test/cli/samples/watch/watch-event-hooks/_config.js b/test/cli/samples/watch/watch-event-hooks/_config.js index b74f3ccd28b..917301e9e74 100644 --- a/test/cli/samples/watch/watch-event-hooks/_config.js +++ b/test/cli/samples/watch/watch-event-hooks/_config.js @@ -1,6 +1,6 @@ const { assertIncludes } = require('../../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'event hook shell commands write to stderr', retry: true, command: @@ -34,4 +34,4 @@ bundleEnd` end` ); } -}; +}); diff --git a/test/cli/tsconfig.json b/test/cli/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/cli/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/file-hashes/define.d.ts b/test/file-hashes/define.d.ts new file mode 100644 index 00000000000..e44c14045fa --- /dev/null +++ b/test/file-hashes/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigFileHash } from '../types'; + +declare global { + function defineTest(config: TestConfigFileHash): TestConfigFileHash; +} diff --git a/test/file-hashes/index.js b/test/file-hashes/index.js index c57435dc939..360b6396cfb 100644 --- a/test/file-hashes/index.js +++ b/test/file-hashes/index.js @@ -1,47 +1,59 @@ const path = require('node:path'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ +// @ts-expect-error not included in types const rollup = require('../../dist/rollup'); +// @ts-expect-error not included in types const { runTestSuiteWithSamples } = require('../utils.js'); -runTestSuiteWithSamples('file hashes', path.resolve(__dirname, 'samples'), (directory, config) => { - (config.skip ? describe.skip : config.solo ? describe.only : describe)( - path.basename(directory) + ': ' + config.description, - () => { - it(`generates correct hashes`, () => { - process.chdir(directory); - return Promise.all( - [config.options1, config.options2].map(options => - rollup.rollup(options).then(bundle => - bundle.generate({ - format: 'es', - chunkFileNames: '[hash]', - entryFileNames: '[hash]', - ...options.output - }) +runTestSuiteWithSamples( + 'file hashes', + path.resolve(__dirname, 'samples'), + /** + * @param {import('../types').TestConfigFileHash} config + */ + (directory, config) => { + (config.skip ? describe.skip : config.solo ? describe.only : describe)( + path.basename(directory) + ': ' + config.description, + () => { + it(`generates correct hashes`, () => { + process.chdir(directory); + return Promise.all( + [config.options1, config.options2].map(options => + rollup.rollup(options).then(bundle => + bundle.generate({ + format: 'es', + chunkFileNames: '[hash]', + entryFileNames: '[hash]', + ...options.output + }) + ) ) - ) - ).then(([generated1, generated2]) => { - const fileContentsByHash = new Map(); - addFileContentsByFileName(fileContentsByHash, generated1); - addFileContentsByFileName(fileContentsByHash, generated2); - if (config.show) { - console.log(fileContentsByHash); - } - for (const contents of fileContentsByHash.values()) { - if (contents.size > 1) { - throw new Error( - `Two chunks contained different code even though the hashes were the same: ${[ - ...contents - ] - .map(JSON.stringify) - .join(' != ')}` - ); + ).then(([generated1, generated2]) => { + const fileContentsByHash = new Map(); + addFileContentsByFileName(fileContentsByHash, generated1); + addFileContentsByFileName(fileContentsByHash, generated2); + if (config.show) { + console.log(fileContentsByHash); } - } + for (const contents of fileContentsByHash.values()) { + if (contents.size > 1) { + throw new Error( + `Two chunks contained different code even though the hashes were the same: ${[ + ...contents + ] + .map(error => JSON.stringify(error)) + .join(' != ')}` + ); + } + } + }); }); - }); - } - ); -}); + } + ); + } +); function addFileContentsByFileName(fileContentsByFileName, generated) { for (const chunk of generated.output) { diff --git a/test/file-hashes/samples/augment-chunk-hash/_config.js b/test/file-hashes/samples/augment-chunk-hash/_config.js index b801e17ddd5..a8fe2f2e7bf 100644 --- a/test/file-hashes/samples/augment-chunk-hash/_config.js +++ b/test/file-hashes/samples/augment-chunk-hash/_config.js @@ -1,7 +1,7 @@ const augment1 = '/*foo*/'; const augment2 = '/*bar*/'; -module.exports = { +module.exports = defineTest({ description: 'augmentChunkHash updates hashes across all modules when returning something', options1: { input: 'main', @@ -47,4 +47,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/file-hashes/samples/banner/_config.js b/test/file-hashes/samples/banner/_config.js index 805b2096a6f..b4224453c28 100644 --- a/test/file-hashes/samples/banner/_config.js +++ b/test/file-hashes/samples/banner/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the banner differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { banner: 'console.log(2);' } } -}; +}); diff --git a/test/file-hashes/samples/chunk-name/_config.js b/test/file-hashes/samples/chunk-name/_config.js index 5e4473d7d48..b1fb6968483 100644 --- a/test/file-hashes/samples/chunk-name/_config.js +++ b/test/file-hashes/samples/chunk-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the name pattern differs', options1: { input: { @@ -18,4 +18,4 @@ module.exports = { entryFileNames: '[name]-[hash].js' } } -}; +}); diff --git a/test/file-hashes/samples/content/_config.js b/test/file-hashes/samples/content/_config.js index dd2047a083e..ccc0f9fca85 100644 --- a/test/file-hashes/samples/content/_config.js +++ b/test/file-hashes/samples/content/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the content differs', options1: { input: { main: 'main1', dep: 'dep1' } @@ -6,4 +6,4 @@ module.exports = { options2: { input: { main: 'main2', dep: 'dep2' } } -}; +}); diff --git a/test/file-hashes/samples/dependency-content/_config.js b/test/file-hashes/samples/dependency-content/_config.js index bfc9ca3485d..325e0523415 100644 --- a/test/file-hashes/samples/dependency-content/_config.js +++ b/test/file-hashes/samples/dependency-content/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the content of dependencies differs', options1: { input: { main: 'main1', dep: 'dep1' } @@ -6,4 +6,4 @@ module.exports = { options2: { input: { main: 'main2', dep: 'dep2' } } -}; +}); diff --git a/test/file-hashes/samples/export-order-2/_config.js b/test/file-hashes/samples/export-order-2/_config.js index 3840ab69b9c..5e4d37e6aad 100644 --- a/test/file-hashes/samples/export-order-2/_config.js +++ b/test/file-hashes/samples/export-order-2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if different variables are exported under the same name', options1: { input: ['main1', 'dep'] @@ -6,4 +6,4 @@ module.exports = { options2: { input: ['main2', 'dep'] } -}; +}); diff --git a/test/file-hashes/samples/export-order/_config.js b/test/file-hashes/samples/export-order/_config.js index 342bef8136a..022540c31aa 100644 --- a/test/file-hashes/samples/export-order/_config.js +++ b/test/file-hashes/samples/export-order/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if different variables are exported under the same name', options1: { input: ['main1'] @@ -6,4 +6,4 @@ module.exports = { options2: { input: ['main2'] } -}; +}); diff --git a/test/file-hashes/samples/exports/_config.js b/test/file-hashes/samples/exports/_config.js index 10b8e4c6c99..bd16c09f922 100644 --- a/test/file-hashes/samples/exports/_config.js +++ b/test/file-hashes/samples/exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the generated exports differ', options1: { input: ['main1', 'other'] @@ -6,4 +6,4 @@ module.exports = { options2: { input: ['main2', 'other'] } -}; +}); diff --git a/test/file-hashes/samples/external-dependency-names/_config.js b/test/file-hashes/samples/external-dependency-names/_config.js index e3a80e8db9d..3bf0ce57c8a 100644 --- a/test/file-hashes/samples/external-dependency-names/_config.js +++ b/test/file-hashes/samples/external-dependency-names/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the names of external dependencies differ', options1: { input: { mainA: 'main1a', mainB: 'main1b' }, @@ -8,4 +8,4 @@ module.exports = { input: { mainA: 'main2a', mainB: 'main2b' }, external: ['external', 'external2'] } -}; +}); diff --git a/test/file-hashes/samples/footer/_config.js b/test/file-hashes/samples/footer/_config.js index 49b41fc6d05..8d637560b9a 100644 --- a/test/file-hashes/samples/footer/_config.js +++ b/test/file-hashes/samples/footer/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the footer differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { footer: 'console.log(2);' } } -}; +}); diff --git a/test/file-hashes/samples/format/_config.js b/test/file-hashes/samples/format/_config.js index 1ea5521d2bd..bf79a5a8e50 100644 --- a/test/file-hashes/samples/format/_config.js +++ b/test/file-hashes/samples/format/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the format differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { format: 'cjs' } } -}; +}); diff --git a/test/file-hashes/samples/internal-exports/_config.js b/test/file-hashes/samples/internal-exports/_config.js index c77a5d4686c..0632fb47d0b 100644 --- a/test/file-hashes/samples/internal-exports/_config.js +++ b/test/file-hashes/samples/internal-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if generated internal exports differ', options1: { input: ['main1', 'other'] @@ -6,4 +6,4 @@ module.exports = { options2: { input: ['main2', 'other'] } -}; +}); diff --git a/test/file-hashes/samples/intro/_config.js b/test/file-hashes/samples/intro/_config.js index 04eb80772c6..d95710ecb1b 100644 --- a/test/file-hashes/samples/intro/_config.js +++ b/test/file-hashes/samples/intro/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the intro differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { intro: 'console.log(2);' } } -}; +}); diff --git a/test/file-hashes/samples/name-pattern/_config.js b/test/file-hashes/samples/name-pattern/_config.js index e0127aa0aab..ea118ef4545 100644 --- a/test/file-hashes/samples/name-pattern/_config.js +++ b/test/file-hashes/samples/name-pattern/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the name pattern differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { chunkFileNames: '[name]-[hash]' } } -}; +}); diff --git a/test/file-hashes/samples/outro/_config.js b/test/file-hashes/samples/outro/_config.js index 5248af72f0e..a7d0c40d7e4 100644 --- a/test/file-hashes/samples/outro/_config.js +++ b/test/file-hashes/samples/outro/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates different hashes if the outro differs', options1: { input: 'main', @@ -12,4 +12,4 @@ module.exports = { outro: 'console.log(2);' } } -}; +}); diff --git a/test/file-hashes/samples/render-chunk-changes/_config.js b/test/file-hashes/samples/render-chunk-changes/_config.js index c4d17be937f..c0222125e59 100644 --- a/test/file-hashes/samples/render-chunk-changes/_config.js +++ b/test/file-hashes/samples/render-chunk-changes/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reflects changes in renderChunk', options1: { input: 'main', @@ -24,4 +24,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/file-hashes/tsconfig.json b/test/file-hashes/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/file-hashes/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/form/define.d.ts b/test/form/define.d.ts new file mode 100644 index 00000000000..70a9f24e7b0 --- /dev/null +++ b/test/form/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigForm } from '../types'; + +declare global { + function defineTest(config: TestConfigForm): TestConfigForm; +} diff --git a/test/form/index.js b/test/form/index.js index 8170f9de3df..e45c7e1aa90 100644 --- a/test/form/index.js +++ b/test/form/index.js @@ -1,78 +1,95 @@ const assert = require('node:assert'); const { existsSync, readFileSync } = require('node:fs'); const { basename, resolve } = require('node:path'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ +// @ts-expect-error not included in types const { rollup } = require('../../dist/rollup'); const { normaliseOutput, runTestSuiteWithSamples } = require('../utils.js'); const FORMATS = ['amd', 'cjs', 'system', 'es', 'iife', 'umd']; -runTestSuiteWithSamples('form', resolve(__dirname, 'samples'), (directory, config) => { - const isSingleFormatTest = existsSync(directory + '/_expected.js'); - const itOrDescribe = isSingleFormatTest ? it : describe; - (config.skip ? itOrDescribe.skip : config.solo ? itOrDescribe.only : itOrDescribe)( - basename(directory) + ': ' + config.description, - () => { - let bundle; - const runRollupTest = async (inputFile, bundleFile, defaultFormat) => { - const warnings = []; - if (config.before) config.before(); - try { - process.chdir(directory); - bundle = - bundle || - (await rollup({ - input: directory + '/main.js', - onwarn: warning => { - if (!(config.expectedWarnings && config.expectedWarnings.includes(warning.code))) { - warnings.push(warning); - } +runTestSuiteWithSamples( + 'form', + resolve(__dirname, 'samples'), + /** + * @param {import('../types').TestConfigForm} config + */ + (directory, config) => { + const isSingleFormatTest = existsSync(directory + '/_expected.js'); + const itOrDescribe = isSingleFormatTest ? it : describe; + (config.skip ? itOrDescribe.skip : config.solo ? itOrDescribe.only : itOrDescribe)( + basename(directory) + ': ' + config.description, + () => { + let bundle; + const runRollupTest = async (inputFile, bundleFile, defaultFormat) => { + const warnings = []; + if (config.before) { + await config.before(); + } + try { + process.chdir(directory); + bundle = + bundle || + (await rollup({ + input: directory + '/main.js', + onwarn: warning => { + if ( + !(config.expectedWarnings && config.expectedWarnings.includes(warning.code)) + ) { + warnings.push(warning); + } + }, + strictDeprecations: true, + ...config.options + })); + await generateAndTestBundle( + bundle, + { + exports: 'auto', + file: inputFile, + format: defaultFormat, + validate: true, + ...(config.options || {}).output }, - strictDeprecations: true, - ...config.options - })); - await generateAndTestBundle( - bundle, - { - exports: 'auto', - file: inputFile, - format: defaultFormat, - validate: true, - ...(config.options || {}).output - }, - bundleFile, - config - ); - } finally { - if (config.after) config.after(); - } - if (warnings.length > 0) { - const codes = new Set(); - for (const { code } of warnings) { - codes.add(code); + bundleFile, + config + ); + } finally { + if (config.after) { + await config.after(); + } } - throw new Error( - `Unexpected warnings (${[...codes].join(', ')}): \n${warnings - .map(({ message }) => `${message}\n\n`) - .join('')}` + 'If you expect warnings, list their codes in config.expectedWarnings' - ); + if (warnings.length > 0) { + const codes = new Set(); + for (const { code } of warnings) { + codes.add(code); + } + throw new Error( + `Unexpected warnings (${[...codes].join(', ')}): \n${warnings + .map(({ message }) => `${message}\n\n`) + .join('')}` + 'If you expect warnings, list their codes in config.expectedWarnings' + ); + } + }; + + if (isSingleFormatTest) { + return runRollupTest(directory + '/_actual.js', directory + '/_expected.js', 'es'); } - }; - if (isSingleFormatTest) { - return runRollupTest(directory + '/_actual.js', directory + '/_expected.js', 'es'); + for (const format of config.formats || FORMATS) + it('generates ' + format, () => + runRollupTest( + directory + '/_actual/' + format + '.js', + directory + '/_expected/' + format + '.js', + format + ) + ); } - - for (const format of config.formats || FORMATS) - it('generates ' + format, () => - runRollupTest( - directory + '/_actual/' + format + '.js', - directory + '/_expected/' + format + '.js', - format - ) - ); - } - ); -}); + ); + } +); async function generateAndTestBundle(bundle, outputOptions, expectedFile, { show }) { await bundle.write(outputOptions); diff --git a/test/form/samples/absolute-path-resolver/_config.js b/test/form/samples/absolute-path-resolver/_config.js index 3dc468e94a8..3463f2ed7cb 100644 --- a/test/form/samples/absolute-path-resolver/_config.js +++ b/test/form/samples/absolute-path-resolver/_config.js @@ -1,10 +1,11 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'normalizes absolute ids', options: { plugins: [ { + name: 'test', transform(code, id) { if (/main/.test(id)) { return code.replace('"./a.js"', JSON.stringify(path.resolve(__dirname, 'a.js'))); @@ -13,4 +14,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/acorn-external-plugins/_config.js b/test/form/samples/acorn-external-plugins/_config.js index 48682b384b0..2789b15c199 100644 --- a/test/form/samples/acorn-external-plugins/_config.js +++ b/test/form/samples/acorn-external-plugins/_config.js @@ -1,8 +1,8 @@ const jsx = require('acorn-jsx'); -module.exports = { +module.exports = defineTest({ description: 'supports official acorn plugins that may rely on a shared acorn instance', options: { acornInjectPlugins: [jsx()] } -}; +}); diff --git a/test/form/samples/addon-functions/_config.js b/test/form/samples/addon-functions/_config.js index 7a945ec98d5..3379a2debf8 100644 --- a/test/form/samples/addon-functions/_config.js +++ b/test/form/samples/addon-functions/_config.js @@ -1,4 +1,5 @@ const assert = require('node:assert'); +// @ts-expect-error not included in types const { replaceDirectoryInStringifiedObject } = require('../../../utils'); const assertChunkData = chunk => assert.strictEqual( @@ -31,7 +32,7 @@ const assertChunkData = chunk => '}' ); -module.exports = { +module.exports = defineTest({ description: 'provides module information when adding addons', options: { output: { @@ -93,4 +94,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/amd-id-auto/_config.js b/test/form/samples/amd-id-auto/_config.js index c08fbc50402..0d8bb4090c8 100644 --- a/test/form/samples/amd-id-auto/_config.js +++ b/test/form/samples/amd-id-auto/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to use amd.autoId', options: { output: { amd: { autoId: true } } } -}; +}); diff --git a/test/form/samples/amd-id/_config.js b/test/form/samples/amd-id/_config.js index 2fb7c876ffa..25ebcbd5193 100644 --- a/test/form/samples/amd-id/_config.js +++ b/test/form/samples/amd-id/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to declare an AMD id', options: { output: { amd: { id: 'my-id' } } } -}; +}); diff --git a/test/form/samples/amd-keep-extension/_config.js b/test/form/samples/amd-keep-extension/_config.js index f7ada5d8e9b..9076ff7fa96 100644 --- a/test/form/samples/amd-keep-extension/_config.js +++ b/test/form/samples/amd-keep-extension/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'keep extension for AMD modules', options: { external: ['./relative', 'abso/lute', './relative.js', 'abso/lute.js'], output: { amd: { forceJsExtensionForImports: true }, interop: 'default' } } -}; +}); diff --git a/test/form/samples/argument-deoptimization/no-default-deoptimization/_config.js b/test/form/samples/argument-deoptimization/no-default-deoptimization/_config.js index eb89006356d..6d2d48368e9 100644 --- a/test/form/samples/argument-deoptimization/no-default-deoptimization/_config.js +++ b/test/form/samples/argument-deoptimization/no-default-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deoptimize call arguments by default' -}; +}); diff --git a/test/form/samples/argument-deoptimization/no-global-call-deoptimization/_config.js b/test/form/samples/argument-deoptimization/no-global-call-deoptimization/_config.js index acce6a78838..0b2c36660ab 100644 --- a/test/form/samples/argument-deoptimization/no-global-call-deoptimization/_config.js +++ b/test/form/samples/argument-deoptimization/no-global-call-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deoptimize call arguments of calls to globals by default' -}; +}); diff --git a/test/form/samples/argument-deoptimization/return-function-deoptimization/_config.js b/test/form/samples/argument-deoptimization/return-function-deoptimization/_config.js index a62f2917068..111afff1537 100644 --- a/test/form/samples/argument-deoptimization/return-function-deoptimization/_config.js +++ b/test/form/samples/argument-deoptimization/return-function-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deoptimize call arguments of returned functions by default' -}; +}); diff --git a/test/form/samples/array-element-tracking/array-elements/_config.js b/test/form/samples/array-element-tracking/array-elements/_config.js index 46d8f9b2d3d..33a97fb0a9e 100644 --- a/test/form/samples/array-element-tracking/array-elements/_config.js +++ b/test/form/samples/array-element-tracking/array-elements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks elements of arrays' -}; +}); diff --git a/test/form/samples/array-element-tracking/array-mutation/_config.js b/test/form/samples/array-element-tracking/array-mutation/_config.js index 58a8183eebf..65ce34ca346 100644 --- a/test/form/samples/array-element-tracking/array-mutation/_config.js +++ b/test/form/samples/array-element-tracking/array-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of array elements' -}; +}); diff --git a/test/form/samples/array-element-tracking/array-spread/_config.js b/test/form/samples/array-element-tracking/array-spread/_config.js index 57b80f7746f..d29aa6bf18e 100644 --- a/test/form/samples/array-element-tracking/array-spread/_config.js +++ b/test/form/samples/array-element-tracking/array-spread/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks elements of arrays with spread elements' -}; +}); diff --git a/test/form/samples/array-element-tracking/spread-element-deoptimization/_config.js b/test/form/samples/array-element-tracking/spread-element-deoptimization/_config.js index b1ce2636a6d..ad7ae85213c 100644 --- a/test/form/samples/array-element-tracking/spread-element-deoptimization/_config.js +++ b/test/form/samples/array-element-tracking/spread-element-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes array spread elements' -}; +}); diff --git a/test/form/samples/arrow-function-call-parameters/_config.js b/test/form/samples/arrow-function-call-parameters/_config.js index 3ffe2078d48..ced3d3e3a24 100644 --- a/test/form/samples/arrow-function-call-parameters/_config.js +++ b/test/form/samples/arrow-function-call-parameters/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'take actual parameters into account when determining side-effects of calls to arrow functions' -}; +}); diff --git a/test/form/samples/arrow-function-return-values/_config.js b/test/form/samples/arrow-function-return-values/_config.js index ec78acb1bad..81fabffcdd2 100644 --- a/test/form/samples/arrow-function-return-values/_config.js +++ b/test/form/samples/arrow-function-return-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'forwards return values of arrow functions' -}; +}); diff --git a/test/form/samples/assignment-to-array-buffer-view/_config.js b/test/form/samples/assignment-to-array-buffer-view/_config.js index 0984b6ee615..74f502ac83d 100644 --- a/test/form/samples/assignment-to-array-buffer-view/_config.js +++ b/test/form/samples/assignment-to-array-buffer-view/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'assignment to views of buffers should be kept', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/assignment-to-exports-class-declaration/_config.js b/test/form/samples/assignment-to-exports-class-declaration/_config.js index f4e1cb7acbd..512ae789de2 100644 --- a/test/form/samples/assignment-to-exports-class-declaration/_config.js +++ b/test/form/samples/assignment-to-exports-class-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not rewrite class expression IDs', options: { output: { name: 'myModule' } } -}; +}); diff --git a/test/form/samples/assignment-to-exports/_config.js b/test/form/samples/assignment-to-exports/_config.js index 015759bc6cc..548407a86e1 100644 --- a/test/form/samples/assignment-to-exports/_config.js +++ b/test/form/samples/assignment-to-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'declares updated variable in ES output (#755)', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/assignment-to-global/_config.js b/test/form/samples/assignment-to-global/_config.js index c619f9549db..df48d86d200 100644 --- a/test/form/samples/assignment-to-global/_config.js +++ b/test/form/samples/assignment-to-global/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Assignments to global variables should be effects (#1587)' -}; +}); diff --git a/test/form/samples/async-function-effects/_config.js b/test/form/samples/async-function-effects/_config.js index dbb1913efe0..ce3f3de1bb2 100644 --- a/test/form/samples/async-function-effects/_config.js +++ b/test/form/samples/async-function-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks effects when awaiting thenables' -}; +}); diff --git a/test/form/samples/async-function-unused/_config.js b/test/form/samples/async-function-unused/_config.js index 7a2ae9d0a21..d6ec16b8d2e 100644 --- a/test/form/samples/async-function-unused/_config.js +++ b/test/form/samples/async-function-unused/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treeshakes async functions (#492)' -}; +}); diff --git a/test/form/samples/automatic-semicolon-insertion-var/_config.js b/test/form/samples/automatic-semicolon-insertion-var/_config.js index f27e98a2fa0..2b6f0339bfc 100644 --- a/test/form/samples/automatic-semicolon-insertion-var/_config.js +++ b/test/form/samples/automatic-semicolon-insertion-var/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Adds trailing semicolons for modules' -}; +}); diff --git a/test/form/samples/avoid-unnecessary-conditional-deopt/_config.js b/test/form/samples/avoid-unnecessary-conditional-deopt/_config.js index 2c7ad61c32a..4d3ddb9f77f 100644 --- a/test/form/samples/avoid-unnecessary-conditional-deopt/_config.js +++ b/test/form/samples/avoid-unnecessary-conditional-deopt/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids unnecessary deoptimizations of conditional expressions' -}; +}); diff --git a/test/form/samples/banner-and-footer/_config.js b/test/form/samples/banner-and-footer/_config.js index ab91877aba2..157cf9fdf55 100644 --- a/test/form/samples/banner-and-footer/_config.js +++ b/test/form/samples/banner-and-footer/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds a banner/footer', options: { output: { @@ -7,18 +7,21 @@ module.exports = { }, plugins: [ { + name: 'first', banner: '/* first banner */', footer() { return '/* first footer */'; } }, { + name: 'second', banner() { return '/* second banner */'; }, footer: '/* second footer */' }, { + name: 'third', banner() { return Promise.resolve('/* 3rd banner */'); }, @@ -26,4 +29,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/base64-deshadow/_config.js b/test/form/samples/base64-deshadow/_config.js index fec209a69a8..77f1c1e1cf9 100644 --- a/test/form/samples/base64-deshadow/_config.js +++ b/test/form/samples/base64-deshadow/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'base64 deshadowing indices' -}; +}); diff --git a/test/form/samples/big-int/_config.js b/test/form/samples/big-int/_config.js index 2c32390904e..cdd9c242449 100644 --- a/test/form/samples/big-int/_config.js +++ b/test/form/samples/big-int/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports bigint via acorn plugin' -}; +}); diff --git a/test/form/samples/binary-expressions/_config.js b/test/form/samples/binary-expressions/_config.js index 1c861eec011..2e2230aca35 100644 --- a/test/form/samples/binary-expressions/_config.js +++ b/test/form/samples/binary-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles binary expression side-effects' -}; +}); diff --git a/test/form/samples/block-comments/_config.js b/test/form/samples/block-comments/_config.js index f18362ceace..3c5a1b11616 100644 --- a/test/form/samples/block-comments/_config.js +++ b/test/form/samples/block-comments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'block comments are printed correctly' -}; +}); diff --git a/test/form/samples/body-less-for-loops/_config.js b/test/form/samples/body-less-for-loops/_config.js index a748fa03e69..20b681adcf9 100644 --- a/test/form/samples/body-less-for-loops/_config.js +++ b/test/form/samples/body-less-for-loops/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports body-less for loops' -}; +}); diff --git a/test/form/samples/break-control-flow/break-statement-labels-in-loops/_config.js b/test/form/samples/break-control-flow/break-statement-labels-in-loops/_config.js index 08ea0622523..ac0341f1214 100644 --- a/test/form/samples/break-control-flow/break-statement-labels-in-loops/_config.js +++ b/test/form/samples/break-control-flow/break-statement-labels-in-loops/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles breaking to loops inside labeled statements' -}; +}); diff --git a/test/form/samples/break-control-flow/break-statement-labels-switch/_config.js b/test/form/samples/break-control-flow/break-statement-labels-switch/_config.js index ffce5a641d6..76f7dbde3c6 100644 --- a/test/form/samples/break-control-flow/break-statement-labels-switch/_config.js +++ b/test/form/samples/break-control-flow/break-statement-labels-switch/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports labels when breaking control flow from a switch statement' -}; +}); diff --git a/test/form/samples/break-control-flow/break-statement-labels/_config.js b/test/form/samples/break-control-flow/break-statement-labels/_config.js index 44fe205431f..7566e972006 100644 --- a/test/form/samples/break-control-flow/break-statement-labels/_config.js +++ b/test/form/samples/break-control-flow/break-statement-labels/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports labels when breaking control flow' -}; +}); diff --git a/test/form/samples/break-control-flow/break-statement-loops/_config.js b/test/form/samples/break-control-flow/break-statement-loops/_config.js index dab03d4632d..d3f588fa7e7 100644 --- a/test/form/samples/break-control-flow/break-statement-loops/_config.js +++ b/test/form/samples/break-control-flow/break-statement-loops/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'breaks control flow when a break statement is encountered inside a loop' -}; +}); diff --git a/test/form/samples/break-control-flow/caught-errors/_config.js b/test/form/samples/break-control-flow/caught-errors/_config.js index 618e294de16..46e851e64fa 100644 --- a/test/form/samples/break-control-flow/caught-errors/_config.js +++ b/test/form/samples/break-control-flow/caught-errors/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'breaks control flow when an error is thrown inside a catch block', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/form/samples/break-control-flow/hoisted-declarations/_config.js b/test/form/samples/break-control-flow/hoisted-declarations/_config.js index 6fddb43932a..c6cd817604f 100644 --- a/test/form/samples/break-control-flow/hoisted-declarations/_config.js +++ b/test/form/samples/break-control-flow/hoisted-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes hoisted declarations when control flow is broken' -}; +}); diff --git a/test/form/samples/break-control-flow/if-statement-breaks/_config.js b/test/form/samples/break-control-flow/if-statement-breaks/_config.js index 642237e7aa8..7324bb6a309 100644 --- a/test/form/samples/break-control-flow/if-statement-breaks/_config.js +++ b/test/form/samples/break-control-flow/if-statement-breaks/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles conditionally broken execution' -}; +}); diff --git a/test/form/samples/break-control-flow/if-statement-errors/_config.js b/test/form/samples/break-control-flow/if-statement-errors/_config.js index 5b83386fecd..8a2b54134e0 100644 --- a/test/form/samples/break-control-flow/if-statement-errors/_config.js +++ b/test/form/samples/break-control-flow/if-statement-errors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles conditionally thrown errors' -}; +}); diff --git a/test/form/samples/break-control-flow/loop-errors/_config.js b/test/form/samples/break-control-flow/loop-errors/_config.js index bd5c24a0782..567b4e9ac85 100644 --- a/test/form/samples/break-control-flow/loop-errors/_config.js +++ b/test/form/samples/break-control-flow/loop-errors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not break flow from inside loops that may not have executed' -}; +}); diff --git a/test/form/samples/break-control-flow/return-statements/_config.js b/test/form/samples/break-control-flow/return-statements/_config.js index f5f2cb40612..b7b18f5f469 100644 --- a/test/form/samples/break-control-flow/return-statements/_config.js +++ b/test/form/samples/break-control-flow/return-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'breaks control flow when a return statement is encountered' -}; +}); diff --git a/test/form/samples/break-control-flow/switch-errors/_config.js b/test/form/samples/break-control-flow/switch-errors/_config.js index 441dcd44f44..23da799b6ed 100644 --- a/test/form/samples/break-control-flow/switch-errors/_config.js +++ b/test/form/samples/break-control-flow/switch-errors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles errors in switch statements' -}; +}); diff --git a/test/form/samples/break-control-flow/thrown-errors/_config.js b/test/form/samples/break-control-flow/thrown-errors/_config.js index 6ce1e181f39..8f3eda10b57 100644 --- a/test/form/samples/break-control-flow/thrown-errors/_config.js +++ b/test/form/samples/break-control-flow/thrown-errors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'breaks control flow when an error is thrown' -}; +}); diff --git a/test/form/samples/builtin-prototypes/array-expression/_config.js b/test/form/samples/builtin-prototypes/array-expression/_config.js index c18d1c7f176..5649d4c8cae 100644 --- a/test/form/samples/builtin-prototypes/array-expression/_config.js +++ b/test/form/samples/builtin-prototypes/array-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Tree-shake known array prototype functions' -}; +}); diff --git a/test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_config.js b/test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_config.js index 6001c39d55d..98135a3c698 100644 --- a/test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_config.js +++ b/test/form/samples/builtin-prototypes/check-tree-shake-on-regexp-if-it-is-used/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'check tree-shake on RegExp if it is used' -}; +}); diff --git a/test/form/samples/builtin-prototypes/literal/_config.js b/test/form/samples/builtin-prototypes/literal/_config.js index e137067cf34..24ca1bdb44a 100644 --- a/test/form/samples/builtin-prototypes/literal/_config.js +++ b/test/form/samples/builtin-prototypes/literal/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Tree-shake known literal prototype functions' -}; +}); diff --git a/test/form/samples/builtin-prototypes/object-expression/_config.js b/test/form/samples/builtin-prototypes/object-expression/_config.js index dae66a24375..8f33ba0787f 100644 --- a/test/form/samples/builtin-prototypes/object-expression/_config.js +++ b/test/form/samples/builtin-prototypes/object-expression/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Tree-shake known object prototype functions', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/builtin-prototypes/side-effect-free-array-expression/_config.js b/test/form/samples/builtin-prototypes/side-effect-free-array-expression/_config.js index 1b91707852b..277135ac8b1 100644 --- a/test/form/samples/builtin-prototypes/side-effect-free-array-expression/_config.js +++ b/test/form/samples/builtin-prototypes/side-effect-free-array-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Tree-shakes side-effect-free array functions if only their return value is unused' -}; +}); diff --git a/test/form/samples/builtin-prototypes/template-literal/_config.js b/test/form/samples/builtin-prototypes/template-literal/_config.js index 5884ca08844..297cb8bb116 100644 --- a/test/form/samples/builtin-prototypes/template-literal/_config.js +++ b/test/form/samples/builtin-prototypes/template-literal/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Tree-shake known string template literal prototype functions' -}; +}); diff --git a/test/form/samples/catch-parameter-shadowing/_config.js b/test/form/samples/catch-parameter-shadowing/_config.js index 9de0f865dcd..8a5be57bcbf 100644 --- a/test/form/samples/catch-parameter-shadowing/_config.js +++ b/test/form/samples/catch-parameter-shadowing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'the parameter of a catch block should correctly shadow an import (#1391)', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/chained-assignments/_config.js b/test/form/samples/chained-assignments/_config.js index ddbf4e78e64..3711528c63b 100644 --- a/test/form/samples/chained-assignments/_config.js +++ b/test/form/samples/chained-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treeshakes chained assignments' -}; +}); diff --git a/test/form/samples/circular-member-expression/_config.js b/test/form/samples/circular-member-expression/_config.js index 119556fc1d2..4041b64baa4 100644 --- a/test/form/samples/circular-member-expression/_config.js +++ b/test/form/samples/circular-member-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'circular member expression' -}; +}); diff --git a/test/form/samples/class-constructor-side-effect/_config.js b/test/form/samples/class-constructor-side-effect/_config.js index 5c8a4a09e2c..92a7c200ed6 100644 --- a/test/form/samples/class-constructor-side-effect/_config.js +++ b/test/form/samples/class-constructor-side-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves side-effects in a class constructor (#1233)' -}; +}); diff --git a/test/form/samples/class-fields/_config.js b/test/form/samples/class-fields/_config.js index cacf9cc3917..ca98033f2c7 100644 --- a/test/form/samples/class-fields/_config.js +++ b/test/form/samples/class-fields/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports class fields' -}; +}); diff --git a/test/form/samples/class-method-access/_config.js b/test/form/samples/class-method-access/_config.js index d44dede48ae..c0005ee1516 100644 --- a/test/form/samples/class-method-access/_config.js +++ b/test/form/samples/class-method-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks side-effects when accessing class methods' -}; +}); diff --git a/test/form/samples/class-static-initialization-block/_config.js b/test/form/samples/class-static-initialization-block/_config.js index 97b51e58a07..1a4a4fd8972 100644 --- a/test/form/samples/class-static-initialization-block/_config.js +++ b/test/form/samples/class-static-initialization-block/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports class static initialization blocks' -}; +}); diff --git a/test/form/samples/class-without-new/_config.js b/test/form/samples/class-without-new/_config.js index db77abbdd9e..ca7d246380e 100644 --- a/test/form/samples/class-without-new/_config.js +++ b/test/form/samples/class-without-new/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'instantiating a class without "new" is a side-effect' -}; +}); diff --git a/test/form/samples/comment-before-import/_config.js b/test/form/samples/comment-before-import/_config.js index 823ac6379a3..4dac0737c5f 100644 --- a/test/form/samples/comment-before-import/_config.js +++ b/test/form/samples/comment-before-import/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves comments before imports' -}; +}); diff --git a/test/form/samples/comment-start-inside-comment/_config.js b/test/form/samples/comment-start-inside-comment/_config.js index 29086152e27..fba7e976cad 100644 --- a/test/form/samples/comment-start-inside-comment/_config.js +++ b/test/form/samples/comment-start-inside-comment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly remove coments above import statements' -}; +}); diff --git a/test/form/samples/compact-empty-external/_config.js b/test/form/samples/compact-empty-external/_config.js index d27624aaa2a..5ddc7cd7bf9 100644 --- a/test/form/samples/compact-empty-external/_config.js +++ b/test/form/samples/compact-empty-external/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles empty external imports in compact mode', options: { external: ['external'], @@ -6,4 +6,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/form/samples/compact-multiple-imports/_config.js b/test/form/samples/compact-multiple-imports/_config.js index 83042b1631c..f3cc88b91ea 100644 --- a/test/form/samples/compact-multiple-imports/_config.js +++ b/test/form/samples/compact-multiple-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles empty external imports in compact mode', options: { external(id) { @@ -12,4 +12,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/form/samples/compact-named-export/_config.js b/test/form/samples/compact-named-export/_config.js index 2b3a4cf92f8..602a6480c76 100644 --- a/test/form/samples/compact-named-export/_config.js +++ b/test/form/samples/compact-named-export/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly handles named export live bindings in compact mode', options: { output: { @@ -6,4 +6,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/form/samples/compact/_config.js b/test/form/samples/compact/_config.js index 084e647223d..bb9b84a67e8 100644 --- a/test/form/samples/compact/_config.js +++ b/test/form/samples/compact/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports compact output with compact: true', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/computed-member-expression-assignments/_config.js b/test/form/samples/computed-member-expression-assignments/_config.js index 28124ab2672..6ad78ce80a4 100644 --- a/test/form/samples/computed-member-expression-assignments/_config.js +++ b/test/form/samples/computed-member-expression-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detect side-effects in assignments involving computed members' -}; +}); diff --git a/test/form/samples/computed-properties/_config.js b/test/form/samples/computed-properties/_config.js index f71657f27d2..8319b816557 100644 --- a/test/form/samples/computed-properties/_config.js +++ b/test/form/samples/computed-properties/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'computed property keys include declarations of referenced identifiers', options: { output: { name: 'computedProperties' } } -}; +}); diff --git a/test/form/samples/conditional-expression-deopzimize-while-included/_config.js b/test/form/samples/conditional-expression-deopzimize-while-included/_config.js index 343a9689d60..aba539b2fdb 100644 --- a/test/form/samples/conditional-expression-deopzimize-while-included/_config.js +++ b/test/form/samples/conditional-expression-deopzimize-while-included/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimizations of logical expression while they are inlcuded (#3324)' -}; +}); diff --git a/test/form/samples/conditional-expression-paths/_config.js b/test/form/samples/conditional-expression-paths/_config.js index aadb52f877d..b712273200b 100644 --- a/test/form/samples/conditional-expression-paths/_config.js +++ b/test/form/samples/conditional-expression-paths/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only retain branches with side-effects' -}; +}); diff --git a/test/form/samples/conditional-expression/_config.js b/test/form/samples/conditional-expression/_config.js index aadb52f877d..b712273200b 100644 --- a/test/form/samples/conditional-expression/_config.js +++ b/test/form/samples/conditional-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only retain branches with side-effects' -}; +}); diff --git a/test/form/samples/conditional-put-parens-around-sequence/_config.js b/test/form/samples/conditional-put-parens-around-sequence/_config.js index a040c92d6de..78ba85bf809 100644 --- a/test/form/samples/conditional-put-parens-around-sequence/_config.js +++ b/test/form/samples/conditional-put-parens-around-sequence/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'put parens around sequences if conditional simplified (#1311)' -}; +}); diff --git a/test/form/samples/configure-file-url/_config.js b/test/form/samples/configure-file-url/_config.js index 10db41d3835..9be0556b22e 100644 --- a/test/form/samples/configure-file-url/_config.js +++ b/test/form/samples/configure-file-url/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure file urls', options: { plugins: [ { + name: 'first', resolveId(id) { if (id.endsWith('solved')) { return id; @@ -32,6 +33,7 @@ module.exports = { } }, { + name: 'second', resolveFileUrl({ moduleId }) { if (moduleId === 'resolved') { return `'resolved'`; @@ -41,4 +43,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/conflicting-imports/_config.js b/test/form/samples/conflicting-imports/_config.js index 3c157f5752f..cf75f094f0b 100644 --- a/test/form/samples/conflicting-imports/_config.js +++ b/test/form/samples/conflicting-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'ensures bundle imports are deconflicted (#659)', options: { external: ['foo', 'bar'], @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/curried-function/_config.js b/test/form/samples/curried-function/_config.js index 8b932f491dd..63ce038bce0 100644 --- a/test/form/samples/curried-function/_config.js +++ b/test/form/samples/curried-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly handles a curried function' -}; +}); diff --git a/test/form/samples/custom-context/_config.js b/test/form/samples/custom-context/_config.js index 84f2dbd814e..02b233fe3a7 100644 --- a/test/form/samples/custom-context/_config.js +++ b/test/form/samples/custom-context/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allows custom context', options: { context: `lolwut` } -}; +}); diff --git a/test/form/samples/custom-dynamic-import-no-interop/_config.js b/test/form/samples/custom-dynamic-import-no-interop/_config.js index e381fb736ea..910798c4de3 100644 --- a/test/form/samples/custom-dynamic-import-no-interop/_config.js +++ b/test/form/samples/custom-dynamic-import-no-interop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not add any interop when using a custom dynamic import handler', options: { external: 'external', @@ -6,9 +6,10 @@ module.exports = { interop: 'auto' }, plugins: { + name: 'test', renderDynamicImport() { return { left: 'getIt(', right: ')' }; } } } -}; +}); diff --git a/test/form/samples/custom-module-context-function/_config.js b/test/form/samples/custom-module-context-function/_config.js index c10efdfacbe..e0b7153fb0c 100644 --- a/test/form/samples/custom-module-context-function/_config.js +++ b/test/form/samples/custom-module-context-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows custom module-specific context with a function option', expectedWarnings: ['THIS_IS_UNDEFINED'], options: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/custom-module-context/_config.js b/test/form/samples/custom-module-context/_config.js index 8b5dd23cbfb..d34d646df5d 100644 --- a/test/form/samples/custom-module-context/_config.js +++ b/test/form/samples/custom-module-context/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows custom module-specific context', expectedWarnings: ['THIS_IS_UNDEFINED'], options: { @@ -6,4 +6,4 @@ module.exports = { 'main.js': 'lolwut' } } -}; +}); diff --git a/test/form/samples/declarations-with-side-effects/_config.js b/test/form/samples/declarations-with-side-effects/_config.js index ac63c345d62..8905efcd41f 100644 --- a/test/form/samples/declarations-with-side-effects/_config.js +++ b/test/form/samples/declarations-with-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side-effects in declarations will tree-shaking the declared variable' -}; +}); diff --git a/test/form/samples/deconflict-format-specific-exports/_config.js b/test/form/samples/deconflict-format-specific-exports/_config.js index 3618b693baf..6603d8c137f 100644 --- a/test/form/samples/deconflict-format-specific-exports/_config.js +++ b/test/form/samples/deconflict-format-specific-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'only deconflict "exports" for formats where it is necessary', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/deconflict-format-specific-globals/_config.js b/test/form/samples/deconflict-format-specific-globals/_config.js index 8b57b4a0a45..fd70960bc55 100644 --- a/test/form/samples/deconflict-format-specific-globals/_config.js +++ b/test/form/samples/deconflict-format-specific-globals/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts format specific globals', options: { external: 'external', @@ -9,4 +9,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/deconflict-module-priority/_config.js b/test/form/samples/deconflict-module-priority/_config.js index 5ea1e7a90a8..e19c23a79b9 100644 --- a/test/form/samples/deconflict-module-priority/_config.js +++ b/test/form/samples/deconflict-module-priority/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'prioritizes entry modules over dependencies when deconflicting' -}; +}); diff --git a/test/form/samples/deconflict-nested-tree-shaking/_config.js b/test/form/samples/deconflict-nested-tree-shaking/_config.js index f423de7c702..c9c747df289 100644 --- a/test/form/samples/deconflict-nested-tree-shaking/_config.js +++ b/test/form/samples/deconflict-nested-tree-shaking/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not consider nested tree-shaken variables when deconflicting' -}; +}); diff --git a/test/form/samples/deconflict-tree-shaken-globals/_config.js b/test/form/samples/deconflict-tree-shaken-globals/_config.js index 233206fcd76..d1f174625b8 100644 --- a/test/form/samples/deconflict-tree-shaken-globals/_config.js +++ b/test/form/samples/deconflict-tree-shaken-globals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deconflict due to tree-shaken global variables' -}; +}); diff --git a/test/form/samples/deconflict-tree-shaken/_config.js b/test/form/samples/deconflict-tree-shaken/_config.js index 96c6ef18178..2fab7e1bb32 100644 --- a/test/form/samples/deconflict-tree-shaken/_config.js +++ b/test/form/samples/deconflict-tree-shaken/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not consider tree-shaken variables when deconflicting' -}; +}); diff --git a/test/form/samples/dedupes-external-imports/_config.js b/test/form/samples/dedupes-external-imports/_config.js index 937ee5ed574..2827740b09e 100644 --- a/test/form/samples/dedupes-external-imports/_config.js +++ b/test/form/samples/dedupes-external-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'dedupes external imports', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/deep-properties-access/_config.js b/test/form/samples/deep-properties-access/_config.js index e71a93b8870..7b4d8d4a237 100644 --- a/test/form/samples/deep-properties-access/_config.js +++ b/test/form/samples/deep-properties-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deeply nested property accesses' -}; +}); diff --git a/test/form/samples/deep-properties/_config.js b/test/form/samples/deep-properties/_config.js index e721c6711ce..57dc036e406 100644 --- a/test/form/samples/deep-properties/_config.js +++ b/test/form/samples/deep-properties/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deeply nested properties', options: { treeshake: { propertyReadSideEffects: false } } -}; +}); diff --git a/test/form/samples/deep-switch-declarations/_config.js b/test/form/samples/deep-switch-declarations/_config.js index 1487e3c6852..889608337ff 100644 --- a/test/form/samples/deep-switch-declarations/_config.js +++ b/test/form/samples/deep-switch-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles hoisted declarations in deeply nested switch statements' -}; +}); diff --git a/test/form/samples/default-export-anonymous-class-extends/_config.js b/test/form/samples/default-export-anonymous-class-extends/_config.js index 2ed4457e53c..090c96a8f59 100644 --- a/test/form/samples/default-export-anonymous-class-extends/_config.js +++ b/test/form/samples/default-export-anonymous-class-extends/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default exported classes extending a regular expression argument (#4783)' -}; +}); diff --git a/test/form/samples/default-export-class/_config.js b/test/form/samples/default-export-class/_config.js index 0d37406db4c..b665d6b7bfb 100644 --- a/test/form/samples/default-export-class/_config.js +++ b/test/form/samples/default-export-class/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'puts the export after the declaration for default exported classes in SystemJS', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/default-export-live-binding/_config.js b/test/form/samples/default-export-live-binding/_config.js index 47ad69ccce6..123b4620673 100644 --- a/test/form/samples/default-export-live-binding/_config.js +++ b/test/form/samples/default-export-live-binding/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allows live bindings for default exports', options: { output: { exports: 'named', name: 'bundle' } } -}; +}); diff --git a/test/form/samples/default-export-mode/_config.js b/test/form/samples/default-export-mode/_config.js index bc4638b956c..c3e9935ba77 100644 --- a/test/form/samples/default-export-mode/_config.js +++ b/test/form/samples/default-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows specifying the export mode to be "default"', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/default-identifier-deshadowing/_config.js b/test/form/samples/default-identifier-deshadowing/_config.js index 0b3f4bc1169..ed2c7173d11 100644 --- a/test/form/samples/default-identifier-deshadowing/_config.js +++ b/test/form/samples/default-identifier-deshadowing/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Handles export default identifier reassignment deshadowing' -}; +}); diff --git a/test/form/samples/define-es-modules-false/_config.js b/test/form/samples/define-es-modules-false/_config.js index 1d0b8ca8fbb..332ff8fb294 100644 --- a/test/form/samples/define-es-modules-false/_config.js +++ b/test/form/samples/define-es-modules-false/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Not add __esModule property to exports with esModule: false', options: { output: { name: 'foo', esModule: false } } -}; +}); diff --git a/test/form/samples/define-replacement/_config.js b/test/form/samples/define-replacement/_config.js index f9a9a68462f..6920038fcff 100644 --- a/test/form/samples/define-replacement/_config.js +++ b/test/form/samples/define-replacement/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'amd.define', options: { output: { amd: { define: 'enifed' } } } -}; +}); diff --git a/test/form/samples/deopt-regexp-type/_config.js b/test/form/samples/deopt-regexp-type/_config.js index 18ccd606be5..5745d07af27 100644 --- a/test/form/samples/deopt-regexp-type/_config.js +++ b/test/form/samples/deopt-regexp-type/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes typeof for regular expressions to better support es6-sim' -}; +}); diff --git a/test/form/samples/deopt-string-concatenation/_config.js b/test/form/samples/deopt-string-concatenation/_config.js index 36697ba2394..1326c114d68 100644 --- a/test/form/samples/deopt-string-concatenation/_config.js +++ b/test/form/samples/deopt-string-concatenation/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimize concatenation when used as an expression statement to better support es5-shim' -}; +}); diff --git a/test/form/samples/deoptimize-superclass/_config.js b/test/form/samples/deoptimize-superclass/_config.js index 584b0fc8c1a..de245c1cb5b 100644 --- a/test/form/samples/deoptimize-superclass/_config.js +++ b/test/form/samples/deoptimize-superclass/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not deoptimize the entire superclass when reassigning a property' -}; +}); diff --git a/test/form/samples/deoptimize-var-in-hoisted-scopes/_config.js b/test/form/samples/deoptimize-var-in-hoisted-scopes/_config.js index f4724f855fb..47826267e90 100644 --- a/test/form/samples/deoptimize-var-in-hoisted-scopes/_config.js +++ b/test/form/samples/deoptimize-var-in-hoisted-scopes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes var variables in hoisted scopes' -}; +}); diff --git a/test/form/samples/deprecated/dynamic-import-inlining-array/_config.js b/test/form/samples/deprecated/dynamic-import-inlining-array/_config.js index 8b750ef3779..dcdb14a779d 100644 --- a/test/form/samples/deprecated/dynamic-import-inlining-array/_config.js +++ b/test/form/samples/deprecated/dynamic-import-inlining-array/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports an array with a single entry when inlining dynamic imports', options: { strictDeprecations: false, @@ -6,4 +6,4 @@ module.exports = { input: ['main'] }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/dynamic-import-inlining/_config.js b/test/form/samples/deprecated/dynamic-import-inlining/_config.js index 5534cc63a4d..1c08b44c215 100644 --- a/test/form/samples/deprecated/dynamic-import-inlining/_config.js +++ b/test/form/samples/deprecated/dynamic-import-inlining/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'dynamic import inlining', options: { strictDeprecations: false, inlineDynamicImports: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/inlined-treeshaken-dynamic-import/_config.js b/test/form/samples/deprecated/inlined-treeshaken-dynamic-import/_config.js index c985d42f87a..bd9972fd9c2 100644 --- a/test/form/samples/deprecated/inlined-treeshaken-dynamic-import/_config.js +++ b/test/form/samples/deprecated/inlined-treeshaken-dynamic-import/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'completely removes tree-shaken dynamic imports ', options: { strictDeprecations: false, inlineDynamicImports: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/namespace-tostring/entry-default/_config.js b/test/form/samples/deprecated/namespace-tostring/entry-default/_config.js index 75a69ab246d..9edd41090d8 100644 --- a/test/form/samples/deprecated/namespace-tostring/entry-default/_config.js +++ b/test/form/samples/deprecated/namespace-tostring/entry-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not add Symbol.toStringTag property to entry chunks with default export mode', options: { strictDeprecations: false, @@ -9,4 +9,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/namespace-tostring/entry-named/_config.js b/test/form/samples/deprecated/namespace-tostring/entry-named/_config.js index dd684cbd4a7..fdb9c53e7d2 100644 --- a/test/form/samples/deprecated/namespace-tostring/entry-named/_config.js +++ b/test/form/samples/deprecated/namespace-tostring/entry-named/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to entry chunks with named exports', options: { strictDeprecations: false, @@ -9,4 +9,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/namespace-tostring/external-namespaces/_config.js b/test/form/samples/deprecated/namespace-tostring/external-namespaces/_config.js index 96f894d4437..a0c4e871735 100644 --- a/test/form/samples/deprecated/namespace-tostring/external-namespaces/_config.js +++ b/test/form/samples/deprecated/namespace-tostring/external-namespaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to external namespaces', options: { strictDeprecations: false, @@ -31,4 +31,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/namespace-tostring/inlined-namespace/_config.js b/test/form/samples/deprecated/namespace-tostring/inlined-namespace/_config.js index 82bfcfb95aa..38a04e821a3 100644 --- a/test/form/samples/deprecated/namespace-tostring/inlined-namespace/_config.js +++ b/test/form/samples/deprecated/namespace-tostring/inlined-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to inlined namespaces', options: { strictDeprecations: false, @@ -7,4 +7,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/nested-inlined-dynamic-import/_config.js b/test/form/samples/deprecated/nested-inlined-dynamic-import/_config.js index a6ac9c10407..9b4467d5c71 100644 --- a/test/form/samples/deprecated/nested-inlined-dynamic-import/_config.js +++ b/test/form/samples/deprecated/nested-inlined-dynamic-import/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables when nested dynamic imports are inlined', options: { strictDeprecations: false, inlineDynamicImports: true }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/deprecated/prefer-const/_config.js b/test/form/samples/deprecated/prefer-const/_config.js index e160c9f6e0c..ce844d456a3 100644 --- a/test/form/samples/deprecated/prefer-const/_config.js +++ b/test/form/samples/deprecated/prefer-const/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses const instead of var if specified (#653)', options: { strictDeprecations: false, @@ -10,4 +10,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/duplicated-var-declarations/_config.js b/test/form/samples/duplicated-var-declarations/_config.js index 4c3038c2012..fedf39bb118 100644 --- a/test/form/samples/duplicated-var-declarations/_config.js +++ b/test/form/samples/duplicated-var-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not remove duplicated var declarations (#716)' -}; +}); diff --git a/test/form/samples/dynamic-import-inlining-array/_config.js b/test/form/samples/dynamic-import-inlining-array/_config.js index 81ad9e51008..dec5250f526 100644 --- a/test/form/samples/dynamic-import-inlining-array/_config.js +++ b/test/form/samples/dynamic-import-inlining-array/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'supports an array with a single entry when inlining dynamic imports', options: { output: { inlineDynamicImports: true }, input: ['main'] } -}; +}); diff --git a/test/form/samples/dynamic-import-inlining/_config.js b/test/form/samples/dynamic-import-inlining/_config.js index 7e80cf62b7f..044e3ad0dad 100644 --- a/test/form/samples/dynamic-import-inlining/_config.js +++ b/test/form/samples/dynamic-import-inlining/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'dynamic import inlining', options: { output: { inlineDynamicImports: true } } -}; +}); diff --git a/test/form/samples/dynamic-import-this-arrow/_config.js b/test/form/samples/dynamic-import-this-arrow/_config.js index 2a4145afc99..8a8f67ad5aa 100644 --- a/test/form/samples/dynamic-import-this-arrow/_config.js +++ b/test/form/samples/dynamic-import-this-arrow/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct "this" in dynamic imports when using arrow functions', options: { external: ['input', 'output'], @@ -8,4 +8,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/dynamic-import-this-function/_config.js b/test/form/samples/dynamic-import-this-function/_config.js index 53feb9f5913..2fb7f917a47 100644 --- a/test/form/samples/dynamic-import-this-function/_config.js +++ b/test/form/samples/dynamic-import-this-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct "this" in dynamic imports when not using arrow functions', options: { external: ['input', 'output'], @@ -8,4 +8,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/dynamic-import-unresolvable/_config.js b/test/form/samples/dynamic-import-unresolvable/_config.js index 09f630f35c4..ed910b7c271 100644 --- a/test/form/samples/dynamic-import-unresolvable/_config.js +++ b/test/form/samples/dynamic-import-unresolvable/_config.js @@ -1,16 +1,19 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Returns the raw AST nodes for unresolvable dynamic imports', options: { plugins: [ { + name: 'test', resolveDynamicImport(specifier) { if (specifier === './seven.js') { return false; } assert.ok(specifier); - assert.strictEqual(typeof specifier, 'object'); + if (typeof specifier !== 'object') { + throw new TypeError(`Unexpected specifier type ${typeof specifier}.`); + } if (specifier.type === 'Literal') { return "'./seven.js'"; } @@ -22,4 +25,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/dynamic-resolvable-if-statements/_config.js b/test/form/samples/dynamic-resolvable-if-statements/_config.js index d091bcf95d1..5e014dd0e7e 100644 --- a/test/form/samples/dynamic-resolvable-if-statements/_config.js +++ b/test/form/samples/dynamic-resolvable-if-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows using variables to resolve conditionals' -}; +}); diff --git a/test/form/samples/early-bind-member-expressions/_config.js b/test/form/samples/early-bind-member-expressions/_config.js index bfd03baa8d6..8a6ee776cdf 100644 --- a/test/form/samples/early-bind-member-expressions/_config.js +++ b/test/form/samples/early-bind-member-expressions/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves namespace members when accessed early (#2895)', options: { external: 'external' } -}; +}); diff --git a/test/form/samples/effect-in-for-of-loop-in-functions/_config.js b/test/form/samples/effect-in-for-of-loop-in-functions/_config.js index 0e80a63f4a0..6077ac42d3a 100644 --- a/test/form/samples/effect-in-for-of-loop-in-functions/_config.js +++ b/test/form/samples/effect-in-for-of-loop-in-functions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes effects in for-of loop (#870)' -}; +}); diff --git a/test/form/samples/effect-in-for-of-loop/_config.js b/test/form/samples/effect-in-for-of-loop/_config.js index 0e80a63f4a0..6077ac42d3a 100644 --- a/test/form/samples/effect-in-for-of-loop/_config.js +++ b/test/form/samples/effect-in-for-of-loop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes effects in for-of loop (#870)' -}; +}); diff --git a/test/form/samples/emit-asset-file/_config.js b/test/form/samples/emit-asset-file/_config.js index a5a62467143..8086990f79a 100644 --- a/test/form/samples/emit-asset-file/_config.js +++ b/test/form/samples/emit-asset-file/_config.js @@ -2,10 +2,11 @@ const assert = require('node:assert'); const { readFileSync } = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'supports emitting assets from plugin hooks', options: { plugins: { + name: 'test', resolveId(id, importee) { if (id.endsWith('.svg')) { return path.resolve(path.dirname(importee), id); @@ -26,13 +27,17 @@ module.exports = { assert.strictEqual(keys[0], 'assets/logo-a2a2cdc4.svg'); const asset = outputBundle[keys[0]]; assert.strictEqual(asset.fileName, 'assets/logo-a2a2cdc4.svg'); - assert.strictEqual(asset.type, 'asset'); + if (asset.type !== 'asset') { + throw new Error(`Unexpected asset type ${asset.type}.`); + } + /** @type {any} */ + const source = asset.source; assert.ok( - asset.source.equals(readFileSync(path.resolve(__dirname, 'logo.svg'))), + source.equals(readFileSync(path.resolve(__dirname, 'logo.svg'))), 'asset has correct source' ); assert.ok(keys[1].endsWith('.js'), `${keys[1]} ends with ".js"`); } } } -}; +}); diff --git a/test/form/samples/emit-file-tree-shaken-access/_config.js b/test/form/samples/emit-file-tree-shaken-access/_config.js index d3ed68a0676..124940e7891 100644 --- a/test/form/samples/emit-file-tree-shaken-access/_config.js +++ b/test/form/samples/emit-file-tree-shaken-access/_config.js @@ -1,10 +1,11 @@ const { readFileSync } = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'does not include format globals when tree-shaking an asset access', options: { plugins: { + name: 'test', resolveId(id, importee) { if (id.endsWith('.svg')) { return path.resolve(path.dirname(importee), id); @@ -21,4 +22,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/emit-uint8array-no-buffer/_config.js b/test/form/samples/emit-uint8array-no-buffer/_config.js index 60408dfb305..bdce9965b94 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_config.js +++ b/test/form/samples/emit-uint8array-no-buffer/_config.js @@ -1,6 +1,6 @@ const Buffer = global.Buffer; -module.exports = { +module.exports = defineTest({ description: 'supports emitting assets as Uint8Arrays when Buffer is not available', before() { delete global.Buffer; @@ -10,6 +10,7 @@ module.exports = { }, options: { plugins: { + name: 'test', resolveId(id) { if (id.startsWith('asset')) { return id; @@ -25,4 +26,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/empty-block-statement/_config.js b/test/form/samples/empty-block-statement/_config.js index 283b0b6931b..3915a619d31 100644 --- a/test/form/samples/empty-block-statement/_config.js +++ b/test/form/samples/empty-block-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty block statement' -}; +}); diff --git a/test/form/samples/empty-do-while-statement/_config.js b/test/form/samples/empty-do-while-statement/_config.js index 00672ede4ed..6fd27ba3009 100644 --- a/test/form/samples/empty-do-while-statement/_config.js +++ b/test/form/samples/empty-do-while-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty do-while statement' -}; +}); diff --git a/test/form/samples/empty-for-in-statement/_config.js b/test/form/samples/empty-for-in-statement/_config.js index b95837c9a9f..93cd18efe18 100644 --- a/test/form/samples/empty-for-in-statement/_config.js +++ b/test/form/samples/empty-for-in-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty for-in statement' -}; +}); diff --git a/test/form/samples/empty-for-statement/_config.js b/test/form/samples/empty-for-statement/_config.js index f448ddf8e8b..abbbce82750 100644 --- a/test/form/samples/empty-for-statement/_config.js +++ b/test/form/samples/empty-for-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty for statement' -}; +}); diff --git a/test/form/samples/empty-if-statement/_config.js b/test/form/samples/empty-if-statement/_config.js index abea88980c5..bb36f917a7f 100644 --- a/test/form/samples/empty-if-statement/_config.js +++ b/test/form/samples/empty-if-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty if statement' -}; +}); diff --git a/test/form/samples/empty-statement-consequent/_config.js b/test/form/samples/empty-statement-consequent/_config.js index dc10538fbfb..77b0e7eb8dc 100644 --- a/test/form/samples/empty-statement-consequent/_config.js +++ b/test/form/samples/empty-statement-consequent/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves empty statements used as the consequent of conditionals' -}; +}); diff --git a/test/form/samples/empty-statement/_config.js b/test/form/samples/empty-statement/_config.js index 76e4fa332b4..a69a0d88686 100644 --- a/test/form/samples/empty-statement/_config.js +++ b/test/form/samples/empty-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty statement' -}; +}); diff --git a/test/form/samples/empty-switch-statement/_config.js b/test/form/samples/empty-switch-statement/_config.js index 29c051733d4..a77fbe2b87a 100644 --- a/test/form/samples/empty-switch-statement/_config.js +++ b/test/form/samples/empty-switch-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty switch statement' -}; +}); diff --git a/test/form/samples/empty-try-catch-statement/_config.js b/test/form/samples/empty-try-catch-statement/_config.js index 70bf6529913..577d6d3cb00 100644 --- a/test/form/samples/empty-try-catch-statement/_config.js +++ b/test/form/samples/empty-try-catch-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty try-catch-finally statement' -}; +}); diff --git a/test/form/samples/empty-while-statement/_config.js b/test/form/samples/empty-while-statement/_config.js index 8db2e7f8646..52b112ee82f 100644 --- a/test/form/samples/empty-while-statement/_config.js +++ b/test/form/samples/empty-while-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes an empty while statement' -}; +}); diff --git a/test/form/samples/enforce-addon-order/_config.js b/test/form/samples/enforce-addon-order/_config.js index 0814c90772b..878479c6e9b 100644 --- a/test/form/samples/enforce-addon-order/_config.js +++ b/test/form/samples/enforce-addon-order/_config.js @@ -24,9 +24,9 @@ function addPlugin(order) { plugins.push(plugin, stringPlugin); } -module.exports = { +module.exports = defineTest({ description: 'allows to enforce addon order', options: { plugins } -}; +}); diff --git a/test/form/samples/entry-with-unused-synthetic-exports/_config.js b/test/form/samples/entry-with-unused-synthetic-exports/_config.js index 00f9a60009b..67dd54b20a7 100644 --- a/test/form/samples/entry-with-unused-synthetic-exports/_config.js +++ b/test/form/samples/entry-with-unused-synthetic-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not include unused synthetic namespace object in entry points', options: { plugins: { @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/erroneous-nested-member-expression/_config.js b/test/form/samples/erroneous-nested-member-expression/_config.js index 684fe7cc0b8..c9540eb7aae 100644 --- a/test/form/samples/erroneous-nested-member-expression/_config.js +++ b/test/form/samples/erroneous-nested-member-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'erroneous nested member expression does not mess up naming' -}; +}); diff --git a/test/form/samples/exclude-unnecessary-modifications/_config.js b/test/form/samples/exclude-unnecessary-modifications/_config.js index 2b3de2b830a..15de81719c5 100644 --- a/test/form/samples/exclude-unnecessary-modifications/_config.js +++ b/test/form/samples/exclude-unnecessary-modifications/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'statements that modify definitions within unused functions are excluded' -}; +}); diff --git a/test/form/samples/exponentiation-operator/_config.js b/test/form/samples/exponentiation-operator/_config.js index 34bf4b764f9..ebbd034ae75 100644 --- a/test/form/samples/exponentiation-operator/_config.js +++ b/test/form/samples/exponentiation-operator/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'folds exponentiation operator when considering dead code' -}; +}); diff --git a/test/form/samples/export-all-before-named/_config.js b/test/form/samples/export-all-before-named/_config.js index b84d76b6669..91f7f20ccb1 100644 --- a/test/form/samples/export-all-before-named/_config.js +++ b/test/form/samples/export-all-before-named/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external `export *` must not interfere with internal exports', options: { output: { @@ -7,4 +7,4 @@ module.exports = { }, external: ['external'] } -}; +}); diff --git a/test/form/samples/export-all-from-internal/_config.js b/test/form/samples/export-all-from-internal/_config.js index da1154dcb29..a60e721b826 100644 --- a/test/form/samples/export-all-from-internal/_config.js +++ b/test/form/samples/export-all-from-internal/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'should be able to export * from the bundle', options: { output: { name: 'exposedInternals' } } -}; +}); diff --git a/test/form/samples/export-all-multiple/_config.js b/test/form/samples/export-all-multiple/_config.js index e66c29bacbc..7c70deaae7b 100644 --- a/test/form/samples/export-all-multiple/_config.js +++ b/test/form/samples/export-all-multiple/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles multiple export * declarations (#1252)', options: { external: ['foo', 'bar', 'baz'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-default-2/_config.js b/test/form/samples/export-default-2/_config.js index 76310657af8..8675d82dd4c 100644 --- a/test/form/samples/export-default-2/_config.js +++ b/test/form/samples/export-default-2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exporting a default export', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-default-3/_config.js b/test/form/samples/export-default-3/_config.js index 76310657af8..8675d82dd4c 100644 --- a/test/form/samples/export-default-3/_config.js +++ b/test/form/samples/export-default-3/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exporting a default export', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-default-4/_config.js b/test/form/samples/export-default-4/_config.js index a3d71b3ae40..17be4468792 100644 --- a/test/form/samples/export-default-4/_config.js +++ b/test/form/samples/export-default-4/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'single default export in deep namespace', options: { output: { name: 'my.global.namespace' } } -}; +}); diff --git a/test/form/samples/export-default-anonymous-declarations/_config.js b/test/form/samples/export-default-anonymous-declarations/_config.js index 954cb9097f7..416f8b5ae28 100644 --- a/test/form/samples/export-default-anonymous-declarations/_config.js +++ b/test/form/samples/export-default-anonymous-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'export default [Declaration] with spaces and comments' -}; +}); diff --git a/test/form/samples/export-default-global/_config.js b/test/form/samples/export-default-global/_config.js index aa46da8cf0b..63a2bb092df 100644 --- a/test/form/samples/export-default-global/_config.js +++ b/test/form/samples/export-default-global/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default exporting global variables', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/export-default-import/_config.js b/test/form/samples/export-default-import/_config.js index db487edf7b3..6a5fb88b638 100644 --- a/test/form/samples/export-default-import/_config.js +++ b/test/form/samples/export-default-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly exports a default import, even in ES mode (#513)', options: { external: ['x'], @@ -8,4 +8,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-default/_config.js b/test/form/samples/export-default/_config.js index dd454c4c39f..f6dd8a9b705 100644 --- a/test/form/samples/export-default/_config.js +++ b/test/form/samples/export-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'single (default) exports', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-globals/_config.js b/test/form/samples/export-globals/_config.js index 2c6a4f4f9a0..6d54b2cfea4 100644 --- a/test/form/samples/export-globals/_config.js +++ b/test/form/samples/export-globals/_config.js @@ -1,11 +1,11 @@ // Changed due to https://github.com/acornjs/acorn/issues/806 // Consider reverting this change should this become an acorn option -module.exports = { +module.exports = defineTest({ description: 'Supports reexports of globals with namespace access', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/export-internal-namespace-as/_config.js b/test/form/samples/export-internal-namespace-as/_config.js index 71792b71529..d9e1cb9af78 100644 --- a/test/form/samples/export-internal-namespace-as/_config.js +++ b/test/form/samples/export-internal-namespace-as/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports exporting and resolving internal namespaces as names' -}; +}); diff --git a/test/form/samples/export-live-bindings/_config.js b/test/form/samples/export-live-bindings/_config.js index 5e9f7bd8115..c8377f8dbbd 100644 --- a/test/form/samples/export-live-bindings/_config.js +++ b/test/form/samples/export-live-bindings/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'exported live bindings', options: { output: { name: 'iife' } } -}; +}); diff --git a/test/form/samples/export-multiple-vars/_config.js b/test/form/samples/export-multiple-vars/_config.js index 6e8403586ac..23cf12deddd 100644 --- a/test/form/samples/export-multiple-vars/_config.js +++ b/test/form/samples/export-multiple-vars/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'splits up multiple vars in a single export declaration' -}; +}); diff --git a/test/form/samples/export-namespace-as/_config.js b/test/form/samples/export-namespace-as/_config.js index 81eb160f2ee..1020407da73 100644 --- a/test/form/samples/export-namespace-as/_config.js +++ b/test/form/samples/export-namespace-as/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports exporting namespaces as names in entry points', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/exported-class-declaration-conflict/_config.js b/test/form/samples/exported-class-declaration-conflict/_config.js index 3c601ee8f95..28937382c5b 100644 --- a/test/form/samples/exported-class-declaration-conflict/_config.js +++ b/test/form/samples/exported-class-declaration-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles exporting class declarations with name conflicts in SystemJS', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/exports-at-end-if-possible/_config.js b/test/form/samples/exports-at-end-if-possible/_config.js index 7399d554c73..d7c16115fa6 100644 --- a/test/form/samples/exports-at-end-if-possible/_config.js +++ b/test/form/samples/exports-at-end-if-possible/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'exports variables at end, if possible', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/extend-exports/_config.js b/test/form/samples/extend-exports/_config.js index b2f3aac6c76..de6f96f242f 100644 --- a/test/form/samples/extend-exports/_config.js +++ b/test/form/samples/extend-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'extends module correctly', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'foo' } } -}; +}); diff --git a/test/form/samples/extend-namespaced-exports/_config.js b/test/form/samples/extend-namespaced-exports/_config.js index eece0816e6b..f8d9407c1bf 100644 --- a/test/form/samples/extend-namespaced-exports/_config.js +++ b/test/form/samples/extend-namespaced-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'extends namespaced module name', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'foo.bar.baz' } } -}; +}); diff --git a/test/form/samples/external-deshadowing/_config.js b/test/form/samples/external-deshadowing/_config.js index d46d28e9e6c..944fd4e0b94 100644 --- a/test/form/samples/external-deshadowing/_config.js +++ b/test/form/samples/external-deshadowing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Externals aliases with deshadowing', options: { external: ['a', 'b'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/external-empty-import-no-global-b/_config.js b/test/form/samples/external-empty-import-no-global-b/_config.js index 531386bd5b6..dc9e9b1cb4d 100644 --- a/test/form/samples/external-empty-import-no-global-b/_config.js +++ b/test/form/samples/external-empty-import-no-global-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not expect a global to be provided for empty imports (#1217)', options: { external: ['babel-polyfill', 'other'], @@ -10,4 +10,4 @@ module.exports = { globals: { other: 'other' } } } -}; +}); diff --git a/test/form/samples/external-empty-import-no-global/_config.js b/test/form/samples/external-empty-import-no-global/_config.js index 8895d91054e..9070629e0b0 100644 --- a/test/form/samples/external-empty-import-no-global/_config.js +++ b/test/form/samples/external-empty-import-no-global/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not expect a global to be provided for empty imports (#1217)', options: { external: ['babel-polyfill'], @@ -9,4 +9,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/external-export-tracing/_config.js b/test/form/samples/external-export-tracing/_config.js index f4140c4ed86..734f88b588f 100644 --- a/test/form/samples/external-export-tracing/_config.js +++ b/test/form/samples/external-export-tracing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Support external namespace reexport', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/external-import-alias-shadow/_config.js b/test/form/samples/external-import-alias-shadow/_config.js index acc8ed78eb7..5d95e9b1ea0 100644 --- a/test/form/samples/external-import-alias-shadow/_config.js +++ b/test/form/samples/external-import-alias-shadow/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles external aliased named imports that shadow another name', options: { external: ['acorn'], @@ -6,4 +6,4 @@ module.exports = { globals: { acorn: 'acorn' } } } -}; +}); diff --git a/test/form/samples/external-import-order/_config.js b/test/form/samples/external-import-order/_config.js index d35e42d0265..eccb2fe28d0 100644 --- a/test/form/samples/external-import-order/_config.js +++ b/test/form/samples/external-import-order/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Retain the execution order of external imports', options: { external(id) { return id.startsWith('external'); } } -}; +}); diff --git a/test/form/samples/external-imports-custom-names-function/_config.js b/test/form/samples/external-imports-custom-names-function/_config.js index 188a8841c56..68aafe26bb4 100644 --- a/test/form/samples/external-imports-custom-names-function/_config.js +++ b/test/form/samples/external-imports-custom-names-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows globals to be specified as a function', options: { external: ['a-b-c'], @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/external-imports-custom-names/_config.js b/test/form/samples/external-imports-custom-names/_config.js index f614da0d314..c047d627307 100644 --- a/test/form/samples/external-imports-custom-names/_config.js +++ b/test/form/samples/external-imports-custom-names/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'allows global names to be specified for IIFE/UMD exports', options: { external: ['jquery'], output: { globals: { jquery: 'jQuery' } } } -}; +}); diff --git a/test/form/samples/external-imports/_config.js b/test/form/samples/external-imports/_config.js index 46cde903266..c1bd02260f1 100644 --- a/test/form/samples/external-imports/_config.js +++ b/test/form/samples/external-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'prefixes global names with `global.` when creating UMD bundle (#57)', expectedWarnings: ['UNUSED_EXTERNAL_IMPORT'], options: { @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/external-namespace-and-named/_config.js b/test/form/samples/external-namespace-and-named/_config.js index 836a753798a..dba2bf0ca6c 100644 --- a/test/form/samples/external-namespace-and-named/_config.js +++ b/test/form/samples/external-namespace-and-named/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Correctly handles external namespace tracing with both namespace and named exports', options: { external: ['foo'], @@ -6,4 +6,4 @@ module.exports = { globals: { foo: 'foo' } } } -}; +}); diff --git a/test/form/samples/external-namespace-reexport/_config.js b/test/form/samples/external-namespace-reexport/_config.js index 7e15b263f44..4fc57ee9de6 100644 --- a/test/form/samples/external-namespace-reexport/_config.js +++ b/test/form/samples/external-namespace-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Support external namespace reexport', options: { external: ['highcharts'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/for-in-scopes/_config.js b/test/form/samples/for-in-scopes/_config.js index 96ccae80614..3960d227369 100644 --- a/test/form/samples/for-in-scopes/_config.js +++ b/test/form/samples/for-in-scopes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around for-in-loops' -}; +}); diff --git a/test/form/samples/for-loop-assignment/_config.js b/test/form/samples/for-loop-assignment/_config.js index 120cbe0c1b7..2675850e9a2 100644 --- a/test/form/samples/for-loop-assignment/_config.js +++ b/test/form/samples/for-loop-assignment/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'removes assignments with computed indexes in for loops', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/for-loop-body-var-declaration/_config.js b/test/form/samples/for-loop-body-var-declaration/_config.js index 9a0504cf967..4a81a595b59 100644 --- a/test/form/samples/for-loop-body-var-declaration/_config.js +++ b/test/form/samples/for-loop-body-var-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'use a newline for line wraps removing a necessary semicolon (#1275)' -}; +}); diff --git a/test/form/samples/for-loop-with-empty-head/_config.js b/test/form/samples/for-loop-with-empty-head/_config.js index 3fc4a6756e5..2c6f483247d 100644 --- a/test/form/samples/for-loop-with-empty-head/_config.js +++ b/test/form/samples/for-loop-with-empty-head/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles for loop with empty head' -}; +}); diff --git a/test/form/samples/for-of-scopes/_config.js b/test/form/samples/for-of-scopes/_config.js index 4d8d348e4a4..fd2c66957ca 100644 --- a/test/form/samples/for-of-scopes/_config.js +++ b/test/form/samples/for-of-scopes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around for-of-loops' -}; +}); diff --git a/test/form/samples/for-scopes/_config.js b/test/form/samples/for-scopes/_config.js index 552d2e34790..27d13b692eb 100644 --- a/test/form/samples/for-scopes/_config.js +++ b/test/form/samples/for-scopes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around for-loops' -}; +}); diff --git a/test/form/samples/freeze/_config.js b/test/form/samples/freeze/_config.js index f21ca943d82..12ac7d22b83 100644 --- a/test/form/samples/freeze/_config.js +++ b/test/form/samples/freeze/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'supports opt-ing out of usage of Object.freeze', options: { output: { name: 'myBundle', freeze: false } } -}; +}); diff --git a/test/form/samples/function-body-return-values/_config.js b/test/form/samples/function-body-return-values/_config.js index 4fd56e83a8a..df2edb7831b 100644 --- a/test/form/samples/function-body-return-values/_config.js +++ b/test/form/samples/function-body-return-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly extract return values from function bodies' -}; +}); diff --git a/test/form/samples/function-call-parameters/_config.js b/test/form/samples/function-call-parameters/_config.js index bbbe71969f8..097877563f5 100644 --- a/test/form/samples/function-call-parameters/_config.js +++ b/test/form/samples/function-call-parameters/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'take actual parameters into account when determining side-effects of calls to functions' -}; +}); diff --git a/test/form/samples/function-iterable-prototype/_config.js b/test/form/samples/function-iterable-prototype/_config.js index a4bea7d5c41..68a969a9ddd 100644 --- a/test/form/samples/function-iterable-prototype/_config.js +++ b/test/form/samples/function-iterable-prototype/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Removes unused functions where the prototype is iterable', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/function-mutation/_config.js b/test/form/samples/function-mutation/_config.js index daf7066a19e..6c2feccf835 100644 --- a/test/form/samples/function-mutation/_config.js +++ b/test/form/samples/function-mutation/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'function-mutations do not have effects', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/function-scopes/_config.js b/test/form/samples/function-scopes/_config.js index 5b8670f6496..9712643a9f1 100644 --- a/test/form/samples/function-scopes/_config.js +++ b/test/form/samples/function-scopes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around functions' -}; +}); diff --git a/test/form/samples/generated-code-compact/arrow-functions-false/_config.js b/test/form/samples/generated-code-compact/arrow-functions-false/_config.js index 59b4aa1015e..87cfa0b05c1 100644 --- a/test/form/samples/generated-code-compact/arrow-functions-false/_config.js +++ b/test/form/samples/generated-code-compact/arrow-functions-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use arrow functions', options: { external: [ @@ -31,4 +31,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/generated-code-compact/arrow-functions-true/_config.js b/test/form/samples/generated-code-compact/arrow-functions-true/_config.js index 23d7c2f799c..1633c1df78b 100644 --- a/test/form/samples/generated-code-compact/arrow-functions-true/_config.js +++ b/test/form/samples/generated-code-compact/arrow-functions-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses arrow functions', options: { external: [ @@ -31,4 +31,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/generated-code-compact/const-bindings-false/_config.js b/test/form/samples/generated-code-compact/const-bindings-false/_config.js index 2fb5b8ce3f2..0c8faf3abfe 100644 --- a/test/form/samples/generated-code-compact/const-bindings-false/_config.js +++ b/test/form/samples/generated-code-compact/const-bindings-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use block bindings', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -14,6 +14,7 @@ module.exports = { }, plugins: [ { + name: 'test', transform(code, id) { if (id.endsWith('synthetic.js')) { return { syntheticNamedExports: true }; @@ -22,4 +23,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code-compact/const-bindings-true/_config.js b/test/form/samples/generated-code-compact/const-bindings-true/_config.js index 28048b41d2b..045df6feda1 100644 --- a/test/form/samples/generated-code-compact/const-bindings-true/_config.js +++ b/test/form/samples/generated-code-compact/const-bindings-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses block bindings', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -14,6 +14,7 @@ module.exports = { }, plugins: [ { + name: 'test', transform(code, id) { if (id.endsWith('synthetic.js')) { return { syntheticNamedExports: true }; @@ -22,4 +23,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code-compact/object-shorthand-false/_config.js b/test/form/samples/generated-code-compact/object-shorthand-false/_config.js index c5c515a1007..754cb7f6c20 100644 --- a/test/form/samples/generated-code-compact/object-shorthand-false/_config.js +++ b/test/form/samples/generated-code-compact/object-shorthand-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use object shorthand syntax', options: { output: { @@ -9,4 +9,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code-compact/object-shorthand-true/_config.js b/test/form/samples/generated-code-compact/object-shorthand-true/_config.js index 3b83da66685..ecdbd32adf6 100644 --- a/test/form/samples/generated-code-compact/object-shorthand-true/_config.js +++ b/test/form/samples/generated-code-compact/object-shorthand-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses object shorthand syntax', options: { output: { @@ -9,4 +9,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-false-no-external-live-bindings/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-false-no-external-live-bindings/_config.js index f31104e00eb..72d79eee8b1 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-false-no-external-live-bindings/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-false-no-external-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props when external live-bindings are off', options: { external: ['external'], @@ -11,4 +11,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js index 0fff50bba3a..a232201d2e1 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { external: ['external', 'external2', 'externalDefaultOnly'], @@ -14,10 +14,11 @@ module.exports = { }, plugins: [ { + name: 'test', transform() { return { syntheticNamedExports: true }; } } ] } -}; +}); diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-true-no-external-live-bindings/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-true-no-external-live-bindings/_config.js index dda576dc7c1..90192827fa9 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-true-no-external-live-bindings/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-true-no-external-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props when external live-bindings are off', options: { external: ['external'], @@ -11,4 +11,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js index 5687b9a5fa4..84daa38a929 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { external: ['external', 'external2', 'externalDefaultOnly'], @@ -14,10 +14,11 @@ module.exports = { }, plugins: [ { + name: 'test', transform() { return { syntheticNamedExports: true }; } } ] } -}; +}); diff --git a/test/form/samples/generated-code-presets/es2015/_config.js b/test/form/samples/generated-code-presets/es2015/_config.js index d7c50dc505d..02b793a8e58 100644 --- a/test/form/samples/generated-code-presets/es2015/_config.js +++ b/test/form/samples/generated-code-presets/es2015/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles generatedCode preset "es2015"', options: { output: { @@ -11,6 +11,7 @@ module.exports = { }, plugins: [ { + name: 'test', renderStart(options) { assert.strictEqual(options.generatedCode.arrowFunctions, true); assert.strictEqual(options.generatedCode.objectShorthand, true); @@ -19,4 +20,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code-presets/es5/_config.js b/test/form/samples/generated-code-presets/es5/_config.js index 68a18eeb17f..c7dd1d166d6 100644 --- a/test/form/samples/generated-code-presets/es5/_config.js +++ b/test/form/samples/generated-code-presets/es5/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles generatedCode preset "es5"', options: { output: { @@ -11,6 +11,7 @@ module.exports = { }, plugins: [ { + name: 'test', renderStart(options) { assert.strictEqual(options.generatedCode.arrowFunctions, false); assert.strictEqual(options.generatedCode.objectShorthand, false); @@ -19,4 +20,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code-presets/preset-with-override/_config.js b/test/form/samples/generated-code-presets/preset-with-override/_config.js index e1e1da04319..11ebdbd10fb 100644 --- a/test/form/samples/generated-code-presets/preset-with-override/_config.js +++ b/test/form/samples/generated-code-presets/preset-with-override/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles generatedCode preset "es2015"', options: { output: { @@ -14,6 +14,7 @@ module.exports = { }, plugins: [ { + name: 'test', renderStart(options) { assert.strictEqual(options.generatedCode.arrowFunctions, false); assert.strictEqual(options.generatedCode.objectShorthand, true); @@ -22,4 +23,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code/arrow-functions-false/_config.js b/test/form/samples/generated-code/arrow-functions-false/_config.js index 3cf005ea0c0..7e1fdb591a6 100644 --- a/test/form/samples/generated-code/arrow-functions-false/_config.js +++ b/test/form/samples/generated-code/arrow-functions-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use arrow functions', options: { external: [ @@ -30,4 +30,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/generated-code/arrow-functions-true/_config.js b/test/form/samples/generated-code/arrow-functions-true/_config.js index 8ac55b955bd..f384a5418b3 100644 --- a/test/form/samples/generated-code/arrow-functions-true/_config.js +++ b/test/form/samples/generated-code/arrow-functions-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses arrow functions', options: { external: [ @@ -30,4 +30,4 @@ module.exports = { } }, expectedWarnings: ['DEPRECATED_FEATURE'] -}; +}); diff --git a/test/form/samples/generated-code/const-bindings-false/_config.js b/test/form/samples/generated-code/const-bindings-false/_config.js index 2cb64b60a47..edb1fc0b694 100644 --- a/test/form/samples/generated-code/const-bindings-false/_config.js +++ b/test/form/samples/generated-code/const-bindings-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use block bindings', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -13,6 +13,7 @@ module.exports = { }, plugins: [ { + name: 'test', transform(code, id) { if (id.endsWith('synthetic.js')) { return { syntheticNamedExports: true }; @@ -21,4 +22,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code/const-bindings-true/_config.js b/test/form/samples/generated-code/const-bindings-true/_config.js index e02a884ab9e..80d9f779946 100644 --- a/test/form/samples/generated-code/const-bindings-true/_config.js +++ b/test/form/samples/generated-code/const-bindings-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses block bindings', expectedWarnings: ['SHIMMED_EXPORT'], options: { @@ -13,6 +13,7 @@ module.exports = { }, plugins: [ { + name: 'test', transform(code, id) { if (id.endsWith('synthetic.js')) { return { syntheticNamedExports: true }; @@ -21,4 +22,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/generated-code/object-shorthand-false/_config.js b/test/form/samples/generated-code/object-shorthand-false/_config.js index 3213ea6f5d1..dabf728a180 100644 --- a/test/form/samples/generated-code/object-shorthand-false/_config.js +++ b/test/form/samples/generated-code/object-shorthand-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not use object shorthand syntax', options: { output: { @@ -8,4 +8,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code/object-shorthand-true/_config.js b/test/form/samples/generated-code/object-shorthand-true/_config.js index b453e6ff0e2..65f0bd04d5f 100644 --- a/test/form/samples/generated-code/object-shorthand-true/_config.js +++ b/test/form/samples/generated-code/object-shorthand-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses object shorthand syntax', options: { output: { @@ -8,4 +8,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code/reserved-names-as-props-false-no-external-live-bindings/_config.js b/test/form/samples/generated-code/reserved-names-as-props-false-no-external-live-bindings/_config.js index 18dbe14d544..67a2c60fe84 100644 --- a/test/form/samples/generated-code/reserved-names-as-props-false-no-external-live-bindings/_config.js +++ b/test/form/samples/generated-code/reserved-names-as-props-false-no-external-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props when external live-bindings are off', options: { external: ['external'], @@ -10,4 +10,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code/reserved-names-as-props-false/_config.js b/test/form/samples/generated-code/reserved-names-as-props-false/_config.js index 6f5456496a2..f46f0daf878 100644 --- a/test/form/samples/generated-code/reserved-names-as-props-false/_config.js +++ b/test/form/samples/generated-code/reserved-names-as-props-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { external: ['external', 'external2', 'externalDefaultOnly'], @@ -13,10 +13,11 @@ module.exports = { }, plugins: [ { + name: 'test', transform() { return { syntheticNamedExports: true }; } } ] } -}; +}); diff --git a/test/form/samples/generated-code/reserved-names-as-props-true-no-external-live-bindings/_config.js b/test/form/samples/generated-code/reserved-names-as-props-true-no-external-live-bindings/_config.js index 60cf1f3f1f3..973c1253e16 100644 --- a/test/form/samples/generated-code/reserved-names-as-props-true-no-external-live-bindings/_config.js +++ b/test/form/samples/generated-code/reserved-names-as-props-true-no-external-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props when external live-bindings are off', options: { external: ['external'], @@ -10,4 +10,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/generated-code/reserved-names-as-props-true/_config.js b/test/form/samples/generated-code/reserved-names-as-props-true/_config.js index c53af0ef6e6..0738546f1c1 100644 --- a/test/form/samples/generated-code/reserved-names-as-props-true/_config.js +++ b/test/form/samples/generated-code/reserved-names-as-props-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'escapes reserved names used as props', options: { external: ['external', 'external2', 'externalDefaultOnly'], @@ -13,10 +13,11 @@ module.exports = { }, plugins: [ { + name: 'test', transform() { return { syntheticNamedExports: true }; } } ] } -}; +}); diff --git a/test/form/samples/getter-return-values/_config.js b/test/form/samples/getter-return-values/_config.js index 0c6bc6a1647..49e4e90c27e 100644 --- a/test/form/samples/getter-return-values/_config.js +++ b/test/form/samples/getter-return-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'forwards return values of getters' -}; +}); diff --git a/test/form/samples/globals-function/_config.js b/test/form/samples/globals-function/_config.js index 8c1bcef98a3..a4725202ba2 100644 --- a/test/form/samples/globals-function/_config.js +++ b/test/form/samples/globals-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Externals aliases with deshadowing', options: { external: ['a', 'b'], @@ -7,4 +7,4 @@ module.exports = { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/globals-removes-access-to-pure-function-members/_config.js b/test/form/samples/globals-removes-access-to-pure-function-members/_config.js index af2c4421073..b3d3d53f49e 100644 --- a/test/form/samples/globals-removes-access-to-pure-function-members/_config.js +++ b/test/form/samples/globals-removes-access-to-pure-function-members/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'accessing members of pure functions and their prototypes is not a side-effect' -}; +}); diff --git a/test/form/samples/guessed-global-names/_config.js b/test/form/samples/guessed-global-names/_config.js index 218577109db..5f26cbab993 100644 --- a/test/form/samples/guessed-global-names/_config.js +++ b/test/form/samples/guessed-global-names/_config.js @@ -1,6 +1,6 @@ const { resolve } = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'guesses global names if necessary', expectedWarnings: ['MISSING_GLOBAL_NAME'], options: { @@ -12,4 +12,4 @@ module.exports = { resolve(__dirname, 'relative.js') ] } -}; +}); diff --git a/test/form/samples/handles-async-await/_config.js b/test/form/samples/handles-async-await/_config.js index 9c17f942ab8..cf026ce4bd2 100644 --- a/test/form/samples/handles-async-await/_config.js +++ b/test/form/samples/handles-async-await/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly handles exporting async functions' -}; +}); diff --git a/test/form/samples/handles-empty-imports-iife/_config.js b/test/form/samples/handles-empty-imports-iife/_config.js index d20eb8d00a8..0cc79137cf7 100644 --- a/test/form/samples/handles-empty-imports-iife/_config.js +++ b/test/form/samples/handles-empty-imports-iife/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles empty imports when generating IIFE output', expectedWarnings: ['MISSING_NODE_BUILTINS', 'UNRESOLVED_IMPORT'], options: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/handles-empty-imports-umd/_config.js b/test/form/samples/handles-empty-imports-umd/_config.js index 7caa9a477ac..1226ef2187e 100644 --- a/test/form/samples/handles-empty-imports-umd/_config.js +++ b/test/form/samples/handles-empty-imports-umd/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles empty imports when generating IIFE output', expectedWarnings: ['MISSING_NODE_BUILTINS', 'UNRESOLVED_IMPORT'], options: { @@ -11,4 +11,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/hashbang/_config.js b/test/form/samples/hashbang/_config.js index f19d68bd304..36eb1925f10 100644 --- a/test/form/samples/hashbang/_config.js +++ b/test/form/samples/hashbang/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports input files with leading hashbang comment' -}; +}); diff --git a/test/form/samples/hoisted-unused-conditional/_config.js b/test/form/samples/hoisted-unused-conditional/_config.js index ebb7fcbcec3..8607e410006 100644 --- a/test/form/samples/hoisted-unused-conditional/_config.js +++ b/test/form/samples/hoisted-unused-conditional/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Properly renders conditionals in hoisted variables in dead branches' -}; +}); diff --git a/test/form/samples/hoisted-variable-case-stmt/_config.js b/test/form/samples/hoisted-variable-case-stmt/_config.js index f4ec792209e..156c5550180 100644 --- a/test/form/samples/hoisted-variable-case-stmt/_config.js +++ b/test/form/samples/hoisted-variable-case-stmt/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Properly handles a variable hoisted from within a fallthrough switch case' -}; +}); diff --git a/test/form/samples/hoisted-variable-if-stmt/_config.js b/test/form/samples/hoisted-variable-if-stmt/_config.js index c6e376a856b..c18b43edd40 100644 --- a/test/form/samples/hoisted-variable-if-stmt/_config.js +++ b/test/form/samples/hoisted-variable-if-stmt/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Properly renders branches which refer to hoisted variables from other lexical scopes' -}; +}); diff --git a/test/form/samples/hoisted-vars-in-dead-branches/_config.js b/test/form/samples/hoisted-vars-in-dead-branches/_config.js index b27559e4d8e..39dc21c20f7 100644 --- a/test/form/samples/hoisted-vars-in-dead-branches/_config.js +++ b/test/form/samples/hoisted-vars-in-dead-branches/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'renders hoisted variables in dead branches' -}; +}); diff --git a/test/form/samples/ignore-property-access-side-effects/_config.js b/test/form/samples/ignore-property-access-side-effects/_config.js index 2db50db018f..005169f9446 100644 --- a/test/form/samples/ignore-property-access-side-effects/_config.js +++ b/test/form/samples/ignore-property-access-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'ignore side-effects when accessing properties if treeshake.propertyReadSideEffects is false', expectedWarnings: ['EMPTY_BUNDLE'], @@ -7,4 +7,4 @@ module.exports = { propertyReadSideEffects: false } } -}; +}); diff --git a/test/form/samples/ignore-unknown-global-side-effects/_config.js b/test/form/samples/ignore-unknown-global-side-effects/_config.js index 08ae295d520..748249b9a28 100644 --- a/test/form/samples/ignore-unknown-global-side-effects/_config.js +++ b/test/form/samples/ignore-unknown-global-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'ignore side-effects when accessing unknown globals if treeshake.unknownGlobalSideEffects is false', expectedWarnings: ['EMPTY_BUNDLE'], @@ -7,4 +7,4 @@ module.exports = { unknownGlobalSideEffects: false } } -}; +}); diff --git a/test/form/samples/implicit-undefined-assignments/_config.js b/test/form/samples/implicit-undefined-assignments/_config.js index 5422058eb2d..6d5dc6e2e4c 100644 --- a/test/form/samples/implicit-undefined-assignments/_config.js +++ b/test/form/samples/implicit-undefined-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Make sure implicit undefined assignments in declarations are not ignored' -}; +}); diff --git a/test/form/samples/import-assertions/assertion-shapes/_config.js b/test/form/samples/import-assertions/assertion-shapes/_config.js index 3686c79e002..4629f875429 100644 --- a/test/form/samples/import-assertions/assertion-shapes/_config.js +++ b/test/form/samples/import-assertions/assertion-shapes/_config.js @@ -1,7 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'handles special shapes of assertions', - expectedWarnings: 'UNRESOLVED_IMPORT', options: { external: () => true } -}; +}); diff --git a/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js b/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js index d46209bfcea..6cd9a15555a 100644 --- a/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js +++ b/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'keep import assertions for dynamic imports', - expectedWarnings: 'UNRESOLVED_IMPORT', + expectedWarnings: ['UNRESOLVED_IMPORT'], options: { external: id => { if (id === 'unresolved') return null; @@ -8,6 +8,7 @@ module.exports = { }, plugins: [ { + name: 'test', resolveDynamicImport(specifier) { if (typeof specifier === 'object') { if (specifier.type === 'TemplateLiteral') { @@ -24,4 +25,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/import-assertions/keeps-static-assertions/_config.js b/test/form/samples/import-assertions/keeps-static-assertions/_config.js index 7940684a958..5dfbc1b2c0e 100644 --- a/test/form/samples/import-assertions/keeps-static-assertions/_config.js +++ b/test/form/samples/import-assertions/keeps-static-assertions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps any import assertions on input', - expectedWarnings: 'UNRESOLVED_IMPORT', + expectedWarnings: ['UNRESOLVED_IMPORT'], options: { external: id => { if (id === 'unresolved') return null; @@ -8,4 +8,4 @@ module.exports = { }, output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/import-assertions/plugin-assertions-resolvedynamicimport/_config.js b/test/form/samples/import-assertions/plugin-assertions-resolvedynamicimport/_config.js index efbc46143d0..a0ec44b6b95 100644 --- a/test/form/samples/import-assertions/plugin-assertions-resolvedynamicimport/_config.js +++ b/test/form/samples/import-assertions/plugin-assertions-resolvedynamicimport/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'allows plugins to read and write import assertions in resolveDynamicImport', options: { plugins: [ { + name: 'test', resolveDynamicImport(specifier, importer, { assertions }) { const resolutionOptions = { external: true, @@ -19,4 +20,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/import-assertions/plugin-assertions-resolveid/_config.js b/test/form/samples/import-assertions/plugin-assertions-resolveid/_config.js index 77c68a879e1..53b921dda4e 100644 --- a/test/form/samples/import-assertions/plugin-assertions-resolveid/_config.js +++ b/test/form/samples/import-assertions/plugin-assertions-resolveid/_config.js @@ -1,9 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'allows plugins to read and write import assertions in resolveId', options: { output: { name: 'bundle' }, plugins: [ { + name: 'test', resolveId(source, importer, { assertions, isEntry }) { return { id: source, @@ -14,4 +15,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js b/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js index 74a50e2c816..5330ee734d0 100644 --- a/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js +++ b/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'keep import assertions for dynamic imports', - expectedWarnings: 'UNRESOLVED_IMPORT', + expectedWarnings: ['UNRESOLVED_IMPORT'], options: { external: id => { if (id === 'unresolved') return null; @@ -8,6 +8,7 @@ module.exports = { }, plugins: [ { + name: 'test', resolveDynamicImport(specifier) { if (typeof specifier === 'object') { if (specifier.type === 'TemplateLiteral') { @@ -25,4 +26,4 @@ module.exports = { ], output: { externalImportAssertions: false } } -}; +}); diff --git a/test/form/samples/import-assertions/removes-static-assertions/_config.js b/test/form/samples/import-assertions/removes-static-assertions/_config.js index 30299daf04e..8f8d7c07fd6 100644 --- a/test/form/samples/import-assertions/removes-static-assertions/_config.js +++ b/test/form/samples/import-assertions/removes-static-assertions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps any import assertions on input', - expectedWarnings: 'UNRESOLVED_IMPORT', + expectedWarnings: ['UNRESOLVED_IMPORT'], options: { external: id => { if (id === 'unresolved') return null; @@ -8,4 +8,4 @@ module.exports = { }, output: { name: 'bundle', externalImportAssertions: false } } -}; +}); diff --git a/test/form/samples/import-expression/_config.js b/test/form/samples/import-expression/_config.js index b8e2cfab5eb..d9da2eb415a 100644 --- a/test/form/samples/import-expression/_config.js +++ b/test/form/samples/import-expression/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly transforms variables in imported expressions', options: { external: 'external', @@ -6,4 +6,4 @@ module.exports = { globals: { external: 'external' } } } -}; +}); diff --git a/test/form/samples/import-external-namespace-and-default/_config.js b/test/form/samples/import-external-namespace-and-default/_config.js index b6823ebd061..b2346601267 100644 --- a/test/form/samples/import-external-namespace-and-default/_config.js +++ b/test/form/samples/import-external-namespace-and-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'disinguishes between external default and namespace (#637)', options: { external: ['foo'], @@ -6,4 +6,4 @@ module.exports = { globals: { foo: 'foo' } } } -}; +}); diff --git a/test/form/samples/import-meta-resolve/_config.js b/test/form/samples/import-meta-resolve/_config.js index aba00ef3ded..ec452a28ec0 100644 --- a/test/form/samples/import-meta-resolve/_config.js +++ b/test/form/samples/import-meta-resolve/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports import.meta.resolve' -}; +}); diff --git a/test/form/samples/import-meta-url/_config.js b/test/form/samples/import-meta-url/_config.js index 7acc8dce0e5..4a331c30c54 100644 --- a/test/form/samples/import-meta-url/_config.js +++ b/test/form/samples/import-meta-url/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports import.meta.url' -}; +}); diff --git a/test/form/samples/import-meta/_config.js b/test/form/samples/import-meta/_config.js index 0475fdfdf7c..e44c1592c0d 100644 --- a/test/form/samples/import-meta/_config.js +++ b/test/form/samples/import-meta/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports directly accessing import.meta' -}; +}); diff --git a/test/form/samples/import-named-exported-global-with-alias/_config.js b/test/form/samples/import-named-exported-global-with-alias/_config.js index 3ed95b58d27..2be7a8e17af 100644 --- a/test/form/samples/import-named-exported-global-with-alias/_config.js +++ b/test/form/samples/import-named-exported-global-with-alias/_config.js @@ -1,8 +1,8 @@ // Changed due to https://github.com/acornjs/acorn/issues/806 // Consider reverting this change should this become an acorn option -module.exports = { +module.exports = defineTest({ description: 'allow globals to be exported and imported', expectedWarnings: ['EMPTY_BUNDLE'], options: { output: { name: 'doc' } } -}; +}); diff --git a/test/form/samples/import-namespace-systemjs/_config.js b/test/form/samples/import-namespace-systemjs/_config.js index 1708f21cd7a..5fc7ae30401 100644 --- a/test/form/samples/import-namespace-systemjs/_config.js +++ b/test/form/samples/import-namespace-systemjs/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'imports namespace (systemjs only)', options: { external: ['dependency'], @@ -6,4 +6,4 @@ module.exports = { format: 'system' } } -}; +}); diff --git a/test/form/samples/import-namespace/_config.js b/test/form/samples/import-namespace/_config.js index 2cd57f110ff..abd8444309d 100644 --- a/test/form/samples/import-namespace/_config.js +++ b/test/form/samples/import-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'imports external namespaces', options: { external: ['foo', 'bar'], @@ -6,4 +6,4 @@ module.exports = { globals: { foo: 'foo', bar: 'bar' } } } -}; +}); diff --git a/test/form/samples/import-specifier-deshadowing/_config.js b/test/form/samples/import-specifier-deshadowing/_config.js index 26457a50db3..eb4603a66f3 100644 --- a/test/form/samples/import-specifier-deshadowing/_config.js +++ b/test/form/samples/import-specifier-deshadowing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deshadows aliased import bindings', options: { external: ['react-sticky'], @@ -7,4 +7,4 @@ module.exports = { name: 'Sticky' } } -}; +}); diff --git a/test/form/samples/include-recursive-call-arguments/_config.js b/test/form/samples/include-recursive-call-arguments/_config.js index 5944997b49f..5e5931e99ec 100644 --- a/test/form/samples/include-recursive-call-arguments/_config.js +++ b/test/form/samples/include-recursive-call-arguments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles recursive declarations' -}; +}); diff --git a/test/form/samples/includes-all-namespace-declarations/_config.js b/test/form/samples/includes-all-namespace-declarations/_config.js index afd3cf26746..a0c51a54418 100644 --- a/test/form/samples/includes-all-namespace-declarations/_config.js +++ b/test/form/samples/includes-all-namespace-declarations/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes all declarations referenced by reified namespaces', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/indent-false/_config.js b/test/form/samples/indent-false/_config.js index 869d6498ed7..163c898084f 100644 --- a/test/form/samples/indent-false/_config.js +++ b/test/form/samples/indent-false/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not indent with indent: false', options: { output: { @@ -6,4 +6,4 @@ module.exports = { indent: false } } -}; +}); diff --git a/test/form/samples/indent-spaces/_config.js b/test/form/samples/indent-spaces/_config.js index b49bec76a0d..cc9b301eca6 100644 --- a/test/form/samples/indent-spaces/_config.js +++ b/test/form/samples/indent-spaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'auto-indents with indent: true', options: { output: { @@ -6,4 +6,4 @@ module.exports = { indent: ' ' } } -}; +}); diff --git a/test/form/samples/indent-true-spaces/_config.js b/test/form/samples/indent-true-spaces/_config.js index c78911da9ec..a06b41859d6 100644 --- a/test/form/samples/indent-true-spaces/_config.js +++ b/test/form/samples/indent-true-spaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'auto-indents with spaces and indent: true', options: { output: { @@ -6,4 +6,4 @@ module.exports = { indent: true } } -}; +}); diff --git a/test/form/samples/indent-true/_config.js b/test/form/samples/indent-true/_config.js index ad1ec81a073..d31ad024e90 100644 --- a/test/form/samples/indent-true/_config.js +++ b/test/form/samples/indent-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'auto-indents with indent: true', options: { output: { @@ -6,4 +6,4 @@ module.exports = { indent: true } } -}; +}); diff --git a/test/form/samples/inlined-treeshaken-dynamic-import/_config.js b/test/form/samples/inlined-treeshaken-dynamic-import/_config.js index 1703f4c9c1f..58505c25d55 100644 --- a/test/form/samples/inlined-treeshaken-dynamic-import/_config.js +++ b/test/form/samples/inlined-treeshaken-dynamic-import/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'completely removes tree-shaken dynamic imports ', options: { output: { inlineDynamicImports: true } } -}; +}); diff --git a/test/form/samples/internal-conflict-resolution/_config.js b/test/form/samples/internal-conflict-resolution/_config.js index 921d1748e30..bd2f02eb476 100644 --- a/test/form/samples/internal-conflict-resolution/_config.js +++ b/test/form/samples/internal-conflict-resolution/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'internal name conflicts are resolved sanely' -}; +}); diff --git a/test/form/samples/interop-per-dependency-no-freeze/_config.js b/test/form/samples/interop-per-dependency-no-freeze/_config.js index b101cfe23b9..f020ef7820c 100644 --- a/test/form/samples/interop-per-dependency-no-freeze/_config.js +++ b/test/form/samples/interop-per-dependency-no-freeze/_config.js @@ -1,9 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'respects the freeze option', options: { external: id => id.startsWith('external'), output: { freeze: false, + /** @type any */ interop(id) { return id.split('-')[1]; }, @@ -13,4 +14,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/interop-per-dependency-no-live-binding/_config.js b/test/form/samples/interop-per-dependency-no-live-binding/_config.js index 7f7e7c22824..f536266093c 100644 --- a/test/form/samples/interop-per-dependency-no-live-binding/_config.js +++ b/test/form/samples/interop-per-dependency-no-live-binding/_config.js @@ -1,11 +1,12 @@ const checkedIds = new Set(); -module.exports = { +module.exports = defineTest({ description: 'allows to configure the interop type per external dependency', options: { external: id => id.startsWith('external'), output: { externalLiveBindings: false, + /** @type any */ interop(id) { if (checkedIds.has(id)) { throw new Error(`Interop for id ${id} has been requested twice.`); @@ -17,4 +18,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/interop-per-dependency/_config.js b/test/form/samples/interop-per-dependency/_config.js index 55148ba9758..00be3c6e95a 100644 --- a/test/form/samples/interop-per-dependency/_config.js +++ b/test/form/samples/interop-per-dependency/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure the interop type per external dependency', options: { external: id => id.startsWith('external'), output: { + /** @type any*/ interop(id) { if (id === null) { return 'auto'; @@ -15,4 +16,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/interop-per-reexported-dependency/_config.js b/test/form/samples/interop-per-reexported-dependency/_config.js index 8d2772f7d6f..125ced57302 100644 --- a/test/form/samples/interop-per-reexported-dependency/_config.js +++ b/test/form/samples/interop-per-reexported-dependency/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure the interop type per reexported external dependency', options: { external: id => id.startsWith('external'), output: { + /** @type any */ interop(id) { return id.split('-')[1]; }, @@ -12,4 +13,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/intro-and-outro/_config.js b/test/form/samples/intro-and-outro/_config.js index 6b525adedb8..467a7697513 100644 --- a/test/form/samples/intro-and-outro/_config.js +++ b/test/form/samples/intro-and-outro/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds an intro/outro', options: { output: { @@ -10,6 +10,7 @@ module.exports = { external: ['external'], plugins: [ { + name: 'first', intro() { return '// intro 1'; }, @@ -18,6 +19,7 @@ module.exports = { } }, { + name: 'second', intro() { return '// intro 2'; }, @@ -26,6 +28,7 @@ module.exports = { } }, { + name: 'third', intro() { return Promise.resolve('// intro 3'); }, @@ -34,9 +37,10 @@ module.exports = { } }, { + name: 'fourth', intro: '// intro 4', outro: '// outro 4' } ] } -}; +}); diff --git a/test/form/samples/invalid-binary-expressions/_config.js b/test/form/samples/invalid-binary-expressions/_config.js index ba2a664d734..9793cc6d678 100644 --- a/test/form/samples/invalid-binary-expressions/_config.js +++ b/test/form/samples/invalid-binary-expressions/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not fail when bundling code where the `in`-operator is used with invalid right sides' -}; +}); diff --git a/test/form/samples/json-parse-is-not-pure/_config.js b/test/form/samples/json-parse-is-not-pure/_config.js index b7636146475..667c498f718 100644 --- a/test/form/samples/json-parse-is-not-pure/_config.js +++ b/test/form/samples/json-parse-is-not-pure/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'JSON.parse is not pure as it can throw on invalid json strings', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/json-stringify-is-not-pure/_config.js b/test/form/samples/json-stringify-is-not-pure/_config.js index 1d840390ca2..9573e383bfa 100644 --- a/test/form/samples/json-stringify-is-not-pure/_config.js +++ b/test/form/samples/json-stringify-is-not-pure/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'JSON.stringify is not pure as it can throw on circular structures', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/keep-property-access-side-effects/_config.js b/test/form/samples/keep-property-access-side-effects/_config.js index 0d6db906551..f08c79347ca 100644 --- a/test/form/samples/keep-property-access-side-effects/_config.js +++ b/test/form/samples/keep-property-access-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'keep side-effects when accessing properties if treeshake.propertyReadSideEffects is true', options: { @@ -6,4 +6,4 @@ module.exports = { propertyReadSideEffects: true } } -}; +}); diff --git a/test/form/samples/keep-tree-shaking-comments-no-asi/_config.js b/test/form/samples/keep-tree-shaking-comments-no-asi/_config.js index 74cf0990a83..d0e04ee0cb5 100644 --- a/test/form/samples/keep-tree-shaking-comments-no-asi/_config.js +++ b/test/form/samples/keep-tree-shaking-comments-no-asi/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'always keep leading comments when tree-shaking and no automatic semicolons are inserted' -}; +}); diff --git a/test/form/samples/known-globals/_config.js b/test/form/samples/known-globals/_config.js index 9811990bbd2..f14cb5d63a2 100644 --- a/test/form/samples/known-globals/_config.js +++ b/test/form/samples/known-globals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not consider it a side-effect if a known global variable is accessed' -}; +}); diff --git a/test/form/samples/labeled-break-statements/_config.js b/test/form/samples/labeled-break-statements/_config.js index 037b0db339c..20892371667 100644 --- a/test/form/samples/labeled-break-statements/_config.js +++ b/test/form/samples/labeled-break-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keep break statements if their label is included' -}; +}); diff --git a/test/form/samples/labeled-continue-statements/_config.js b/test/form/samples/labeled-continue-statements/_config.js index 3aa496920c8..9665ed990c0 100644 --- a/test/form/samples/labeled-continue-statements/_config.js +++ b/test/form/samples/labeled-continue-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keep continue statements if their label is included' -}; +}); diff --git a/test/form/samples/large-var-cnt-deduping/_config.js b/test/form/samples/large-var-cnt-deduping/_config.js index b038b5af02e..b26281f1e9c 100644 --- a/test/form/samples/large-var-cnt-deduping/_config.js +++ b/test/form/samples/large-var-cnt-deduping/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'large variable count deduping' -}; +}); diff --git a/test/form/samples/lazy-assignment-deoptimization/_config.js b/test/form/samples/lazy-assignment-deoptimization/_config.js index 3d2fbfd1923..040916440fd 100644 --- a/test/form/samples/lazy-assignment-deoptimization/_config.js +++ b/test/form/samples/lazy-assignment-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only deoptimizes assigned variables when the assignment is included' -}; +}); diff --git a/test/form/samples/literals-from-class-statics/_config.js b/test/form/samples/literals-from-class-statics/_config.js index 0847b183aac..e5a57c5caf1 100644 --- a/test/form/samples/literals-from-class-statics/_config.js +++ b/test/form/samples/literals-from-class-statics/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks literal values in class static fields' -}; +}); diff --git a/test/form/samples/literals-from-return-expressions/_config.js b/test/form/samples/literals-from-return-expressions/_config.js index 80621ca80a3..e236d2ba647 100644 --- a/test/form/samples/literals-from-return-expressions/_config.js +++ b/test/form/samples/literals-from-return-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks literal values across return expressions' -}; +}); diff --git a/test/form/samples/logical-expression/deopzimize-while-included/_config.js b/test/form/samples/logical-expression/deopzimize-while-included/_config.js index 343a9689d60..aba539b2fdb 100644 --- a/test/form/samples/logical-expression/deopzimize-while-included/_config.js +++ b/test/form/samples/logical-expression/deopzimize-while-included/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimizations of logical expression while they are inlcuded (#3324)' -}; +}); diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_config.js b/test/form/samples/logical-expression/mutate-logical-expression/_config.js index 718edcc7ca7..0446f8aa8be 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_config.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly handle the results of mutating logical expressions', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/logical-expression/simplify-non-boolean/_config.js b/test/form/samples/logical-expression/simplify-non-boolean/_config.js index d9e89aa08a1..687f0950ff9 100644 --- a/test/form/samples/logical-expression/simplify-non-boolean/_config.js +++ b/test/form/samples/logical-expression/simplify-non-boolean/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'simplifies logical expressions that resolve statically to non-boolean values' -}; +}); diff --git a/test/form/samples/make-absolute-externals-relative/make-relative-false/_config.js b/test/form/samples/make-absolute-externals-relative/make-relative-false/_config.js index 122a84cce1c..a2498b029a7 100644 --- a/test/form/samples/make-absolute-externals-relative/make-relative-false/_config.js +++ b/test/form/samples/make-absolute-externals-relative/make-relative-false/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'does not normalize external paths when set to false', options: { makeAbsoluteExternalsRelative: false, @@ -19,6 +19,7 @@ module.exports = { return true; }, plugins: { + name: 'test', async buildStart() { // eslint-disable-next-line unicorn/consistent-function-scoping const testExternal = async (source, expected) => @@ -43,4 +44,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/make-absolute-externals-relative/make-relative-relative/_config.js b/test/form/samples/make-absolute-externals-relative/make-relative-relative/_config.js index fb08d843874..5d7df6077a3 100644 --- a/test/form/samples/make-absolute-externals-relative/make-relative-relative/_config.js +++ b/test/form/samples/make-absolute-externals-relative/make-relative-relative/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'only normalizes external paths that were originally relative when set to "ifRelativeSource"', options: { @@ -22,6 +22,7 @@ module.exports = { return true; }, plugins: { + name: 'test', async buildStart() { // eslint-disable-next-line unicorn/consistent-function-scoping const testExternal = async (source, expected) => @@ -49,4 +50,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/make-absolute-externals-relative/make-relative-true/_config.js b/test/form/samples/make-absolute-externals-relative/make-relative-true/_config.js index eb53962c0ac..29807ce3c2d 100644 --- a/test/form/samples/make-absolute-externals-relative/make-relative-true/_config.js +++ b/test/form/samples/make-absolute-externals-relative/make-relative-true/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'normalizes both relative and absolute external paths when set to true', options: { makeAbsoluteExternalsRelative: true, @@ -21,6 +21,7 @@ module.exports = { return true; }, plugins: { + name: 'test', async buildStart() { // eslint-disable-next-line unicorn/consistent-function-scoping const testExternal = async (source, expected) => @@ -50,4 +51,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/manual-pure-functions/_config.js b/test/form/samples/manual-pure-functions/_config.js index 5b689a5ef87..246a6298b8b 100644 --- a/test/form/samples/manual-pure-functions/_config.js +++ b/test/form/samples/manual-pure-functions/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to manually declare functions as pure by name', options: { treeshake: { manualPureFunctions: ['foo', 'bar.a'] } } -}; +}); diff --git a/test/form/samples/merge-namespaces-non-live/_config.js b/test/form/samples/merge-namespaces-non-live/_config.js index d3fa13df21c..7a35b13fc6d 100644 --- a/test/form/samples/merge-namespaces-non-live/_config.js +++ b/test/form/samples/merge-namespaces-non-live/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'merges namespaces without live-bindings', options: { external: ['external1', 'external2'], @@ -11,4 +11,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/merge-namespaces/_config.js b/test/form/samples/merge-namespaces/_config.js index c31641610b1..be3a1da6d64 100644 --- a/test/form/samples/merge-namespaces/_config.js +++ b/test/form/samples/merge-namespaces/_config.js @@ -1,13 +1,14 @@ -module.exports = { +module.exports = defineTest({ description: 'merges namespaces with live-bindings', options: { external: ['external1', 'external2'], plugins: [ { + name: 'test', transform() { return { syntheticNamedExports: '__synthetic' }; } } ] } -}; +}); diff --git a/test/form/samples/minimal-this-mutation/_config.js b/test/form/samples/minimal-this-mutation/_config.js index d0cecf5de3d..4a103617241 100644 --- a/test/form/samples/minimal-this-mutation/_config.js +++ b/test/form/samples/minimal-this-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'mutates "this" only if necessary on function calls' -}; +}); diff --git a/test/form/samples/mjs/_config.js b/test/form/samples/mjs/_config.js index 60c794c3f75..715a733d317 100644 --- a/test/form/samples/mjs/_config.js +++ b/test/form/samples/mjs/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'supports loading mjs with precedence', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/modify-class-prototype/_config.js b/test/form/samples/modify-class-prototype/_config.js index dbb4ba7c10b..e72a389e0d7 100644 --- a/test/form/samples/modify-class-prototype/_config.js +++ b/test/form/samples/modify-class-prototype/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shakes prototype modifications of classes' -}; +}); diff --git a/test/form/samples/modify-export-semi/_config.js b/test/form/samples/modify-export-semi/_config.js index fdfad5c045b..940d37cb3bc 100644 --- a/test/form/samples/modify-export-semi/_config.js +++ b/test/form/samples/modify-export-semi/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'inserts semicolons correctly when modifying SystemJS exports', formats: ['system'] -}; +}); diff --git a/test/form/samples/module-name-scoped-package/_config.js b/test/form/samples/module-name-scoped-package/_config.js index 626820672e1..f8007adfdf8 100644 --- a/test/form/samples/module-name-scoped-package/_config.js +++ b/test/form/samples/module-name-scoped-package/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows module name with dashes to be added to the global object', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: '@scoped/npm-package' } } -}; +}); diff --git a/test/form/samples/module-name-wat/_config.js b/test/form/samples/module-name-wat/_config.js index 9ad3bdab211..ba778abf7a4 100644 --- a/test/form/samples/module-name-wat/_config.js +++ b/test/form/samples/module-name-wat/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'properly dereferences properties on the global object regardless of nesting', options: { output: { name: 'foo.@scoped/npm-package.bar.why-would-you-do-this' } } -}; +}); diff --git a/test/form/samples/module-name-with-dashes/_config.js b/test/form/samples/module-name-with-dashes/_config.js index 81896a88172..635eda74c3b 100644 --- a/test/form/samples/module-name-with-dashes/_config.js +++ b/test/form/samples/module-name-with-dashes/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows module name with dashes to be added to the global object', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'module-name-with-dashes' } } -}; +}); diff --git a/test/form/samples/module-no-treeshake/_config.js b/test/form/samples/module-no-treeshake/_config.js index cc6f3fede85..db7e5f18a88 100644 --- a/test/form/samples/module-no-treeshake/_config.js +++ b/test/form/samples/module-no-treeshake/_config.js @@ -2,7 +2,7 @@ function getCode(id) { return `const unused = 'unused in ${id}';`; } -module.exports = { +module.exports = defineTest({ description: 'allows disabling tree-shaking for modules', options: { plugins: { @@ -38,4 +38,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/multi-expression-calls/_config.js b/test/form/samples/multi-expression-calls/_config.js index 5ba44790f77..80292784761 100644 --- a/test/form/samples/multi-expression-calls/_config.js +++ b/test/form/samples/multi-expression-calls/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles side-effect-free multi-expressions' -}; +}); diff --git a/test/form/samples/multiple-exports/_config.js b/test/form/samples/multiple-exports/_config.js index fb5a9c63a72..1ae72acd952 100644 --- a/test/form/samples/multiple-exports/_config.js +++ b/test/form/samples/multiple-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'multiple named exports', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/mutations-in-imports/_config.js b/test/form/samples/mutations-in-imports/_config.js index bfb50011d5e..6adcaee7b4d 100644 --- a/test/form/samples/mutations-in-imports/_config.js +++ b/test/form/samples/mutations-in-imports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track mutations of imports' -}; +}); diff --git a/test/form/samples/namespace-conflict/_config.js b/test/form/samples/namespace-conflict/_config.js index e0e9e8cf881..da7e20ebf22 100644 --- a/test/form/samples/namespace-conflict/_config.js +++ b/test/form/samples/namespace-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'replaces conflicting namespace properties with undefined', expectedWarnings: ['NAMESPACE_CONFLICT', 'MISSING_EXPORT'] -}; +}); diff --git a/test/form/samples/namespace-import-reexport-2/_config.js b/test/form/samples/namespace-import-reexport-2/_config.js index a8be2ee28c8..d21220d4db9 100644 --- a/test/form/samples/namespace-import-reexport-2/_config.js +++ b/test/form/samples/namespace-import-reexport-2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around functions', options: { external: ['external1', 'external2'], @@ -7,4 +7,4 @@ module.exports = { name: 'iife' } } -}; +}); diff --git a/test/form/samples/namespace-import-reexport/_config.js b/test/form/samples/namespace-import-reexport/_config.js index 3530557b978..eaf653150ce 100644 --- a/test/form/samples/namespace-import-reexport/_config.js +++ b/test/form/samples/namespace-import-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly associate or shadow variables in and around functions', options: { external: ['external-package'], @@ -7,4 +7,4 @@ module.exports = { name: 'iife' } } -}; +}); diff --git a/test/form/samples/namespace-missing-export-effects/_config.js b/test/form/samples/namespace-missing-export-effects/_config.js index 87a35ab8485..11446e94688 100644 --- a/test/form/samples/namespace-missing-export-effects/_config.js +++ b/test/form/samples/namespace-missing-export-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles interacting with missing namespace members', expectedWarnings: ['MISSING_EXPORT'] -}; +}); diff --git a/test/form/samples/namespace-object-import/_config.js b/test/form/samples/namespace-object-import/_config.js index 010ac0d5f9d..cdd9a10a2ce 100644 --- a/test/form/samples/namespace-object-import/_config.js +++ b/test/form/samples/namespace-object-import/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'properly encodes reserved names if namespace import is used', options: { input: ['main.js'] } -}; +}); diff --git a/test/form/samples/namespace-optimization-b/_config.js b/test/form/samples/namespace-optimization-b/_config.js index fb36203de4a..2d09245c688 100644 --- a/test/form/samples/namespace-optimization-b/_config.js +++ b/test/form/samples/namespace-optimization-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'it does static lookup optimization of internal namespaces, coping with multiple namespaces in one function' -}; +}); diff --git a/test/form/samples/namespace-optimization-computed-string/_config.js b/test/form/samples/namespace-optimization-computed-string/_config.js index 1e58a85afb5..704326185fa 100644 --- a/test/form/samples/namespace-optimization-computed-string/_config.js +++ b/test/form/samples/namespace-optimization-computed-string/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'it does dynamic lookup optimization of internal namespaces for string-literal keys' -}; +}); diff --git a/test/form/samples/namespace-optimization/_config.js b/test/form/samples/namespace-optimization/_config.js index ec882435252..88e1dacf88a 100644 --- a/test/form/samples/namespace-optimization/_config.js +++ b/test/form/samples/namespace-optimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'it does static lookup optimization of internal namespaces' -}; +}); diff --git a/test/form/samples/namespace-reexport-name/_config.js b/test/form/samples/namespace-reexport-name/_config.js index 107e5e04a0e..457788b4116 100644 --- a/test/form/samples/namespace-reexport-name/_config.js +++ b/test/form/samples/namespace-reexport-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct names when reexporting from namespace reexports (#4049)', options: { external: 'external', output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/namespace-self-import/_config.js b/test/form/samples/namespace-self-import/_config.js index cd21e5703f8..0400c5303cb 100644 --- a/test/form/samples/namespace-self-import/_config.js +++ b/test/form/samples/namespace-self-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'namespace early import hoisting', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { @@ -6,4 +6,4 @@ module.exports = { name: 'iife' } } -}; +}); diff --git a/test/form/samples/namespace-tostring/entry-default/_config.js b/test/form/samples/namespace-tostring/entry-default/_config.js index 210c3b4ee86..b0971867c35 100644 --- a/test/form/samples/namespace-tostring/entry-default/_config.js +++ b/test/form/samples/namespace-tostring/entry-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not add Symbol.toStringTag property to entry chunks with default export mode', options: { output: { @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/namespace-tostring/entry-named/_config.js b/test/form/samples/namespace-tostring/entry-named/_config.js index 69452db2796..b0a2337b448 100644 --- a/test/form/samples/namespace-tostring/entry-named/_config.js +++ b/test/form/samples/namespace-tostring/entry-named/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to entry chunks with named exports', options: { output: { @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/namespace-tostring/external-namespaces/_config.js b/test/form/samples/namespace-tostring/external-namespaces/_config.js index 64090cfc77f..ad8b50cc11a 100644 --- a/test/form/samples/namespace-tostring/external-namespaces/_config.js +++ b/test/form/samples/namespace-tostring/external-namespaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to external namespaces', options: { external(id) { @@ -29,4 +29,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/namespace-tostring/inlined-namespace-static-resolution/_config.js b/test/form/samples/namespace-tostring/inlined-namespace-static-resolution/_config.js index afa80193c59..0b1bcb348c6 100644 --- a/test/form/samples/namespace-tostring/inlined-namespace-static-resolution/_config.js +++ b/test/form/samples/namespace-tostring/inlined-namespace-static-resolution/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'statically resolves Symbol.toStringTag for inlined namespaces', expectedWarnings: ['MISSING_EXPORT'], options: { @@ -6,4 +6,4 @@ module.exports = { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/form/samples/namespace-tostring/inlined-namespace/_config.js b/test/form/samples/namespace-tostring/inlined-namespace/_config.js index 4e489178028..84f1a0b3d2c 100644 --- a/test/form/samples/namespace-tostring/inlined-namespace/_config.js +++ b/test/form/samples/namespace-tostring/inlined-namespace/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to inlined namespaces', options: { output: { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/form/samples/namespaced-default-exports/_config.js b/test/form/samples/namespaced-default-exports/_config.js index 547e6ad2e2d..78f1c95d7a1 100644 --- a/test/form/samples/namespaced-default-exports/_config.js +++ b/test/form/samples/namespaced-default-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates namespaced module names', options: { output: { name: 'foo.bar.baz' } } -}; +}); diff --git a/test/form/samples/namespaced-named-exports/_config.js b/test/form/samples/namespaced-named-exports/_config.js index 547e6ad2e2d..78f1c95d7a1 100644 --- a/test/form/samples/namespaced-named-exports/_config.js +++ b/test/form/samples/namespaced-named-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'creates namespaced module names', options: { output: { name: 'foo.bar.baz' } } -}; +}); diff --git a/test/form/samples/namespaces-have-null-prototype/_config.js b/test/form/samples/namespaces-have-null-prototype/_config.js index faa0ac1b8e7..01d92a96f28 100644 --- a/test/form/samples/namespaces-have-null-prototype/_config.js +++ b/test/form/samples/namespaces-have-null-prototype/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'creates namespaces with null prototypes', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/nested-deoptimization/_config.js b/test/form/samples/nested-deoptimization/_config.js index 440f76d3543..21cd6f596f4 100644 --- a/test/form/samples/nested-deoptimization/_config.js +++ b/test/form/samples/nested-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of nested properties' -}; +}); diff --git a/test/form/samples/nested-inlined-dynamic-import/_config.js b/test/form/samples/nested-inlined-dynamic-import/_config.js index 11403c10e01..da6eca5d69a 100644 --- a/test/form/samples/nested-inlined-dynamic-import/_config.js +++ b/test/form/samples/nested-inlined-dynamic-import/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables when nested dynamic imports are inlined', options: { output: { inlineDynamicImports: true } } -}; +}); diff --git a/test/form/samples/nested-member-access/_config.js b/test/form/samples/nested-member-access/_config.js index 7c37a494f01..e15fc6430df 100644 --- a/test/form/samples/nested-member-access/_config.js +++ b/test/form/samples/nested-member-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'throw an error when accessing members of null or undefined' -}; +}); diff --git a/test/form/samples/nested-pure-comments/_config.js b/test/form/samples/nested-pure-comments/_config.js index 27977b096bd..0891a42f0da 100644 --- a/test/form/samples/nested-pure-comments/_config.js +++ b/test/form/samples/nested-pure-comments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly associates pure comments before sequence expressions etc.' -}; +}); diff --git a/test/form/samples/nested-this-expressions/_config.js b/test/form/samples/nested-this-expressions/_config.js index ec7aac395ed..d54b9366b3d 100644 --- a/test/form/samples/nested-this-expressions/_config.js +++ b/test/form/samples/nested-this-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly keep or ignore nested "this"-expressions' -}; +}); diff --git a/test/form/samples/nested-tree-shaking/_config.js b/test/form/samples/nested-tree-shaking/_config.js index 44335e294be..07001ced025 100644 --- a/test/form/samples/nested-tree-shaking/_config.js +++ b/test/form/samples/nested-tree-shaking/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unused nested statements' -}; +}); diff --git a/test/form/samples/new-target-meta-property/_config.js b/test/form/samples/new-target-meta-property/_config.js index 0b9edf38046..4a3867dbb81 100644 --- a/test/form/samples/new-target-meta-property/_config.js +++ b/test/form/samples/new-target-meta-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports the new.target meta property' -}; +}); diff --git a/test/form/samples/no-external-live-bindings-compact/_config.js b/test/form/samples/no-external-live-bindings-compact/_config.js index 33a7445e319..df3e7448f7b 100644 --- a/test/form/samples/no-external-live-bindings-compact/_config.js +++ b/test/form/samples/no-external-live-bindings-compact/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Allows omitting the code that handles external live bindings in compact mode', options: { external: () => true, @@ -13,4 +13,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/no-external-live-bindings/_config.js b/test/form/samples/no-external-live-bindings/_config.js index 30303d219e2..27dc80bbb56 100644 --- a/test/form/samples/no-external-live-bindings/_config.js +++ b/test/form/samples/no-external-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Allows omitting the code that handles external live bindings', options: { external: () => true, @@ -12,4 +12,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/form/samples/no-imports-or-exports/_config.js b/test/form/samples/no-imports-or-exports/_config.js index 88d37593495..aa847d49b30 100644 --- a/test/form/samples/no-imports-or-exports/_config.js +++ b/test/form/samples/no-imports-or-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'single module, no imports or exports' -}; +}); diff --git a/test/form/samples/no-treeshake-conflict/_config.js b/test/form/samples/no-treeshake-conflict/_config.js index 76055873d17..eb63f37d959 100644 --- a/test/form/samples/no-treeshake-conflict/_config.js +++ b/test/form/samples/no-treeshake-conflict/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'does not introduce conflicting variables with treeshake: false', options: { output: { name: /* not shaken, but */ 'stirred' }, treeshake: false } -}; +}); diff --git a/test/form/samples/no-treeshake-default-export-conflict/_config.js b/test/form/samples/no-treeshake-default-export-conflict/_config.js index b312d610d77..0502768db48 100644 --- a/test/form/samples/no-treeshake-default-export-conflict/_config.js +++ b/test/form/samples/no-treeshake-default-export-conflict/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'properly deconflicts default exports when not tree-shaking', options: { treeshake: false } -}; +}); diff --git a/test/form/samples/no-treeshake-include-labels/_config.js b/test/form/samples/no-treeshake-include-labels/_config.js index fc8487608b1..3e2a1f75970 100644 --- a/test/form/samples/no-treeshake-include-labels/_config.js +++ b/test/form/samples/no-treeshake-include-labels/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'always includes labels when tree-shaking is turned off (#3473)', expectedWarnings: ['CIRCULAR_DEPENDENCY'], options: { treeshake: false } -}; +}); diff --git a/test/form/samples/no-treeshake-namespace-object/_config.js b/test/form/samples/no-treeshake-namespace-object/_config.js index dc6136f8ded..58637fb03e5 100644 --- a/test/form/samples/no-treeshake-namespace-object/_config.js +++ b/test/form/samples/no-treeshake-namespace-object/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'generates namespace objects when not tree-shaking', options: { treeshake: false } -}; +}); diff --git a/test/form/samples/no-treeshake/_config.js b/test/form/samples/no-treeshake/_config.js index e49231de636..bb626f86bb2 100644 --- a/test/form/samples/no-treeshake/_config.js +++ b/test/form/samples/no-treeshake/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'all code should be included if tree-shaking is disabled', options: { external: ['external'], @@ -9,4 +9,4 @@ module.exports = { inlineDynamicImports: true } } -}; +}); diff --git a/test/form/samples/non-empty-block-statement/_config.js b/test/form/samples/non-empty-block-statement/_config.js index 92803d709a4..0842b108698 100644 --- a/test/form/samples/non-empty-block-statement/_config.js +++ b/test/form/samples/non-empty-block-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not remove non an empty block statement' -}; +}); diff --git a/test/form/samples/ns-external-star-reexport/_config.js b/test/form/samples/ns-external-star-reexport/_config.js index 06cdf4d0268..506491a8046 100644 --- a/test/form/samples/ns-external-star-reexport/_config.js +++ b/test/form/samples/ns-external-star-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports namespaces with external star reexports', options: { external: ['external1', 'external2'], @@ -21,4 +21,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/nullish-coalescing/_config.js b/test/form/samples/nullish-coalescing/_config.js index 0999be29d39..e5e84bbdbc1 100644 --- a/test/form/samples/nullish-coalescing/_config.js +++ b/test/form/samples/nullish-coalescing/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports tree-shaking with nullish-coalescing' -}; +}); diff --git a/test/form/samples/numeric_separators/_config.js b/test/form/samples/numeric_separators/_config.js index 1809c1b9e07..35361d09a58 100644 --- a/test/form/samples/numeric_separators/_config.js +++ b/test/form/samples/numeric_separators/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports numeric separators' -}; +}); diff --git a/test/form/samples/object-define-property/_config.js b/test/form/samples/object-define-property/_config.js index 406267436f3..db74095ed16 100644 --- a/test/form/samples/object-define-property/_config.js +++ b/test/form/samples/object-define-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows globals to have parameter mutation side effects' -}; +}); diff --git a/test/form/samples/object-destructuring-default-values/_config.js b/test/form/samples/object-destructuring-default-values/_config.js index c4ccc90db14..2ccf86cc27a 100644 --- a/test/form/samples/object-destructuring-default-values/_config.js +++ b/test/form/samples/object-destructuring-default-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'object destructuring default values are preserved' -}; +}); diff --git a/test/form/samples/object-expression/computed-properties/_config.js b/test/form/samples/object-expression/computed-properties/_config.js index e306359eb2b..9d89548d6b2 100644 --- a/test/form/samples/object-expression/computed-properties/_config.js +++ b/test/form/samples/object-expression/computed-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Associates non-string keys with string keys' -}; +}); diff --git a/test/form/samples/object-expression/method-side-effects/_config.js b/test/form/samples/object-expression/method-side-effects/_config.js index efbb2502435..d6c47c7a8e4 100644 --- a/test/form/samples/object-expression/method-side-effects/_config.js +++ b/test/form/samples/object-expression/method-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Track side-effects of method calls' -}; +}); diff --git a/test/form/samples/object-expression/nested-literal-assignment-without-access-side-effect/_config.js b/test/form/samples/object-expression/nested-literal-assignment-without-access-side-effect/_config.js index 176ab160d77..48a69f2f7c3 100644 --- a/test/form/samples/object-expression/nested-literal-assignment-without-access-side-effect/_config.js +++ b/test/form/samples/object-expression/nested-literal-assignment-without-access-side-effect/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'treats mutating nested properties as side effects', options: { treeshake: { propertyReadSideEffects: false } } -}; +}); diff --git a/test/form/samples/object-expression/nested-literal-value-without-access-side-effect/_config.js b/test/form/samples/object-expression/nested-literal-value-without-access-side-effect/_config.js index fdda6575331..fb7f8e68d4e 100644 --- a/test/form/samples/object-expression/nested-literal-value-without-access-side-effect/_config.js +++ b/test/form/samples/object-expression/nested-literal-value-without-access-side-effect/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'uses an unknown value for nested properties', options: { treeshake: { propertyReadSideEffects: false } } -}; +}); diff --git a/test/form/samples/object-expression/proto-property/_config.js b/test/form/samples/object-expression/proto-property/_config.js index f70608e1109..6d30962f73e 100644 --- a/test/form/samples/object-expression/proto-property/_config.js +++ b/test/form/samples/object-expression/proto-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Deoptimize when __proto__ is used' -}; +}); diff --git a/test/form/samples/object-expression/reassign-prop-without-proto/_config.js b/test/form/samples/object-expression/reassign-prop-without-proto/_config.js index a46300f406f..131e3581fbf 100644 --- a/test/form/samples/object-expression/reassign-prop-without-proto/_config.js +++ b/test/form/samples/object-expression/reassign-prop-without-proto/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly deoptimizes when there is no proto' -}; +}); diff --git a/test/form/samples/object-expression/return-expressions/_config.js b/test/form/samples/object-expression/return-expressions/_config.js index 8e3a8d7be88..0a0a701310f 100644 --- a/test/form/samples/object-expression/return-expressions/_config.js +++ b/test/form/samples/object-expression/return-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Track side-effects of method return values' -}; +}); diff --git a/test/form/samples/object-expression/unknown-getter-no-side-effect/_config.js b/test/form/samples/object-expression/unknown-getter-no-side-effect/_config.js index a5dcc719eaa..709d2882c58 100644 --- a/test/form/samples/object-expression/unknown-getter-no-side-effect/_config.js +++ b/test/form/samples/object-expression/unknown-getter-no-side-effect/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unknown getter access without side effect', options: { external: ['external'] } -}; +}); diff --git a/test/form/samples/object-expression/unknown-setter-no-side-effect/_config.js b/test/form/samples/object-expression/unknown-setter-no-side-effect/_config.js index 1d59c54d22e..3fc7e1153f8 100644 --- a/test/form/samples/object-expression/unknown-setter-no-side-effect/_config.js +++ b/test/form/samples/object-expression/unknown-setter-no-side-effect/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unknown setter access without side effect', options: { external: ['external'] } -}; +}); diff --git a/test/form/samples/object-expression/unknown-setter-no-side-effect2/_config.js b/test/form/samples/object-expression/unknown-setter-no-side-effect2/_config.js index 1d59c54d22e..3fc7e1153f8 100644 --- a/test/form/samples/object-expression/unknown-setter-no-side-effect2/_config.js +++ b/test/form/samples/object-expression/unknown-setter-no-side-effect2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unknown setter access without side effect', options: { external: ['external'] } -}; +}); diff --git a/test/form/samples/object-freeze-effects/_config.js b/test/form/samples/object-freeze-effects/_config.js index 4808999695c..ffcabf6b9c8 100644 --- a/test/form/samples/object-freeze-effects/_config.js +++ b/test/form/samples/object-freeze-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Only treats Object.freeze as a side effect if the argument is used' -}; +}); diff --git a/test/form/samples/object-literal-property-overwrites/_config.js b/test/form/samples/object-literal-property-overwrites/_config.js index 4c75daffbfe..3cba590ed04 100644 --- a/test/form/samples/object-literal-property-overwrites/_config.js +++ b/test/form/samples/object-literal-property-overwrites/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detect side-effects in overwritten properties of object literals' -}; +}); diff --git a/test/form/samples/optional-chaining-namespace/_config.js b/test/form/samples/optional-chaining-namespace/_config.js index 439fa892fa4..2d1ba8212d1 100644 --- a/test/form/samples/optional-chaining-namespace/_config.js +++ b/test/form/samples/optional-chaining-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports optional chaining with namespace objects', expectedWarnings: ['MISSING_EXPORT'] -}; +}); diff --git a/test/form/samples/optional-chaining/_config.js b/test/form/samples/optional-chaining/_config.js index bce6f6fb4b3..5e42ad28cc9 100644 --- a/test/form/samples/optional-chaining/_config.js +++ b/test/form/samples/optional-chaining/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports optional chaining' -}; +}); diff --git a/test/form/samples/output-named-library/_config.js b/test/form/samples/output-named-library/_config.js index bb37cc45848..4acdc45e007 100644 --- a/test/form/samples/output-named-library/_config.js +++ b/test/form/samples/output-named-library/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'names bundles correctly', options: { output: { name: 'libraryName' } } -}; +}); diff --git a/test/form/samples/override-external-namespace/_config.js b/test/form/samples/override-external-namespace/_config.js index 9fcd9fb2c12..c33580bec8d 100644 --- a/test/form/samples/override-external-namespace/_config.js +++ b/test/form/samples/override-external-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows overriding imports of external namespace reexports', options: { external: 'external', @@ -7,4 +7,4 @@ module.exports = { globals: { external: 'external' } } } -}; +}); diff --git a/test/form/samples/paths-function/_config.js b/test/form/samples/paths-function/_config.js index 726db0d85e4..8774240954f 100644 --- a/test/form/samples/paths-function/_config.js +++ b/test/form/samples/paths-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external paths (#754)', options: { external: ['foo'], @@ -7,4 +7,4 @@ module.exports = { paths: id => `https://unpkg.com/${id}` } } -}; +}); diff --git a/test/form/samples/paths-relative/_config.js b/test/form/samples/paths-relative/_config.js index 766414f0cca..95a73fc1e7e 100644 --- a/test/form/samples/paths-relative/_config.js +++ b/test/form/samples/paths-relative/_config.js @@ -2,7 +2,7 @@ const { resolve } = require('node:path'); const resolved = resolve(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'external paths (#754)', options: { external: [resolved], @@ -11,4 +11,4 @@ module.exports = { paths: { [resolved]: '../foo' } } } -}; +}); diff --git a/test/form/samples/paths/_config.js b/test/form/samples/paths/_config.js index ef23638a0ef..02fa7cf93cf 100644 --- a/test/form/samples/paths/_config.js +++ b/test/form/samples/paths/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external paths (#754)', options: { external: ['foo'], @@ -7,4 +7,4 @@ module.exports = { paths: { foo: 'https://unpkg.com/foo' } } } -}; +}); diff --git a/test/form/samples/pattern-assignments/_config.js b/test/form/samples/pattern-assignments/_config.js index a884052961f..301549b66bd 100644 --- a/test/form/samples/pattern-assignments/_config.js +++ b/test/form/samples/pattern-assignments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Make sure side-effects are passed along destructuring assignments', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/pattern-member-expressions/_config.js b/test/form/samples/pattern-member-expressions/_config.js index aa93889f9e6..1125577d403 100644 --- a/test/form/samples/pattern-member-expressions/_config.js +++ b/test/form/samples/pattern-member-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles member expressions in patterns (#2750)' -}; +}); diff --git a/test/form/samples/per-output-plugins/_config.js b/test/form/samples/per-output-plugins/_config.js index 8045837e438..1f5aaee6f58 100644 --- a/test/form/samples/per-output-plugins/_config.js +++ b/test/form/samples/per-output-plugins/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows specifying per-output plugins', options: { output: { @@ -17,4 +17,4 @@ module.exports = { ] } } -}; +}); diff --git a/test/form/samples/preserve-asm-js/_config.js b/test/form/samples/preserve-asm-js/_config.js index af8fa8dd5ca..47b606014c8 100644 --- a/test/form/samples/preserve-asm-js/_config.js +++ b/test/form/samples/preserve-asm-js/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Preserves asm.js code (#3360)' -}; +}); diff --git a/test/form/samples/preserve-debugger/_config.js b/test/form/samples/preserve-debugger/_config.js index 3e658157910..7cc40b3c70f 100644 --- a/test/form/samples/preserve-debugger/_config.js +++ b/test/form/samples/preserve-debugger/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'debugger statements are preserved (#664)' -}; +}); diff --git a/test/form/samples/preserves-comments-after-imports/_config.js b/test/form/samples/preserves-comments-after-imports/_config.js index 7b4cc9f7a57..92be92333a2 100644 --- a/test/form/samples/preserves-comments-after-imports/_config.js +++ b/test/form/samples/preserves-comments-after-imports/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves comments between imports and first statement', options: { output: { name: 'myBundle' } } -}; +}); // https://github.com/esperantojs/esperanto/issues/187 diff --git a/test/form/samples/probe-external-namespace/_config.js b/test/form/samples/probe-external-namespace/_config.js index d4034bec1c6..5e6aef7b409 100644 --- a/test/form/samples/probe-external-namespace/_config.js +++ b/test/form/samples/probe-external-namespace/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allow probing external namespaces without causing errors due to missing imports', options: { external: 'external' } -}; +}); diff --git a/test/form/samples/promises/_config.js b/test/form/samples/promises/_config.js index c4e9dee1854..6de517042c0 100644 --- a/test/form/samples/promises/_config.js +++ b/test/form/samples/promises/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not remove promise creations' -}; +}); diff --git a/test/form/samples/proper-this-context/_config.js b/test/form/samples/proper-this-context/_config.js index 65fe62b2171..ac5bd4fe960 100644 --- a/test/form/samples/proper-this-context/_config.js +++ b/test/form/samples/proper-this-context/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'make sure "this" respects the context for arrow functions', expectedWarnings: ['THIS_IS_UNDEFINED'] -}; +}); diff --git a/test/form/samples/property-setters-and-getters/access-when-called-effect/_config.js b/test/form/samples/property-setters-and-getters/access-when-called-effect/_config.js index ae85f1ce6c6..e0bc1344b13 100644 --- a/test/form/samples/property-setters-and-getters/access-when-called-effect/_config.js +++ b/test/form/samples/property-setters-and-getters/access-when-called-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'respects access side-effects when calling a getter' -}; +}); diff --git a/test/form/samples/property-setters-and-getters/early-access-getter-return/_config.js b/test/form/samples/property-setters-and-getters/early-access-getter-return/_config.js index bbfa47e1932..75c9558cad7 100644 --- a/test/form/samples/property-setters-and-getters/early-access-getter-return/_config.js +++ b/test/form/samples/property-setters-and-getters/early-access-getter-return/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles accessing the return expression of a getter before it has been bound' -}; +}); diff --git a/test/form/samples/property-setters-and-getters/early-access-getter-value/_config.js b/test/form/samples/property-setters-and-getters/early-access-getter-value/_config.js index e362145ba90..ec933e312db 100644 --- a/test/form/samples/property-setters-and-getters/early-access-getter-value/_config.js +++ b/test/form/samples/property-setters-and-getters/early-access-getter-value/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles accessing the value of a getter before it has been bound' -}; +}); diff --git a/test/form/samples/property-setters-and-getters/shadowed-setters/_config.js b/test/form/samples/property-setters-and-getters/shadowed-setters/_config.js index f220613b295..05a902af786 100644 --- a/test/form/samples/property-setters-and-getters/shadowed-setters/_config.js +++ b/test/form/samples/property-setters-and-getters/shadowed-setters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles setters shadowed by computed setters' -}; +}); diff --git a/test/form/samples/protect-cjs-globals/_config.js b/test/form/samples/protect-cjs-globals/_config.js index 5d2d5ac0718..feb61230e93 100644 --- a/test/form/samples/protect-cjs-globals/_config.js +++ b/test/form/samples/protect-cjs-globals/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'prevent conflicts with cjs module globals', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/proto-null/_config.js b/test/form/samples/proto-null/_config.js index cdbdcecf206..795ccf6aa52 100644 --- a/test/form/samples/proto-null/_config.js +++ b/test/form/samples/proto-null/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters and setters on __proto__ properties' -}; +}); diff --git a/test/form/samples/prototype-functions/_config.js b/test/form/samples/prototype-functions/_config.js index 620b36d549c..e27b9eee8b4 100644 --- a/test/form/samples/prototype-functions/_config.js +++ b/test/form/samples/prototype-functions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly includes prototype functions' -}; +}); diff --git a/test/form/samples/prune-pure-unused-import-array/_config.js b/test/form/samples/prune-pure-unused-import-array/_config.js index 4d9035fa705..92fd5a33f26 100644 --- a/test/form/samples/prune-pure-unused-import-array/_config.js +++ b/test/form/samples/prune-pure-unused-import-array/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'prunes pure unused external imports ([#1352])', options: { external: ['external', 'other'], @@ -7,4 +7,4 @@ module.exports = { globals: { other: 'other' } } } -}; +}); diff --git a/test/form/samples/prune-pure-unused-import-function/_config.js b/test/form/samples/prune-pure-unused-import-function/_config.js index c682d7c9920..7b2e9251f9b 100644 --- a/test/form/samples/prune-pure-unused-import-function/_config.js +++ b/test/form/samples/prune-pure-unused-import-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'prunes pure unused external imports ([#1352])', expectedWarnings: ['EMPTY_BUNDLE'], options: { @@ -8,4 +8,4 @@ module.exports = { globals: { other: 'other' } } } -}; +}); diff --git a/test/form/samples/prune-pure-unused-import/_config.js b/test/form/samples/prune-pure-unused-import/_config.js index a3236e50639..8b173901600 100644 --- a/test/form/samples/prune-pure-unused-import/_config.js +++ b/test/form/samples/prune-pure-unused-import/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'prunes pure unused external imports ([#1352])', expectedWarnings: ['EMPTY_BUNDLE'], options: { external: ['external', 'other'], treeshake: { moduleSideEffects: 'no-external' } } -}; +}); diff --git a/test/form/samples/pure-class-field/_config.js b/test/form/samples/pure-class-field/_config.js index d2fd9bd5e0a..8f51cca1499 100644 --- a/test/form/samples/pure-class-field/_config.js +++ b/test/form/samples/pure-class-field/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains pure annotations in class fields' -}; +}); diff --git a/test/form/samples/pure-comment-line-break/_config.js b/test/form/samples/pure-comment-line-break/_config.js index 3a1351bf2fd..7e663b33fba 100644 --- a/test/form/samples/pure-comment-line-break/_config.js +++ b/test/form/samples/pure-comment-line-break/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adjust line-break handling when dealing with pure annotations' -}; +}); diff --git a/test/form/samples/pure-comment-scenarios-complex/_config.js b/test/form/samples/pure-comment-scenarios-complex/_config.js index d045ae566bc..9d7bbd86f74 100644 --- a/test/form/samples/pure-comment-scenarios-complex/_config.js +++ b/test/form/samples/pure-comment-scenarios-complex/_config.js @@ -1,5 +1,5 @@ // tests compiled from https://github.com/mishoo/UglifyJS2/blob/bcebacbb9e7ddac7d9c0e4ca2c7e0faf0e0bca7c/test/compress/issue-1261.js -module.exports = { +module.exports = defineTest({ description: 'correctly handles various advanced pure comment scenarios' -}; +}); diff --git a/test/form/samples/pure-comment-scenarios-simple/_config.js b/test/form/samples/pure-comment-scenarios-simple/_config.js index 71266b1bba0..910ed394609 100644 --- a/test/form/samples/pure-comment-scenarios-simple/_config.js +++ b/test/form/samples/pure-comment-scenarios-simple/_config.js @@ -1,5 +1,5 @@ // tests compiled from https://github.com/mishoo/UglifyJS2/blob/88c8f4e363e0d585b33ea29df560243d3dc74ce1/test/compress/pure_funcs.js -module.exports = { +module.exports = defineTest({ description: 'correctly handles various pure comment scenarios' -}; +}); diff --git a/test/form/samples/pure-comments-disabled/_config.js b/test/form/samples/pure-comments-disabled/_config.js index bd647a41ced..ab9f764957f 100644 --- a/test/form/samples/pure-comments-disabled/_config.js +++ b/test/form/samples/pure-comments-disabled/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'does not rely on pure annotations if they are disabled', options: { treeshake: { annotations: false } } -}; +}); diff --git a/test/form/samples/pure-comments-multiple/_config.js b/test/form/samples/pure-comments-multiple/_config.js index 3c29e89762d..4793b277007 100644 --- a/test/form/samples/pure-comments-multiple/_config.js +++ b/test/form/samples/pure-comments-multiple/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not associate multiple "pure" comments before a token with subsequent tokens' -}; +}); diff --git a/test/form/samples/quote-id/_config.js b/test/form/samples/quote-id/_config.js index eea91ce4747..1ab581f9beb 100644 --- a/test/form/samples/quote-id/_config.js +++ b/test/form/samples/quote-id/_config.js @@ -4,7 +4,7 @@ const external1 = "quoted'\r\n\u2028\u2029external1"; const external2 = path.join(__dirname, "quoted'\r\n\u2028\u2029external2"); const external3 = 'C:\\File\\Path.js'; -module.exports = { +module.exports = defineTest({ description: 'handles escaping for external ids', options: { output: { @@ -35,4 +35,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/re-export-aliasing/_config.js b/test/form/samples/re-export-aliasing/_config.js index ae834c41d3e..ea6d8f7afa8 100644 --- a/test/form/samples/re-export-aliasing/_config.js +++ b/test/form/samples/re-export-aliasing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external re-exports aliasing', options: { output: { @@ -7,4 +7,4 @@ module.exports = { }, external: ['d'] } -}; +}); diff --git a/test/form/samples/reassigned-exported-functions-and-classes/_config.js b/test/form/samples/reassigned-exported-functions-and-classes/_config.js index 3f84a3334e9..6e812b8c2b6 100644 --- a/test/form/samples/reassigned-exported-functions-and-classes/_config.js +++ b/test/form/samples/reassigned-exported-functions-and-classes/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'use legal names for exported functions and classed (#1943)', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/recursive-assignments/_config.js b/test/form/samples/recursive-assignments/_config.js index f14e7c21536..6ff9daff98b 100644 --- a/test/form/samples/recursive-assignments/_config.js +++ b/test/form/samples/recursive-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not fail for pathological recursive algorithms and circular structures' -}; +}); diff --git a/test/form/samples/recursive-calls/_config.js b/test/form/samples/recursive-calls/_config.js index 7258d5addec..436814b9b3c 100644 --- a/test/form/samples/recursive-calls/_config.js +++ b/test/form/samples/recursive-calls/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not fail for recursive calls' -}; +}); diff --git a/test/form/samples/recursive-computed-members/_config.js b/test/form/samples/recursive-computed-members/_config.js index acd88490a08..ecc9fdd967f 100644 --- a/test/form/samples/recursive-computed-members/_config.js +++ b/test/form/samples/recursive-computed-members/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handle recursive computed member access' -}; +}); diff --git a/test/form/samples/recursive-literal-values/_config.js b/test/form/samples/recursive-literal-values/_config.js index 490e29b384d..1115a0327ab 100644 --- a/test/form/samples/recursive-literal-values/_config.js +++ b/test/form/samples/recursive-literal-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not fail for literal values from recursive return values' -}; +}); diff --git a/test/form/samples/recursive-multi-expressions/_config.js b/test/form/samples/recursive-multi-expressions/_config.js index 44fd55b6d27..ca9d39b7ffb 100644 --- a/test/form/samples/recursive-multi-expressions/_config.js +++ b/test/form/samples/recursive-multi-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles recursive multi-expressions' -}; +}); diff --git a/test/form/samples/recursive-return-value-assignments/_config.js b/test/form/samples/recursive-return-value-assignments/_config.js index 66c2c686fe9..89991001c8f 100644 --- a/test/form/samples/recursive-return-value-assignments/_config.js +++ b/test/form/samples/recursive-return-value-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handle recursive reassignments of return values' -}; +}); diff --git a/test/form/samples/recursive-this-deoptimization/_config.js b/test/form/samples/recursive-this-deoptimization/_config.js index 832af26c7e5..2d5312acb93 100644 --- a/test/form/samples/recursive-this-deoptimization/_config.js +++ b/test/form/samples/recursive-this-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles recursive "this" deoptimizations (#4089)' -}; +}); diff --git a/test/form/samples/recursive-values/_config.js b/test/form/samples/recursive-values/_config.js index f14e7c21536..6ff9daff98b 100644 --- a/test/form/samples/recursive-values/_config.js +++ b/test/form/samples/recursive-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not fail for pathological recursive algorithms and circular structures' -}; +}); diff --git a/test/form/samples/redeclarations/_config.js b/test/form/samples/redeclarations/_config.js index 17e93c970a1..ca8ad871c66 100644 --- a/test/form/samples/redeclarations/_config.js +++ b/test/form/samples/redeclarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'make sure re-declarations via var and function are linked properly' -}; +}); diff --git a/test/form/samples/reexport-external-default-and-name/_config.js b/test/form/samples/reexport-external-default-and-name/_config.js index 6e8c12c648f..855a14b84d1 100644 --- a/test/form/samples/reexport-external-default-and-name/_config.js +++ b/test/form/samples/reexport-external-default-and-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reexports a an external default as a name and imports another name from that dependency', expectedWarnings: ['MIXED_EXPORTS'], @@ -9,4 +9,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-default-and-namespace/_config.js b/test/form/samples/reexport-external-default-and-namespace/_config.js index 6af73286dd4..67438a5d09a 100644 --- a/test/form/samples/reexport-external-default-and-namespace/_config.js +++ b/test/form/samples/reexport-external-default-and-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reexports a default external import as default export (when using named exports)', options: { output: { @@ -8,4 +8,4 @@ module.exports = { }, external: ['external'] } -}; +}); diff --git a/test/form/samples/reexport-external-default-as-name-and-name/_config.js b/test/form/samples/reexport-external-default-as-name-and-name/_config.js index 5ccfb6e52a1..9c8a78dbda9 100644 --- a/test/form/samples/reexport-external-default-as-name-and-name/_config.js +++ b/test/form/samples/reexport-external-default-as-name-and-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a named external export as default', expectedWarnings: ['MIXED_EXPORTS'], options: { @@ -8,4 +8,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-default/_config.js b/test/form/samples/reexport-external-default/_config.js index 17dee117ebb..47385d4a921 100644 --- a/test/form/samples/reexport-external-default/_config.js +++ b/test/form/samples/reexport-external-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reexports an external default export', options: { external: ['external1', 'external2'], @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-name-as-default/_config.js b/test/form/samples/reexport-external-name-as-default/_config.js index 76bfd0844be..951b788645f 100644 --- a/test/form/samples/reexport-external-name-as-default/_config.js +++ b/test/form/samples/reexport-external-name-as-default/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a named external export as default', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-name-as-default2/_config.js b/test/form/samples/reexport-external-name-as-default2/_config.js index ca3e78aa86f..ef807daf442 100644 --- a/test/form/samples/reexport-external-name-as-default2/_config.js +++ b/test/form/samples/reexport-external-name-as-default2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a named external export as default via another file', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-name/_config.js b/test/form/samples/reexport-external-name/_config.js index e64e3c7b2c0..0541c9ae604 100644 --- a/test/form/samples/reexport-external-name/_config.js +++ b/test/form/samples/reexport-external-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a named export from an external module', options: { external: ['external1', 'external2'], @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-external-namespace-as/_config.js b/test/form/samples/reexport-external-namespace-as/_config.js index e2705de62c3..b2f6b3ffe03 100644 --- a/test/form/samples/reexport-external-namespace-as/_config.js +++ b/test/form/samples/reexport-external-namespace-as/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reexport external namespace as name', options: { external: 'external', @@ -7,4 +7,4 @@ module.exports = { globals: { external: 'external' } } } -}; +}); diff --git a/test/form/samples/reexport-external-namespace/_config.js b/test/form/samples/reexport-external-namespace/_config.js index 9ffdafe8b0f..9ed34a046f9 100644 --- a/test/form/samples/reexport-external-namespace/_config.js +++ b/test/form/samples/reexport-external-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports * from external module (#791)', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/reexport-self/_config.js b/test/form/samples/reexport-self/_config.js index f979e6e90b0..a7c21e50714 100644 --- a/test/form/samples/reexport-self/_config.js +++ b/test/form/samples/reexport-self/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles recursions when a module reexports its own namespace', expectedWarnings: ['CIRCULAR_DEPENDENCY'] -}; +}); diff --git a/test/form/samples/reexport-star-deshadow/_config.js b/test/form/samples/reexport-star-deshadow/_config.js index 29ceb658128..98e18c6df0f 100644 --- a/test/form/samples/reexport-star-deshadow/_config.js +++ b/test/form/samples/reexport-star-deshadow/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Star reexports scope deshadowing', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/reexport-used-external-namespace-as/_config.js b/test/form/samples/reexport-used-external-namespace-as/_config.js index cd50e2c3816..275206bb261 100644 --- a/test/form/samples/reexport-used-external-namespace-as/_config.js +++ b/test/form/samples/reexport-used-external-namespace-as/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'reexport external namespace as name if the namespace is also used', options: { external: ['external1', 'external2'], @@ -10,4 +10,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/relative-external-ids/_config.js b/test/form/samples/relative-external-ids/_config.js index 706cb8a42d4..159cea043ba 100644 --- a/test/form/samples/relative-external-ids/_config.js +++ b/test/form/samples/relative-external-ids/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'relative external ids are absolutely resolved', options: { external(id) { @@ -44,4 +44,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/relative-external-with-global/_config.js b/test/form/samples/relative-external-with-global/_config.js index 01f81afad86..eb7f4420850 100644 --- a/test/form/samples/relative-external-with-global/_config.js +++ b/test/form/samples/relative-external-with-global/_config.js @@ -2,10 +2,10 @@ const { resolve } = require('node:path'); const throttle = resolve(__dirname, 'lib/throttle.js'); -module.exports = { +module.exports = defineTest({ description: 'applies globals to externalised relative imports', options: { external: [throttle], output: { globals: { [throttle]: 'Lib.throttle' } } } -}; +}); diff --git a/test/form/samples/remove-invalid-pure-comments/_config.js b/test/form/samples/remove-invalid-pure-comments/_config.js index f3066021ab3..a05717b051f 100644 --- a/test/form/samples/remove-invalid-pure-comments/_config.js +++ b/test/form/samples/remove-invalid-pure-comments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes invalidly placed pure annotations' -}; +}); diff --git a/test/form/samples/remove-tree-shaken-pure-comments/_config.js b/test/form/samples/remove-tree-shaken-pure-comments/_config.js index 39021abc906..64d1ca3fbc6 100644 --- a/test/form/samples/remove-tree-shaken-pure-comments/_config.js +++ b/test/form/samples/remove-tree-shaken-pure-comments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes pure comments of tree-shaken nodes' -}; +}); diff --git a/test/form/samples/remove-treeshaken-banners/_config.js b/test/form/samples/remove-treeshaken-banners/_config.js index 4010568ad64..dc424e83deb 100644 --- a/test/form/samples/remove-treeshaken-banners/_config.js +++ b/test/form/samples/remove-treeshaken-banners/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Also remove banner comments when completely tree-shaking files' -}; +}); diff --git a/test/form/samples/removes-existing-sourcemap-comments/_config.js b/test/form/samples/removes-existing-sourcemap-comments/_config.js index e1b917ab239..e8a5770fe33 100644 --- a/test/form/samples/removes-existing-sourcemap-comments/_config.js +++ b/test/form/samples/removes-existing-sourcemap-comments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes existing sourcemap comments' -}; +}); diff --git a/test/form/samples/removes-unused-babel-helpers/_config.js b/test/form/samples/removes-unused-babel-helpers/_config.js index c81966dc963..9238a4c6c4e 100644 --- a/test/form/samples/removes-unused-babel-helpers/_config.js +++ b/test/form/samples/removes-unused-babel-helpers/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Removes unused babel helpers from the build (#1595)', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/renamed-pattern-defaults/_config.js b/test/form/samples/renamed-pattern-defaults/_config.js index e9b8d2cf3ae..79ca1e51cf0 100644 --- a/test/form/samples/renamed-pattern-defaults/_config.js +++ b/test/form/samples/renamed-pattern-defaults/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deconflicting of variables used as defaults in patterns (#2445)' -}; +}); diff --git a/test/form/samples/render-chunk-plugin-sourcemaps/_config.js b/test/form/samples/render-chunk-plugin-sourcemaps/_config.js index bcfbc1fc56a..08f42b02959 100644 --- a/test/form/samples/render-chunk-plugin-sourcemaps/_config.js +++ b/test/form/samples/render-chunk-plugin-sourcemaps/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports returning undefined source maps from render chunk hooks, when source maps are enabled', expectedWarnings: ['SOURCEMAP_BROKEN'], @@ -19,4 +19,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/render-chunk-plugin/_config.js b/test/form/samples/render-chunk-plugin/_config.js index 651cd70612a..bfa6037806f 100644 --- a/test/form/samples/render-chunk-plugin/_config.js +++ b/test/form/samples/render-chunk-plugin/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows plugins to hook render chunk', options: { plugins: [ @@ -14,4 +14,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/render-declaration-semicolons/_config.js b/test/form/samples/render-declaration-semicolons/_config.js index 737c5f4a39d..e86b9074a87 100644 --- a/test/form/samples/render-declaration-semicolons/_config.js +++ b/test/form/samples/render-declaration-semicolons/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'properly inserts semi-colons after declarations (#1993)', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/render-named-export-declarations/_config.js b/test/form/samples/render-named-export-declarations/_config.js index 91835f20a03..205f2617365 100644 --- a/test/form/samples/render-named-export-declarations/_config.js +++ b/test/form/samples/render-named-export-declarations/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'renders named export declarations', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/render-removed-declarations/_config.js b/test/form/samples/render-removed-declarations/_config.js index 36bcb953f3d..ed224fc9119 100644 --- a/test/form/samples/render-removed-declarations/_config.js +++ b/test/form/samples/render-removed-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'renders tree-shaken variable declarations' -}; +}); diff --git a/test/form/samples/render-removed-statements/_config.js b/test/form/samples/render-removed-statements/_config.js index 5c3fac4b9ef..0680fed75ec 100644 --- a/test/form/samples/render-removed-statements/_config.js +++ b/test/form/samples/render-removed-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'make sure removed statements do no leave unwanted white-space' -}; +}); diff --git a/test/form/samples/reserved-keywords-in-imports-exports/_config.js b/test/form/samples/reserved-keywords-in-imports-exports/_config.js index bfebfd0cf71..b80f2894e41 100644 --- a/test/form/samples/reserved-keywords-in-imports-exports/_config.js +++ b/test/form/samples/reserved-keywords-in-imports-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles reserved keywords in exports/imports', options: { input: ['main'], @@ -7,4 +7,4 @@ module.exports = { }, external: ['external'] } -}; +}); diff --git a/test/form/samples/resolution-order/_config.js b/test/form/samples/resolution-order/_config.js index 44ee6d650f3..cca0484c4e9 100644 --- a/test/form/samples/resolution-order/_config.js +++ b/test/form/samples/resolution-order/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not depend on the resolution order of modules for tree-shaking (#2753)', options: { plugins: { @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/resolve-external-dynamic-imports/_config.js b/test/form/samples/resolve-external-dynamic-imports/_config.js index abc5a1fa758..d8d18313ee4 100644 --- a/test/form/samples/resolve-external-dynamic-imports/_config.js +++ b/test/form/samples/resolve-external-dynamic-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not resolve external dynamic imports via plugins (#2481)', options: { output: { @@ -18,4 +18,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/resolve-import-meta-url-export/_config.js b/test/form/samples/resolve-import-meta-url-export/_config.js index ca2e7fb0fc6..d7b50c2e8cb 100644 --- a/test/form/samples/resolve-import-meta-url-export/_config.js +++ b/test/form/samples/resolve-import-meta-url-export/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly exports resolved import.meta.url', options: { plugins: [ @@ -10,4 +10,4 @@ module.exports = { ], output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/resolve-import-meta-url/_config.js b/test/form/samples/resolve-import-meta-url/_config.js index 2680aed0622..838644fff00 100644 --- a/test/form/samples/resolve-import-meta-url/_config.js +++ b/test/form/samples/resolve-import-meta-url/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to configure import.meta.url', options: { plugins: [ @@ -24,4 +24,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/form/samples/return-after-error/_config.js b/test/form/samples/return-after-error/_config.js index e45fd11d277..6726f51607b 100644 --- a/test/form/samples/return-after-error/_config.js +++ b/test/form/samples/return-after-error/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shakes entities referenced in a return statement after an error' -}; +}); diff --git a/test/form/samples/return-statement/missing-space/_config.js b/test/form/samples/return-statement/missing-space/_config.js index ab1265aacfe..11f544402bd 100644 --- a/test/form/samples/return-statement/missing-space/_config.js +++ b/test/form/samples/return-statement/missing-space/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Inserts space when simplifying return statement without space' -}; +}); diff --git a/test/form/samples/return-value-access-in-conditional/_config.js b/test/form/samples/return-value-access-in-conditional/_config.js index e6a08be106d..1f10d19e90c 100644 --- a/test/form/samples/return-value-access-in-conditional/_config.js +++ b/test/form/samples/return-value-access-in-conditional/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles accessing funciton return values in deoptimized conditionals' -}; +}); diff --git a/test/form/samples/runs-output-plugins-last/_config.js b/test/form/samples/runs-output-plugins-last/_config.js index 69c2baad70a..737f94719c3 100644 --- a/test/form/samples/runs-output-plugins-last/_config.js +++ b/test/form/samples/runs-output-plugins-last/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'runs output plugins last', options: { plugins: [ @@ -20,4 +20,4 @@ module.exports = { ] } } -}; +}); diff --git a/test/form/samples/self-calling-function-with-effects/_config.js b/test/form/samples/self-calling-function-with-effects/_config.js index d20f89b9526..1377b649263 100644 --- a/test/form/samples/self-calling-function-with-effects/_config.js +++ b/test/form/samples/self-calling-function-with-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'discards a self-calling function with side-effects' -}; +}); diff --git a/test/form/samples/self-calling-function/_config.js b/test/form/samples/self-calling-function/_config.js index 7629c502687..57c2b85a209 100644 --- a/test/form/samples/self-calling-function/_config.js +++ b/test/form/samples/self-calling-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'discards a self-calling function without side-effects', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/self-contained-bundle/_config.js b/test/form/samples/self-contained-bundle/_config.js index 29f06f02379..c3ea85ff078 100644 --- a/test/form/samples/self-contained-bundle/_config.js +++ b/test/form/samples/self-contained-bundle/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'self-contained bundle' -}; +}); diff --git a/test/form/samples/self-deoptimization/_config.js b/test/form/samples/self-deoptimization/_config.js index d86ca391dc4..4c3533bf807 100644 --- a/test/form/samples/self-deoptimization/_config.js +++ b/test/form/samples/self-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles situations where a member expression is deoptimized while being deoptimized' -}; +}); diff --git a/test/form/samples/sequence-expression/_config.js b/test/form/samples/sequence-expression/_config.js index 0b822def3d8..64800c3513a 100644 --- a/test/form/samples/sequence-expression/_config.js +++ b/test/form/samples/sequence-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only retain expressions with effects in sequence expressions (#1649)' -}; +}); diff --git a/test/form/samples/shorthand-properties/_config.js b/test/form/samples/shorthand-properties/_config.js index deb929d1baf..2a17113ab9f 100644 --- a/test/form/samples/shorthand-properties/_config.js +++ b/test/form/samples/shorthand-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'expands shorthand properties as necessary (#61)' -}; +}); diff --git a/test/form/samples/side-effect-b/_config.js b/test/form/samples/side-effect-b/_config.js index e4f8f851539..c299b724837 100644 --- a/test/form/samples/side-effect-b/_config.js +++ b/test/form/samples/side-effect-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'discards IIFE with no side-effects', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-c/_config.js b/test/form/samples/side-effect-c/_config.js index 714bb2229ec..5819c3f246d 100644 --- a/test/form/samples/side-effect-c/_config.js +++ b/test/form/samples/side-effect-c/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'discards function with no side-effects', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-d/_config.js b/test/form/samples/side-effect-d/_config.js index 06becb0d14e..d2021a9d5bb 100644 --- a/test/form/samples/side-effect-d/_config.js +++ b/test/form/samples/side-effect-d/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'excludes functions that are known to be pure', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-default-reexport/_config.js b/test/form/samples/side-effect-default-reexport/_config.js index 65e80f04d56..992be466ea4 100644 --- a/test/form/samples/side-effect-default-reexport/_config.js +++ b/test/form/samples/side-effect-default-reexport/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'Observes side-effects in side-effect-free modules that contain a used default export that just reexports from another module', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/form/samples/side-effect-e/_config.js b/test/form/samples/side-effect-e/_config.js index b3dabc06992..4ed8d1511b3 100644 --- a/test/form/samples/side-effect-e/_config.js +++ b/test/form/samples/side-effect-e/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'accounts for local scopes when tested function purity', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-es5-classes/_config.js b/test/form/samples/side-effect-es5-classes/_config.js index 1be04e395eb..e428008a049 100644 --- a/test/form/samples/side-effect-es5-classes/_config.js +++ b/test/form/samples/side-effect-es5-classes/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'omits ES5 classes which are pure (e.g. they only assign to `this`)', expectedWarnings: ['THIS_IS_UNDEFINED'] -}; +}); diff --git a/test/form/samples/side-effect-f/_config.js b/test/form/samples/side-effect-f/_config.js index d2f7e3e35da..020ed7253c3 100644 --- a/test/form/samples/side-effect-f/_config.js +++ b/test/form/samples/side-effect-f/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'disregards side-effects that are contained within a function', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-g/_config.js b/test/form/samples/side-effect-g/_config.js index 04e30755ac9..ec8e9697eb8 100644 --- a/test/form/samples/side-effect-g/_config.js +++ b/test/form/samples/side-effect-g/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'excludes constructors that are known to be pure', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-h/_config.js b/test/form/samples/side-effect-h/_config.js index 7100614789f..d077ab8a9f9 100644 --- a/test/form/samples/side-effect-h/_config.js +++ b/test/form/samples/side-effect-h/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes throw statements', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-i/_config.js b/test/form/samples/side-effect-i/_config.js index ec18a4d3ecd..51e31b5ef93 100644 --- a/test/form/samples/side-effect-i/_config.js +++ b/test/form/samples/side-effect-i/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes top-level throw statements', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-j/_config.js b/test/form/samples/side-effect-j/_config.js index adc9ac05c35..71c83c240de 100644 --- a/test/form/samples/side-effect-j/_config.js +++ b/test/form/samples/side-effect-j/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes late function declarations with side-effects', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-k/_config.js b/test/form/samples/side-effect-k/_config.js index 716b5410714..b0467b59b12 100644 --- a/test/form/samples/side-effect-k/_config.js +++ b/test/form/samples/side-effect-k/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'use of arguments is treated as a side-effect', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-l/_config.js b/test/form/samples/side-effect-l/_config.js index ec762ed9126..a957fbf5799 100644 --- a/test/form/samples/side-effect-l/_config.js +++ b/test/form/samples/side-effect-l/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'discards function with no side-effects in imported module', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/side-effect-m/_config.js b/test/form/samples/side-effect-m/_config.js index c44f44e9455..6c389ef661b 100644 --- a/test/form/samples/side-effect-m/_config.js +++ b/test/form/samples/side-effect-m/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in circular function calls', expectedWarnings: ['CIRCULAR_DEPENDENCY'] -}; +}); diff --git a/test/form/samples/side-effect-n/_config.js b/test/form/samples/side-effect-n/_config.js index 9896c14d057..379a9723982 100644 --- a/test/form/samples/side-effect-n/_config.js +++ b/test/form/samples/side-effect-n/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in complex call expressions' -}; +}); diff --git a/test/form/samples/side-effect-o/_config.js b/test/form/samples/side-effect-o/_config.js index 9896c14d057..379a9723982 100644 --- a/test/form/samples/side-effect-o/_config.js +++ b/test/form/samples/side-effect-o/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in complex call expressions' -}; +}); diff --git a/test/form/samples/side-effect-p/_config.js b/test/form/samples/side-effect-p/_config.js index 7a8d84b4c1e..c425c26febd 100644 --- a/test/form/samples/side-effect-p/_config.js +++ b/test/form/samples/side-effect-p/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects mutation of globals' -}; +}); diff --git a/test/form/samples/side-effect-q/_config.js b/test/form/samples/side-effect-q/_config.js index 542135c0d96..b37abab4403 100644 --- a/test/form/samples/side-effect-q/_config.js +++ b/test/form/samples/side-effect-q/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'discards effects in conditional expressions with known test values', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/side-effect-r/_config.js b/test/form/samples/side-effect-r/_config.js index 160946bb6a1..e00b8e41c79 100644 --- a/test/form/samples/side-effect-r/_config.js +++ b/test/form/samples/side-effect-r/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'discards unused function expression assigned to a variable that calls itself and a global', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/side-effect-s/_config.js b/test/form/samples/side-effect-s/_config.js index 83665339a11..00838aaea57 100644 --- a/test/form/samples/side-effect-s/_config.js +++ b/test/form/samples/side-effect-s/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'discards unused function expression assigned to a variable that calls itself and has side effects', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/side-effect-t/_config.js b/test/form/samples/side-effect-t/_config.js index 11092704b09..957236bbf3e 100644 --- a/test/form/samples/side-effect-t/_config.js +++ b/test/form/samples/side-effect-t/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throw statement is a side effect', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effect-with-plusplus-expression/_config.js b/test/form/samples/side-effect-with-plusplus-expression/_config.js index a1d93a75228..907cb2976a9 100644 --- a/test/form/samples/side-effect-with-plusplus-expression/_config.js +++ b/test/form/samples/side-effect-with-plusplus-expression/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly drop side-effect free statements in presence of update expression (#1564)', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/side-effect/_config.js b/test/form/samples/side-effect/_config.js index 0431077dba2..59fa7fa5d05 100644 --- a/test/form/samples/side-effect/_config.js +++ b/test/form/samples/side-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects to non-globals are not blindly included' -}; +}); diff --git a/test/form/samples/side-effects-await/_config.js b/test/form/samples/side-effects-await/_config.js index 4f4ad0a1e63..4b01a385fc9 100644 --- a/test/form/samples/side-effects-await/_config.js +++ b/test/form/samples/side-effects-await/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'await statements should never be dropped if a function has other side-effects (#1584)' -}; +}); diff --git a/test/form/samples/side-effects-break-statements/_config.js b/test/form/samples/side-effects-break-statements/_config.js index ba247f1280e..64acbca3c94 100644 --- a/test/form/samples/side-effects-break-statements/_config.js +++ b/test/form/samples/side-effects-break-statements/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'break statements should always by included but not always cause their parents to have effects', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effects-call-arguments/_config.js b/test/form/samples/side-effects-call-arguments/_config.js index d8ee57e3e6b..c8d9275427d 100644 --- a/test/form/samples/side-effects-call-arguments/_config.js +++ b/test/form/samples/side-effects-call-arguments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects in call arguments should be included' -}; +}); diff --git a/test/form/samples/side-effects-class-getters-setters/_config.js b/test/form/samples/side-effects-class-getters-setters/_config.js index 201e3e082f9..ecbdc429845 100644 --- a/test/form/samples/side-effects-class-getters-setters/_config.js +++ b/test/form/samples/side-effects-class-getters-setters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treat getters and setters on classes as function calls' -}; +}); diff --git a/test/form/samples/side-effects-computed-pattern-keys/_config.js b/test/form/samples/side-effects-computed-pattern-keys/_config.js index a2a2961f07f..daf32b338f5 100644 --- a/test/form/samples/side-effects-computed-pattern-keys/_config.js +++ b/test/form/samples/side-effects-computed-pattern-keys/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects in with computed pattern keys should not be ignored' -}; +}); diff --git a/test/form/samples/side-effects-delete/_config.js b/test/form/samples/side-effects-delete/_config.js index a5afb4f8c79..81cf46e2a83 100644 --- a/test/form/samples/side-effects-delete/_config.js +++ b/test/form/samples/side-effects-delete/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'delete is only a side-effect for included variables', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effects-es6-class-declarations/_config.js b/test/form/samples/side-effects-es6-class-declarations/_config.js index 29ad84ec965..e9206e022b7 100644 --- a/test/form/samples/side-effects-es6-class-declarations/_config.js +++ b/test/form/samples/side-effects-es6-class-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'determine side effects in ES6 class declarations' -}; +}); diff --git a/test/form/samples/side-effects-es6-class-expressions/_config.js b/test/form/samples/side-effects-es6-class-expressions/_config.js index 78ff5788610..0fb2fbf6a1c 100644 --- a/test/form/samples/side-effects-es6-class-expressions/_config.js +++ b/test/form/samples/side-effects-es6-class-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'determine side effects in ES6 class expressions' -}; +}); diff --git a/test/form/samples/side-effects-es6-super-classes/_config.js b/test/form/samples/side-effects-es6-super-classes/_config.js index 83e0fc4332b..99854ae798f 100644 --- a/test/form/samples/side-effects-es6-super-classes/_config.js +++ b/test/form/samples/side-effects-es6-super-classes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'determine side effects in ES6 super classes' -}; +}); diff --git a/test/form/samples/side-effects-expressions-as-statements/_config.js b/test/form/samples/side-effects-expressions-as-statements/_config.js index cffa37c9628..8cfb080be2c 100644 --- a/test/form/samples/side-effects-expressions-as-statements/_config.js +++ b/test/form/samples/side-effects-expressions-as-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'in order to keep certain getter calls, do not remove some expression statements' -}; +}); diff --git a/test/form/samples/side-effects-generators/_config.js b/test/form/samples/side-effects-generators/_config.js index cc50ee5553a..564cd639964 100644 --- a/test/form/samples/side-effects-generators/_config.js +++ b/test/form/samples/side-effects-generators/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Properly detect side-effects in generator functions' -}; +}); diff --git a/test/form/samples/side-effects-getters-and-setters/_config.js b/test/form/samples/side-effects-getters-and-setters/_config.js index 2ac2ab26753..83bddd815c6 100644 --- a/test/form/samples/side-effects-getters-and-setters/_config.js +++ b/test/form/samples/side-effects-getters-and-setters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treat getters and setters as function calls' -}; +}); diff --git a/test/form/samples/side-effects-in-template-literals/_config.js b/test/form/samples/side-effects-in-template-literals/_config.js index 61c8d75330d..742e31ed751 100644 --- a/test/form/samples/side-effects-in-template-literals/_config.js +++ b/test/form/samples/side-effects-in-template-literals/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in template literals and tagged template expressions', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effects-internal-modules/_config.js b/test/form/samples/side-effects-internal-modules/_config.js index f4befd00100..973ecfeda86 100644 --- a/test/form/samples/side-effects-internal-modules/_config.js +++ b/test/form/samples/side-effects-internal-modules/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const VIRTUAL_ID = '\0virtual'; -module.exports = { +module.exports = defineTest({ description: 'does not pass internal modules to moduleSideEffects', expectedWarnings: ['EMPTY_BUNDLE'], options: { @@ -25,4 +25,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/side-effects-logical-expressions/_config.js b/test/form/samples/side-effects-logical-expressions/_config.js index c836fb6ccb7..d202cf8dc4b 100644 --- a/test/form/samples/side-effects-logical-expressions/_config.js +++ b/test/form/samples/side-effects-logical-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only evaluate the second part of a logical expression if necessary' -}; +}); diff --git a/test/form/samples/side-effects-object-literal-calls/_config.js b/test/form/samples/side-effects-object-literal-calls/_config.js index ffc52c259c1..6d13f637ae2 100644 --- a/test/form/samples/side-effects-object-literal-calls/_config.js +++ b/test/form/samples/side-effects-object-literal-calls/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects when mutating object literals' -}; +}); diff --git a/test/form/samples/side-effects-object-literal-mutation-misc/_config.js b/test/form/samples/side-effects-object-literal-mutation-misc/_config.js index d94d592cf65..2350348da73 100644 --- a/test/form/samples/side-effects-object-literal-mutation-misc/_config.js +++ b/test/form/samples/side-effects-object-literal-mutation-misc/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects when setting and/or calling properties on object literals', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/side-effects-object-literal-mutation/_config.js b/test/form/samples/side-effects-object-literal-mutation/_config.js index ffc52c259c1..6d13f637ae2 100644 --- a/test/form/samples/side-effects-object-literal-mutation/_config.js +++ b/test/form/samples/side-effects-object-literal-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects when mutating object literals' -}; +}); diff --git a/test/form/samples/side-effects-pattern-assignment/_config.js b/test/form/samples/side-effects-pattern-assignment/_config.js index da2ca598ba6..6741af48702 100644 --- a/test/form/samples/side-effects-pattern-assignment/_config.js +++ b/test/form/samples/side-effects-pattern-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects when mutating destructured variables should not be ignored' -}; +}); diff --git a/test/form/samples/side-effects-pattern-defaults/_config.js b/test/form/samples/side-effects-pattern-defaults/_config.js index 004103a15d9..0d651f9f4da 100644 --- a/test/form/samples/side-effects-pattern-defaults/_config.js +++ b/test/form/samples/side-effects-pattern-defaults/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects in pattern defaults should not be ignored' -}; +}); diff --git a/test/form/samples/side-effects-prototype-assignments/_config.js b/test/form/samples/side-effects-prototype-assignments/_config.js index b71c53dd0a2..e5fd32ec599 100644 --- a/test/form/samples/side-effects-prototype-assignments/_config.js +++ b/test/form/samples/side-effects-prototype-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'include side-effects with re-assigned prototypes (#953)' -}; +}); diff --git a/test/form/samples/side-effects-reassignment/_config.js b/test/form/samples/side-effects-reassignment/_config.js index c1a20cb442e..5dd48c24692 100644 --- a/test/form/samples/side-effects-reassignment/_config.js +++ b/test/form/samples/side-effects-reassignment/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'when mutating/calling a reassigned variable, all assignments should be checked for side-effects' -}; +}); diff --git a/test/form/samples/side-effects-return-statements/_config.js b/test/form/samples/side-effects-return-statements/_config.js index 3d428613c13..979336af10e 100644 --- a/test/form/samples/side-effects-return-statements/_config.js +++ b/test/form/samples/side-effects-return-statements/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'return statements do not have side-effects but should be kept in certain cases (#1585)', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/side-effects-static-methods/_config.js b/test/form/samples/side-effects-static-methods/_config.js index 129d0e1d6de..b43c035c4b3 100644 --- a/test/form/samples/side-effects-static-methods/_config.js +++ b/test/form/samples/side-effects-static-methods/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allow calls to pure static methods to be tree-shaken' -}; +}); diff --git a/test/form/samples/side-effects-switch-statements/_config.js b/test/form/samples/side-effects-switch-statements/_config.js index b35f375c5b6..d36aac38c82 100644 --- a/test/form/samples/side-effects-switch-statements/_config.js +++ b/test/form/samples/side-effects-switch-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'switch statements should be correctly tree-shaken' -}; +}); diff --git a/test/form/samples/side-effects-this/_config.js b/test/form/samples/side-effects-this/_config.js index 8b7bdfff6eb..3c46475904f 100644 --- a/test/form/samples/side-effects-this/_config.js +++ b/test/form/samples/side-effects-this/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'When a constructor is called with the new keyword, changing its this has no side effects' -}; +}); diff --git a/test/form/samples/simplified-initializer/_config.js b/test/form/samples/simplified-initializer/_config.js index c893283454c..b8cba9c117f 100644 --- a/test/form/samples/simplified-initializer/_config.js +++ b/test/form/samples/simplified-initializer/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles simplified variable initializers', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/simplify-expression-annotations/_config.js b/test/form/samples/simplify-expression-annotations/_config.js index 8bc62f8c55b..a0d80d6975f 100644 --- a/test/form/samples/simplify-expression-annotations/_config.js +++ b/test/form/samples/simplify-expression-annotations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps correct annotations when simplifying expressinos' -}; +}); diff --git a/test/form/samples/simplify-return-expression/_config.js b/test/form/samples/simplify-return-expression/_config.js index b89cc66704f..2175ca52e5e 100644 --- a/test/form/samples/simplify-return-expression/_config.js +++ b/test/form/samples/simplify-return-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Simplifies conditionals in return expression' -}; +}); diff --git a/test/form/samples/skips-dead-branches-b/_config.js b/test/form/samples/skips-dead-branches-b/_config.js index 22c399cee0b..3c56489dd01 100644 --- a/test/form/samples/skips-dead-branches-b/_config.js +++ b/test/form/samples/skips-dead-branches-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (b)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-c/_config.js b/test/form/samples/skips-dead-branches-c/_config.js index 86741425441..e2ae889d8e7 100644 --- a/test/form/samples/skips-dead-branches-c/_config.js +++ b/test/form/samples/skips-dead-branches-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (c)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-d/_config.js b/test/form/samples/skips-dead-branches-d/_config.js index 97791399bf1..e3822d75329 100644 --- a/test/form/samples/skips-dead-branches-d/_config.js +++ b/test/form/samples/skips-dead-branches-d/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (d)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-e/_config.js b/test/form/samples/skips-dead-branches-e/_config.js index d290c80e60d..16d5c13d318 100644 --- a/test/form/samples/skips-dead-branches-e/_config.js +++ b/test/form/samples/skips-dead-branches-e/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (e)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-f/_config.js b/test/form/samples/skips-dead-branches-f/_config.js index 9ac1d2340bf..dfecee64639 100644 --- a/test/form/samples/skips-dead-branches-f/_config.js +++ b/test/form/samples/skips-dead-branches-f/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (f)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-g/_config.js b/test/form/samples/skips-dead-branches-g/_config.js index f592e056c93..5b007e4d08f 100644 --- a/test/form/samples/skips-dead-branches-g/_config.js +++ b/test/form/samples/skips-dead-branches-g/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead conditional expression branch (g)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-h/_config.js b/test/form/samples/skips-dead-branches-h/_config.js index 85e8fbe2647..2f4da370fec 100644 --- a/test/form/samples/skips-dead-branches-h/_config.js +++ b/test/form/samples/skips-dead-branches-h/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (h)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-i/_config.js b/test/form/samples/skips-dead-branches-i/_config.js index 95aa9425141..5410783733c 100644 --- a/test/form/samples/skips-dead-branches-i/_config.js +++ b/test/form/samples/skips-dead-branches-i/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (i)' -}; +}); diff --git a/test/form/samples/skips-dead-branches-j/_config.js b/test/form/samples/skips-dead-branches-j/_config.js index b9abe109dfa..8fedcb35ab4 100644 --- a/test/form/samples/skips-dead-branches-j/_config.js +++ b/test/form/samples/skips-dead-branches-j/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch (j)' -}; +}); diff --git a/test/form/samples/skips-dead-branches/_config.js b/test/form/samples/skips-dead-branches/_config.js index 078856d2ef6..a2697cd97a1 100644 --- a/test/form/samples/skips-dead-branches/_config.js +++ b/test/form/samples/skips-dead-branches/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'skips a dead branch' -}; +}); diff --git a/test/form/samples/slash-in-function-parameters/_config.js b/test/form/samples/slash-in-function-parameters/_config.js index b4865638777..c4a5a575702 100644 --- a/test/form/samples/slash-in-function-parameters/_config.js +++ b/test/form/samples/slash-in-function-parameters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles slashes in function parameters and correctly inserts missing ids' -}; +}); diff --git a/test/form/samples/sourcemaps-excludesources/_config.js b/test/form/samples/sourcemaps-excludesources/_config.js index 491a8fe6f95..fdfa88e6128 100644 --- a/test/form/samples/sourcemaps-excludesources/_config.js +++ b/test/form/samples/sourcemaps-excludesources/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'correct sourcemaps are written (excluding sourceContent)', skipIfWindows: true, options: { output: { sourcemap: true, sourcemapExcludeSources: true } } -}; +}); diff --git a/test/form/samples/sourcemaps-external/_config.js b/test/form/samples/sourcemaps-external/_config.js index 12501b32b43..d597d1ab64d 100644 --- a/test/form/samples/sourcemaps-external/_config.js +++ b/test/form/samples/sourcemaps-external/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'correct sourcemaps are written (separate file)', skipIfWindows: true, options: { output: { sourcemap: true } } -}; +}); diff --git a/test/form/samples/sourcemaps-hidden/_config.js b/test/form/samples/sourcemaps-hidden/_config.js index 9aa83cd79dc..ed2ed256bb1 100644 --- a/test/form/samples/sourcemaps-hidden/_config.js +++ b/test/form/samples/sourcemaps-hidden/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'correct sourcemaps are written (separate file) without comment', skipIfWindows: true, options: { output: { sourcemap: 'hidden' } } -}; +}); diff --git a/test/form/samples/sourcemaps-inline/_config.js b/test/form/samples/sourcemaps-inline/_config.js index 28ce94fc4d5..679182017a3 100644 --- a/test/form/samples/sourcemaps-inline/_config.js +++ b/test/form/samples/sourcemaps-inline/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'correct sourcemaps are written (inline)', skipIfWindows: true, options: { output: { sourcemap: 'inline' } } -}; +}); diff --git a/test/form/samples/spacing-after-function-with-semicolon/_config.js b/test/form/samples/spacing-after-function-with-semicolon/_config.js index 316c69d3613..2288a9c6c80 100644 --- a/test/form/samples/spacing-after-function-with-semicolon/_config.js +++ b/test/form/samples/spacing-after-function-with-semicolon/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles superfluous semicolons' -}; +}); diff --git a/test/form/samples/static-block-render/_config.js b/test/form/samples/static-block-render/_config.js index 02def0bb780..980aefe230f 100644 --- a/test/form/samples/static-block-render/_config.js +++ b/test/form/samples/static-block-render/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Correctly render treeshaked inline static blocks' -}; +}); diff --git a/test/form/samples/static-class-property-calls/_config.js b/test/form/samples/static-class-property-calls/_config.js index 2983907efde..e509c2ff68e 100644 --- a/test/form/samples/static-class-property-calls/_config.js +++ b/test/form/samples/static-class-property-calls/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles effects when calling static class properties' -}; +}); diff --git a/test/form/samples/static-method-deoptimization/_config.js b/test/form/samples/static-method-deoptimization/_config.js index 064ca3bc55e..39cfe865b77 100644 --- a/test/form/samples/static-method-deoptimization/_config.js +++ b/test/form/samples/static-method-deoptimization/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids infinite recursions when deoptimizing "this" context' -}; +}); diff --git a/test/form/samples/strict-false/_config.js b/test/form/samples/strict-false/_config.js index dac5b866925..25e1e8f0445 100644 --- a/test/form/samples/strict-false/_config.js +++ b/test/form/samples/strict-false/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'use strict should not be present', options: { output: { strict: false } } -}; +}); diff --git a/test/form/samples/string-indentation-b/_config.js b/test/form/samples/string-indentation-b/_config.js index f6c6cbeb903..14c82d9a93b 100644 --- a/test/form/samples/string-indentation-b/_config.js +++ b/test/form/samples/string-indentation-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles multiple var declarations inited to strings (#166)', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/string-indentation/_config.js b/test/form/samples/string-indentation/_config.js index 1aebe39f9ae..e3a4270ff75 100644 --- a/test/form/samples/string-indentation/_config.js +++ b/test/form/samples/string-indentation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'indentation is preserved in multi-line strings' -}; +}); diff --git a/test/form/samples/string-replace-side-effects/_config.js b/test/form/samples/string-replace-side-effects/_config.js index 291a777fcfa..6aff9cab951 100644 --- a/test/form/samples/string-replace-side-effects/_config.js +++ b/test/form/samples/string-replace-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not assume string.replace has side effects when called with a string as second argument' -}; +}); diff --git a/test/form/samples/super-class-no-side-effects/_config.js b/test/form/samples/super-class-no-side-effects/_config.js index 7e3165f391f..17c0fea9b99 100644 --- a/test/form/samples/super-class-no-side-effects/_config.js +++ b/test/form/samples/super-class-no-side-effects/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not wrongly attribute side effects when the super class of an unused class is in a file without side effects (#4808)', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/form/samples/super-classes/super-class-prototype-access/_config.js b/test/form/samples/super-classes/super-class-prototype-access/_config.js index 6bac45041bb..7f105452427 100644 --- a/test/form/samples/super-classes/super-class-prototype-access/_config.js +++ b/test/form/samples/super-classes/super-class-prototype-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves the prototype of the super class when accessing properties' -}; +}); diff --git a/test/form/samples/super-classes/super-class-prototype-assignment/_config.js b/test/form/samples/super-classes/super-class-prototype-assignment/_config.js index dd974952e7f..3f32e053f7b 100644 --- a/test/form/samples/super-classes/super-class-prototype-assignment/_config.js +++ b/test/form/samples/super-classes/super-class-prototype-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves the prototype of the super class when assigning properites' -}; +}); diff --git a/test/form/samples/super-classes/super-class-prototype-calls/_config.js b/test/form/samples/super-classes/super-class-prototype-calls/_config.js index f0d4045a4f9..1d6db9af630 100644 --- a/test/form/samples/super-classes/super-class-prototype-calls/_config.js +++ b/test/form/samples/super-classes/super-class-prototype-calls/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves the prototype of the super class when calling properties' -}; +}); diff --git a/test/form/samples/super-classes/super-class-prototype-values/_config.js b/test/form/samples/super-classes/super-class-prototype-values/_config.js index 0f3f274db77..bad728fa423 100644 --- a/test/form/samples/super-classes/super-class-prototype-values/_config.js +++ b/test/form/samples/super-classes/super-class-prototype-values/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly resolves the prototype of the super class when reading property values' -}; +}); diff --git a/test/form/samples/supports-core-js/_config.js b/test/form/samples/supports-core-js/_config.js index ffbfcc0adea..ad8e2ea8098 100644 --- a/test/form/samples/supports-core-js/_config.js +++ b/test/form/samples/supports-core-js/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports core-js', options: { // check against tree-shake: false when updating the polyfill @@ -8,4 +8,4 @@ module.exports = { require('@rollup/plugin-commonjs')() ] } -}; +}); diff --git a/test/form/samples/supports-es5-shim/_config.js b/test/form/samples/supports-es5-shim/_config.js index f107d95a931..8d44b41d475 100644 --- a/test/form/samples/supports-es5-shim/_config.js +++ b/test/form/samples/supports-es5-shim/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports es5-shim', options: { onwarn(warning) { @@ -14,4 +14,4 @@ module.exports = { require('@rollup/plugin-commonjs')() ] } -}; +}); diff --git a/test/form/samples/supports-es6-shim/_config.js b/test/form/samples/supports-es6-shim/_config.js index 0697dbda361..442c76aefa0 100644 --- a/test/form/samples/supports-es6-shim/_config.js +++ b/test/form/samples/supports-es6-shim/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports es6-shim', options: { onwarn(warning) { @@ -10,7 +10,7 @@ module.exports = { treeshake: true, plugins: [ require('@rollup/plugin-node-resolve').default(), - require('@rollup/plugin-commonjs')() + require('@rollup/plugin-commonjs').default() ] } -}; +}); diff --git a/test/form/samples/switch-scopes/_config.js b/test/form/samples/switch-scopes/_config.js index 79a7b97dd61..86c4398bd0b 100644 --- a/test/form/samples/switch-scopes/_config.js +++ b/test/form/samples/switch-scopes/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles switch scopes', options: { output: { name: 'myBundle' } } -}; +}); diff --git a/test/form/samples/synthetic-named-exports/_config.js b/test/form/samples/synthetic-named-exports/_config.js index 65eff57dc5c..4d1cd1073d4 100644 --- a/test/form/samples/synthetic-named-exports/_config.js +++ b/test/form/samples/synthetic-named-exports/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'synthetic named exports', options: { plugins: [ { + name: 'test', resolveId(id) { if (id.endsWith('dep1.js')) { return id; @@ -26,4 +27,4 @@ export default d;`, } ] } -}; +}); diff --git a/test/form/samples/system-comments/_config.js b/test/form/samples/system-comments/_config.js index 074f8c0a72e..74c6254868c 100644 --- a/test/form/samples/system-comments/_config.js +++ b/test/form/samples/system-comments/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Correctly places leading comments when rendering system bindings', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-default-comments/_config.js b/test/form/samples/system-default-comments/_config.js index 1054b71b8a2..3b6b40660b1 100644 --- a/test/form/samples/system-default-comments/_config.js +++ b/test/form/samples/system-default-comments/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Correctly places leading comments when rendering system default exports', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-export-declarations/_config.js b/test/form/samples/system-export-declarations/_config.js index 0c60c7ff7cb..3b93d3d5bcc 100644 --- a/test/form/samples/system-export-declarations/_config.js +++ b/test/form/samples/system-export-declarations/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Renders declarations where some variables are exported', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-export-destructuring-declaration/_config.js b/test/form/samples/system-export-destructuring-declaration/_config.js index db198f829d5..7bfd1fc2319 100644 --- a/test/form/samples/system-export-destructuring-declaration/_config.js +++ b/test/form/samples/system-export-destructuring-declaration/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'supports destructuring declarations for systemJS', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-export-rendering-compact/_config.js b/test/form/samples/system-export-rendering-compact/_config.js index c06f8a33114..a9033223df1 100644 --- a/test/form/samples/system-export-rendering-compact/_config.js +++ b/test/form/samples/system-export-rendering-compact/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Renders updates of exported variables for SystemJS output in compact mode', options: { output: { @@ -6,4 +6,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/form/samples/system-export-rendering/_config.js b/test/form/samples/system-export-rendering/_config.js index 846122a4c7c..843cea4565a 100644 --- a/test/form/samples/system-export-rendering/_config.js +++ b/test/form/samples/system-export-rendering/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'Renders updates of exported variables for SystemJS output', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-module-reserved/_config.js b/test/form/samples/system-module-reserved/_config.js index 0da470d6610..e075c35824c 100644 --- a/test/form/samples/system-module-reserved/_config.js +++ b/test/form/samples/system-module-reserved/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not output reserved system format identifiers', options: { external: ['test'], @@ -7,4 +7,4 @@ module.exports = { globals: { test: 'test' } } } -}; +}); diff --git a/test/form/samples/system-multiple-export-bindings/_config.js b/test/form/samples/system-multiple-export-bindings/_config.js index 3756936c774..dd6093f9600 100644 --- a/test/form/samples/system-multiple-export-bindings/_config.js +++ b/test/form/samples/system-multiple-export-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports multiple live bindings for the same symbol in systemJS', options: { output: { @@ -6,4 +6,4 @@ module.exports = { exports: 'named' } } -}; +}); diff --git a/test/form/samples/system-null-setters/_config.js b/test/form/samples/system-null-setters/_config.js index f3948af0079..1e743cbf829 100644 --- a/test/form/samples/system-null-setters/_config.js +++ b/test/form/samples/system-null-setters/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows to avoid null setters for side effect only imports', options: { external: ['external'], @@ -7,4 +7,4 @@ module.exports = { systemNullSetters: false } } -}; +}); diff --git a/test/form/samples/system-reexports/_config.js b/test/form/samples/system-reexports/_config.js index 813bf77ce87..589a68d7d3e 100644 --- a/test/form/samples/system-reexports/_config.js +++ b/test/form/samples/system-reexports/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'merges reexports in systemjs', options: { - external: true, + external: () => true, output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-semicolon/_config.js b/test/form/samples/system-semicolon/_config.js index 224cae88f2f..4fc44dcd580 100644 --- a/test/form/samples/system-semicolon/_config.js +++ b/test/form/samples/system-semicolon/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'supports asi in system binding output', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/system-uninitialized/_config.js b/test/form/samples/system-uninitialized/_config.js index 2ff19964cbd..871cd409281 100644 --- a/test/form/samples/system-uninitialized/_config.js +++ b/test/form/samples/system-uninitialized/_config.js @@ -1,11 +1,11 @@ // Changed due to https://github.com/acornjs/acorn/issues/806 // Consider reverting this change should this become an acorn option -module.exports = { +module.exports = defineTest({ description: 'supports uninitialized binding exports', options: { output: { format: 'system' } } -}; +}); diff --git a/test/form/samples/tdz-access-in-declaration/_config.js b/test/form/samples/tdz-access-in-declaration/_config.js index 12ef3f7a53d..05017512a52 100644 --- a/test/form/samples/tdz-access-in-declaration/_config.js +++ b/test/form/samples/tdz-access-in-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detect accessing TDZ variables within the declaration' -}; +}); diff --git a/test/form/samples/tdz-common/_config.js b/test/form/samples/tdz-common/_config.js index ba41751e0fd..27cc234e89a 100644 --- a/test/form/samples/tdz-common/_config.js +++ b/test/form/samples/tdz-common/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserve common TDZ violations' -}; +}); diff --git a/test/form/samples/tdz-pattern-access/_config.js b/test/form/samples/tdz-pattern-access/_config.js index a50522b9fd9..c62bbc85985 100644 --- a/test/form/samples/tdz-pattern-access/_config.js +++ b/test/form/samples/tdz-pattern-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles accessing variables declared in patterns before their declaration' -}; +}); diff --git a/test/form/samples/template-literal/computed-properties/_config.js b/test/form/samples/template-literal/computed-properties/_config.js index 85451aa7e27..0dc3474cb31 100644 --- a/test/form/samples/template-literal/computed-properties/_config.js +++ b/test/form/samples/template-literal/computed-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Resolve template literals in computed property keys' -}; +}); diff --git a/test/form/samples/template-literal/simplify-conditionals/_config.js b/test/form/samples/template-literal/simplify-conditionals/_config.js index 47e0a8f442d..11d57dc3dd7 100644 --- a/test/form/samples/template-literal/simplify-conditionals/_config.js +++ b/test/form/samples/template-literal/simplify-conditionals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Template literals can be simplified when used in conditionals' -}; +}); diff --git a/test/form/samples/this-in-class-body/_config.js b/test/form/samples/this-in-class-body/_config.js index 1ade8977cfe..3f970f301a3 100644 --- a/test/form/samples/this-in-class-body/_config.js +++ b/test/form/samples/this-in-class-body/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses the correct "this" value in class properties' -}; +}); diff --git a/test/form/samples/this-in-imports/_config.js b/test/form/samples/this-in-imports/_config.js index 968d0327b35..a31fabfa411 100644 --- a/test/form/samples/this-in-imports/_config.js +++ b/test/form/samples/this-in-imports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly keep or ignore "this"-expressions when calling imported functions' -}; +}); diff --git a/test/form/samples/this-is-undefined/_config.js b/test/form/samples/this-is-undefined/_config.js index 75134029384..3c744d8b11d 100644 --- a/test/form/samples/this-is-undefined/_config.js +++ b/test/form/samples/this-is-undefined/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'top-level `this` expression is rewritten as `undefined`', options: { onwarn: () => {} } -}; +}); diff --git a/test/form/samples/top-level-await/_config.js b/test/form/samples/top-level-await/_config.js index a572b8a99f0..2ed3902716c 100644 --- a/test/form/samples/top-level-await/_config.js +++ b/test/form/samples/top-level-await/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'top-level await support', formats: ['system', 'es'] -}; +}); diff --git a/test/form/samples/tree-shake-arguments-conditional/_config.js b/test/form/samples/tree-shake-arguments-conditional/_config.js index 4390bfa586a..e5228acda32 100644 --- a/test/form/samples/tree-shake-arguments-conditional/_config.js +++ b/test/form/samples/tree-shake-arguments-conditional/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks tree-shaking of arguments through simplified conditionals' -}; +}); diff --git a/test/form/samples/tree-shake-curried-functions/_config.js b/test/form/samples/tree-shake-curried-functions/_config.js index f022678d476..819de8801dd 100644 --- a/test/form/samples/tree-shake-curried-functions/_config.js +++ b/test/form/samples/tree-shake-curried-functions/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Remove side-effect-free curried functions (#1263)', expectedWarnings: ['EMPTY_BUNDLE'] -}; +}); diff --git a/test/form/samples/tree-shake-default-exports/_config.js b/test/form/samples/tree-shake-default-exports/_config.js index 8b7be460d61..8ae42ad6db0 100644 --- a/test/form/samples/tree-shake-default-exports/_config.js +++ b/test/form/samples/tree-shake-default-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly remove unused default exports' -}; +}); diff --git a/test/form/samples/tree-shake-if-statements/_config.js b/test/form/samples/tree-shake-if-statements/_config.js index 3debad2c2a7..c626947098c 100644 --- a/test/form/samples/tree-shake-if-statements/_config.js +++ b/test/form/samples/tree-shake-if-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shake if-statements with a condition that can be evaluated' -}; +}); diff --git a/test/form/samples/tree-shake-logical-expressions/_config.js b/test/form/samples/tree-shake-logical-expressions/_config.js index b0ab3abfc42..7a16f15ccfe 100644 --- a/test/form/samples/tree-shake-logical-expressions/_config.js +++ b/test/form/samples/tree-shake-logical-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shake unused parts of logical expressions' -}; +}); diff --git a/test/form/samples/tree-shake-optional-chaining-literal/_config.js b/test/form/samples/tree-shake-optional-chaining-literal/_config.js index e9c3a618d6d..64bc4f5bbd3 100644 --- a/test/form/samples/tree-shake-optional-chaining-literal/_config.js +++ b/test/form/samples/tree-shake-optional-chaining-literal/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shake expressions optional chaining with literal values' -}; +}); diff --git a/test/form/samples/tree-shake-pure-optional-chaining/_config.js b/test/form/samples/tree-shake-pure-optional-chaining/_config.js index f35ab64b278..58251c2acda 100644 --- a/test/form/samples/tree-shake-pure-optional-chaining/_config.js +++ b/test/form/samples/tree-shake-pure-optional-chaining/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tree-shake pure call expressions involving optional chaining' -}; +}); diff --git a/test/form/samples/treeshake-classes-with-fields/_config.js b/test/form/samples/treeshake-classes-with-fields/_config.js index 850350bdabd..76c38b0bc48 100644 --- a/test/form/samples/treeshake-classes-with-fields/_config.js +++ b/test/form/samples/treeshake-classes-with-fields/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treeshakes classes with class fields (#3564)' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/argument-side-effects/_config.js b/test/form/samples/treeshake-excess-arguments/argument-side-effects/_config.js index d2acef03025..2c2aefb246a 100644 --- a/test/form/samples/treeshake-excess-arguments/argument-side-effects/_config.js +++ b/test/form/samples/treeshake-excess-arguments/argument-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains arguments that have side-effects' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/arguments-variable/_config.js b/test/form/samples/treeshake-excess-arguments/arguments-variable/_config.js index 86854f25350..85a33fbb24c 100644 --- a/test/form/samples/treeshake-excess-arguments/arguments-variable/_config.js +++ b/test/form/samples/treeshake-excess-arguments/arguments-variable/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not remove arguments from call when arguments variables is accessed' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/arrow-function-arguments/_config.js b/test/form/samples/treeshake-excess-arguments/arrow-function-arguments/_config.js index 8c4887c4e0a..4b7c0e47074 100644 --- a/test/form/samples/treeshake-excess-arguments/arrow-function-arguments/_config.js +++ b/test/form/samples/treeshake-excess-arguments/arrow-function-arguments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unneeded arguments from calls to arrow functions' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/function-arguments/_config.js b/test/form/samples/treeshake-excess-arguments/function-arguments/_config.js index 2a51e6c38af..762ac6c939c 100644 --- a/test/form/samples/treeshake-excess-arguments/function-arguments/_config.js +++ b/test/form/samples/treeshake-excess-arguments/function-arguments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unneeded arguments from calls to functions' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/namespace-members/_config.js b/test/form/samples/treeshake-excess-arguments/namespace-members/_config.js index 1f3e70ad8c1..e6af8a352a8 100644 --- a/test/form/samples/treeshake-excess-arguments/namespace-members/_config.js +++ b/test/form/samples/treeshake-excess-arguments/namespace-members/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unneeded arguments across namespace member calls' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/patterns/_config.js b/test/form/samples/treeshake-excess-arguments/patterns/_config.js index 6a644e8b64e..1d2c361300b 100644 --- a/test/form/samples/treeshake-excess-arguments/patterns/_config.js +++ b/test/form/samples/treeshake-excess-arguments/patterns/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes unneeded arguments from calls when patterns are used' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/rest-element/_config.js b/test/form/samples/treeshake-excess-arguments/rest-element/_config.js index 2daa706360d..2b00e145816 100644 --- a/test/form/samples/treeshake-excess-arguments/rest-element/_config.js +++ b/test/form/samples/treeshake-excess-arguments/rest-element/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not remove arguments from calls when rest parameters are used' -}; +}); diff --git a/test/form/samples/treeshake-excess-arguments/unused-parameters/_config.js b/test/form/samples/treeshake-excess-arguments/unused-parameters/_config.js index ebe92e0065f..c68fa60250e 100644 --- a/test/form/samples/treeshake-excess-arguments/unused-parameters/_config.js +++ b/test/form/samples/treeshake-excess-arguments/unused-parameters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes arguments that correspond to unused parameters' -}; +}); diff --git a/test/form/samples/treeshake-import-meta-props/_config.js b/test/form/samples/treeshake-import-meta-props/_config.js index d73457be9b1..cff2de822ac 100644 --- a/test/form/samples/treeshake-import-meta-props/_config.js +++ b/test/form/samples/treeshake-import-meta-props/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'also does not include format globals when tree-shaking import meta' -}; +}); diff --git a/test/form/samples/treeshake-import-meta/_config.js b/test/form/samples/treeshake-import-meta/_config.js index 64d9f998bc0..42c63f7922f 100644 --- a/test/form/samples/treeshake-import-meta/_config.js +++ b/test/form/samples/treeshake-import-meta/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports tree-shaking for meta properties' -}; +}); diff --git a/test/form/samples/treeshake-json/_config.js b/test/form/samples/treeshake-json/_config.js index 732525751e4..5adc22a8df2 100644 --- a/test/form/samples/treeshake-json/_config.js +++ b/test/form/samples/treeshake-json/_config.js @@ -1,6 +1,6 @@ -const json = require('@rollup/plugin-json'); +const json = require('@rollup/plugin-json').default; -module.exports = { +module.exports = defineTest({ description: 'removes unusued json keys', options: { plugins: [json()] } -}; +}); diff --git a/test/form/samples/treeshake-namespace-access/_config.js b/test/form/samples/treeshake-namespace-access/_config.js index 8f398f593b2..de35a4275e8 100644 --- a/test/form/samples/treeshake-namespace-access/_config.js +++ b/test/form/samples/treeshake-namespace-access/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not count namespace property access as side-effect', options: { external: 'external' } -}; +}); diff --git a/test/form/samples/treeshake-presets/preset-with-override/_config.js b/test/form/samples/treeshake-presets/preset-with-override/_config.js index d12b226cd23..b1741c8afba 100644 --- a/test/form/samples/treeshake-presets/preset-with-override/_config.js +++ b/test/form/samples/treeshake-presets/preset-with-override/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'allows using the "preset" option with overrides', options: { treeshake: { @@ -10,17 +10,21 @@ module.exports = { }, plugins: [ { + name: 'test-plugin', buildStart(options) { + if (!options.treeshake) { + throw new Error('Treeshaking options not found'); + } assert.strictEqual(options.treeshake.correctVarValueBeforeDeclaration, false); assert.strictEqual(options.treeshake.propertyReadSideEffects, false); assert.strictEqual(options.treeshake.tryCatchDeoptimization, false); assert.strictEqual(options.treeshake.unknownGlobalSideEffects, true); assert.strictEqual( - options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js')), + options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js'), false), false ); } } ] } -}; +}); diff --git a/test/form/samples/treeshake-presets/recommended/_config.js b/test/form/samples/treeshake-presets/recommended/_config.js index 408a74b5788..c55983ad497 100644 --- a/test/form/samples/treeshake-presets/recommended/_config.js +++ b/test/form/samples/treeshake-presets/recommended/_config.js @@ -1,23 +1,27 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'handles treeshake preset "recommended"', options: { treeshake: 'recommended', plugins: [ { + name: 'test-plugin', buildStart(options) { + if (!options.treeshake) { + throw new Error('Treeshaking options not found'); + } assert.strictEqual(options.treeshake.correctVarValueBeforeDeclaration, false); assert.strictEqual(options.treeshake.propertyReadSideEffects, true); assert.strictEqual(options.treeshake.tryCatchDeoptimization, true); assert.strictEqual(options.treeshake.unknownGlobalSideEffects, false); assert.strictEqual( - options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js')), + options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js'), false), true ); } } ] } -}; +}); diff --git a/test/form/samples/treeshake-presets/safest/_config.js b/test/form/samples/treeshake-presets/safest/_config.js index 58cc89aad06..050200d282a 100644 --- a/test/form/samples/treeshake-presets/safest/_config.js +++ b/test/form/samples/treeshake-presets/safest/_config.js @@ -1,23 +1,27 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'handles treeshake preset "safest"', options: { treeshake: 'safest', plugins: [ { + name: 'test', buildStart(options) { + if (!options.treeshake) { + throw new Error('Treeshaking options not found'); + } assert.strictEqual(options.treeshake.correctVarValueBeforeDeclaration, true); assert.strictEqual(options.treeshake.propertyReadSideEffects, true); assert.strictEqual(options.treeshake.tryCatchDeoptimization, true); assert.strictEqual(options.treeshake.unknownGlobalSideEffects, true); assert.strictEqual( - options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js')), + options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js'), false), true ); } } ] } -}; +}); diff --git a/test/form/samples/treeshake-presets/smallest/_config.js b/test/form/samples/treeshake-presets/smallest/_config.js index 9e694f6a1a9..67519625a65 100644 --- a/test/form/samples/treeshake-presets/smallest/_config.js +++ b/test/form/samples/treeshake-presets/smallest/_config.js @@ -1,23 +1,27 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'handles treeshake preset "smallest"', options: { treeshake: 'smallest', plugins: [ { + name: 'test', buildStart(options) { + if (!options.treeshake) { + throw new Error('Treeshaking options not found'); + } assert.strictEqual(options.treeshake.correctVarValueBeforeDeclaration, false); assert.strictEqual(options.treeshake.propertyReadSideEffects, false); assert.strictEqual(options.treeshake.tryCatchDeoptimization, false); assert.strictEqual(options.treeshake.unknownGlobalSideEffects, false); assert.strictEqual( - options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js')), + options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js'), false), false ); } } ] } -}; +}); diff --git a/test/form/samples/treeshake-presets/true/_config.js b/test/form/samples/treeshake-presets/true/_config.js index 0b84faac597..dbdb5fd849a 100644 --- a/test/form/samples/treeshake-presets/true/_config.js +++ b/test/form/samples/treeshake-presets/true/_config.js @@ -1,23 +1,27 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'handles treeshake preset true', options: { treeshake: true, plugins: [ { + name: 'test', buildStart(options) { + if (!options.treeshake) { + throw new Error('Treeshaking is not enabled'); + } assert.strictEqual(options.treeshake.correctVarValueBeforeDeclaration, false); assert.strictEqual(options.treeshake.propertyReadSideEffects, true); assert.strictEqual(options.treeshake.tryCatchDeoptimization, true); assert.strictEqual(options.treeshake.unknownGlobalSideEffects, true); assert.strictEqual( - options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js')), + options.treeshake.moduleSideEffects(path.join(__dirname, 'dep.js'), false), true ); } } ] } -}; +}); diff --git a/test/form/samples/treeshake-sequence-expressions/_config.js b/test/form/samples/treeshake-sequence-expressions/_config.js index 011dc34eb64..4b854f85752 100644 --- a/test/form/samples/treeshake-sequence-expressions/_config.js +++ b/test/form/samples/treeshake-sequence-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'removes the last element of a sequence expression if it is unused' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/deactivate-via-option/_config.js b/test/form/samples/try-statement-deoptimization/deactivate-via-option/_config.js index 51ef18c06d6..3515683a734 100644 --- a/test/form/samples/try-statement-deoptimization/deactivate-via-option/_config.js +++ b/test/form/samples/try-statement-deoptimization/deactivate-via-option/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'deactivates try-catch-deoptimization via option', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/direct-inclusion/_config.js b/test/form/samples/try-statement-deoptimization/direct-inclusion/_config.js index 2b9014d625b..254e057ee62 100644 --- a/test/form/samples/try-statement-deoptimization/direct-inclusion/_config.js +++ b/test/form/samples/try-statement-deoptimization/direct-inclusion/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side-effect-free code in try-statement-blocks' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/follow-parameters/_config.js b/test/form/samples/try-statement-deoptimization/follow-parameters/_config.js index 4093ba3d54e..c36adec4846 100644 --- a/test/form/samples/try-statement-deoptimization/follow-parameters/_config.js +++ b/test/form/samples/try-statement-deoptimization/follow-parameters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side-effect-free code in parameters called from try-statement-blocks' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/follow-pattern-parameters/_config.js b/test/form/samples/try-statement-deoptimization/follow-pattern-parameters/_config.js index 6ce753ad006..1eb45daf126 100644 --- a/test/form/samples/try-statement-deoptimization/follow-pattern-parameters/_config.js +++ b/test/form/samples/try-statement-deoptimization/follow-pattern-parameters/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side-effect-free code in pattern parameters called from try-statement-blocks' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/follow-variables/_config.js b/test/form/samples/try-statement-deoptimization/follow-variables/_config.js index 7422ae5cf03..277d526d601 100644 --- a/test/form/samples/try-statement-deoptimization/follow-variables/_config.js +++ b/test/form/samples/try-statement-deoptimization/follow-variables/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not retain side-effect-free code in functions called from try-statement-blocks' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/include-via-outside-variable/_config.js b/test/form/samples/try-statement-deoptimization/include-via-outside-variable/_config.js index 8c0617a56c6..e6f03cf5d2f 100644 --- a/test/form/samples/try-statement-deoptimization/include-via-outside-variable/_config.js +++ b/test/form/samples/try-statement-deoptimization/include-via-outside-variable/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'works when the try-statement is included via an outside variable' -}; +}); diff --git a/test/form/samples/try-statement-deoptimization/supports-core-js/_config.js b/test/form/samples/try-statement-deoptimization/supports-core-js/_config.js index ee05dfb0bf9..ad69e3e1050 100644 --- a/test/form/samples/try-statement-deoptimization/supports-core-js/_config.js +++ b/test/form/samples/try-statement-deoptimization/supports-core-js/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports core-js feature detection (#2869)' -}; +}); diff --git a/test/form/samples/typeof-side-effect/_config.js b/test/form/samples/typeof-side-effect/_config.js index bbdda1c3147..99bb8e82b43 100644 --- a/test/form/samples/typeof-side-effect/_config.js +++ b/test/form/samples/typeof-side-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'using typeof is does not trigger global side-effects' -}; +}); diff --git a/test/form/samples/umd-noconflict-extend/_config.js b/test/form/samples/umd-noconflict-extend/_config.js index 8ca8fb742a0..cb71f124fcc 100644 --- a/test/form/samples/umd-noconflict-extend/_config.js +++ b/test/form/samples/umd-noconflict-extend/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'exports noConflict method for default umd when requested', options: { output: { @@ -7,4 +7,4 @@ module.exports = { name: 'FooBar' } } -}; +}); diff --git a/test/form/samples/umd-noconflict-namespaced/_config.js b/test/form/samples/umd-noconflict-namespaced/_config.js index 5a404b1f2da..22ba6ee0073 100644 --- a/test/form/samples/umd-noconflict-namespaced/_config.js +++ b/test/form/samples/umd-noconflict-namespaced/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'exports noConflict method for default umd when requested', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'my.name.spaced.module' } } -}; +}); diff --git a/test/form/samples/umd-noconflict-no-exports/_config.js b/test/form/samples/umd-noconflict-no-exports/_config.js index 93a353386b0..8ce873ecaf0 100644 --- a/test/form/samples/umd-noconflict-no-exports/_config.js +++ b/test/form/samples/umd-noconflict-no-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'exports noConflict even when there are no exports', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'FooBar' } } -}; +}); diff --git a/test/form/samples/umd-noconflict/_config.js b/test/form/samples/umd-noconflict/_config.js index 69e810bb044..c24d5fecf6b 100644 --- a/test/form/samples/umd-noconflict/_config.js +++ b/test/form/samples/umd-noconflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'exports noConflict method for default umd when requested', options: { output: { @@ -6,4 +6,4 @@ module.exports = { name: 'FooBar' } } -}; +}); diff --git a/test/form/samples/unary-expressions/_config.js b/test/form/samples/unary-expressions/_config.js index 9e363ae5176..beef6b92d99 100644 --- a/test/form/samples/unary-expressions/_config.js +++ b/test/form/samples/unary-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unary expression side-effects' -}; +}); diff --git a/test/form/samples/undefined-default-export/_config.js b/test/form/samples/undefined-default-export/_config.js index 1149b6e503d..ac9baa670ac 100644 --- a/test/form/samples/undefined-default-export/_config.js +++ b/test/form/samples/undefined-default-export/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default exporting undefined' -}; +}); diff --git a/test/form/samples/undefined-var/_config.js b/test/form/samples/undefined-var/_config.js index 7144d47d8f1..c516217f427 100644 --- a/test/form/samples/undefined-var/_config.js +++ b/test/form/samples/undefined-var/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treeshakes undefined variable literals' -}; +}); diff --git a/test/form/samples/unknown-token-effects/_config.js b/test/form/samples/unknown-token-effects/_config.js index 66f57107b45..c917c7ca256 100644 --- a/test/form/samples/unknown-token-effects/_config.js +++ b/test/form/samples/unknown-token-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not tree-shake unknown tokens', options: { acornInjectPlugins: Parser => @@ -14,4 +14,4 @@ module.exports = { } } } -}; +}); diff --git a/test/form/samples/unmodified-default-exports-function-argument/_config.js b/test/form/samples/unmodified-default-exports-function-argument/_config.js index 3ccba4c4a9e..2d939cc98fb 100644 --- a/test/form/samples/unmodified-default-exports-function-argument/_config.js +++ b/test/form/samples/unmodified-default-exports-function-argument/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'passing unbound default export to function cannot rebind it' -}; +}); diff --git a/test/form/samples/unmodified-default-exports/_config.js b/test/form/samples/unmodified-default-exports/_config.js index c37ef0f18d7..ed52a41221f 100644 --- a/test/form/samples/unmodified-default-exports/_config.js +++ b/test/form/samples/unmodified-default-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not treat property assignment as rebinding for sake of unbound default exports' -}; +}); diff --git a/test/form/samples/unused-called-import/_config.js b/test/form/samples/unused-called-import/_config.js index 0f1029d3236..f5a7460e1ae 100644 --- a/test/form/samples/unused-called-import/_config.js +++ b/test/form/samples/unused-called-import/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not include called-in-unused-code import' -}; +}); diff --git a/test/form/samples/unused-called-with-side-effects/_config.js b/test/form/samples/unused-called-with-side-effects/_config.js index 0f1029d3236..f5a7460e1ae 100644 --- a/test/form/samples/unused-called-with-side-effects/_config.js +++ b/test/form/samples/unused-called-with-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not include called-in-unused-code import' -}; +}); diff --git a/test/form/samples/unused-default-exports/_config.js b/test/form/samples/unused-default-exports/_config.js index 31eeacde501..00ac617d1d8 100644 --- a/test/form/samples/unused-default-exports/_config.js +++ b/test/form/samples/unused-default-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not name unused-but-included default export' -}; +}); diff --git a/test/form/samples/unused-function-and-class-expressions/_config.js b/test/form/samples/unused-function-and-class-expressions/_config.js index d45e980e08a..1bd53412422 100644 --- a/test/form/samples/unused-function-and-class-expressions/_config.js +++ b/test/form/samples/unused-function-and-class-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly remove unused function and class expressions' -}; +}); diff --git a/test/form/samples/unused-import/_config.js b/test/form/samples/unused-import/_config.js index aa797dca171..c226e0233b2 100644 --- a/test/form/samples/unused-import/_config.js +++ b/test/form/samples/unused-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'excludes unused imports ([#595])', options: { external: ['external'], @@ -6,4 +6,4 @@ module.exports = { globals: { external: 'external' } } } -}; +}); diff --git a/test/form/samples/unused-inner-functions-and-classes/_config.js b/test/form/samples/unused-inner-functions-and-classes/_config.js index 76b31d1b101..4cc2333a8a3 100644 --- a/test/form/samples/unused-inner-functions-and-classes/_config.js +++ b/test/form/samples/unused-inner-functions-and-classes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not include unused inner functions and classes' -}; +}); diff --git a/test/form/samples/unused-var/_config.js b/test/form/samples/unused-var/_config.js index b89eb86733e..c4abc4beadf 100644 --- a/test/form/samples/unused-var/_config.js +++ b/test/form/samples/unused-var/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'omits unused var declaration' -}; +}); diff --git a/test/form/samples/update-expression-side-effects/_config.js b/test/form/samples/update-expression-side-effects/_config.js index 4dbc0f43e3f..f0459d97088 100644 --- a/test/form/samples/update-expression-side-effects/_config.js +++ b/test/form/samples/update-expression-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detect side-effects when dealing with update expressions' -}; +}); diff --git a/test/form/samples/updating-assignments/_config.js b/test/form/samples/updating-assignments/_config.js index b6633185ee0..c3745d1ecd0 100644 --- a/test/form/samples/updating-assignments/_config.js +++ b/test/form/samples/updating-assignments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Correctly handles assignment operators on exports', options: { output: { name: 'bundle' } } -}; +}); diff --git a/test/form/samples/url-external/_config.js b/test/form/samples/url-external/_config.js index 1a4fb129c72..837b3fc9b98 100644 --- a/test/form/samples/url-external/_config.js +++ b/test/form/samples/url-external/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'supports URL externals', options: { external: ['https://external.com/external.js'], @@ -6,4 +6,4 @@ module.exports = { globals: { 'https://external.com/external.js': 'external' } } } -}; +}); diff --git a/test/form/samples/use-class-name-in-static-block/_config.js b/test/form/samples/use-class-name-in-static-block/_config.js index 1ca77cc9bb4..5252b5c23d8 100644 --- a/test/form/samples/use-class-name-in-static-block/_config.js +++ b/test/form/samples/use-class-name-in-static-block/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'use the original class name instead of renderName in class body' -}; +}); diff --git a/test/form/samples/use-global-map-for-export-name/_config.js b/test/form/samples/use-global-map-for-export-name/_config.js index a2836987199..d47ec6c6faa 100644 --- a/test/form/samples/use-global-map-for-export-name/_config.js +++ b/test/form/samples/use-global-map-for-export-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'applies globals to output name', options: { output: { @@ -7,4 +7,4 @@ module.exports = { }, external: ['leaflet'] } -}; +}); diff --git a/test/form/samples/whitespace-around-namespace-member-expression/_config.js b/test/form/samples/whitespace-around-namespace-member-expression/_config.js index a97b168da8c..0329c415933 100644 --- a/test/form/samples/whitespace-around-namespace-member-expression/_config.js +++ b/test/form/samples/whitespace-around-namespace-member-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'whitespace around the "." in member expressions does not mess up renaming' -}; +}); diff --git a/test/form/samples/wrap-simplified-expressions/_config.js b/test/form/samples/wrap-simplified-expressions/_config.js index dfc3eb92f71..98a24ea9330 100644 --- a/test/form/samples/wrap-simplified-expressions/_config.js +++ b/test/form/samples/wrap-simplified-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'wraps simplified expressions that have become callees if necessary' -}; +}); diff --git a/test/form/samples/yield-expression/missing-space/_config.js b/test/form/samples/yield-expression/missing-space/_config.js index 3dace68f84f..fe27240a3bc 100644 --- a/test/form/samples/yield-expression/missing-space/_config.js +++ b/test/form/samples/yield-expression/missing-space/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Inserts space when simplifying yield expression without space' -}; +}); diff --git a/test/form/tsconfig.json b/test/form/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/form/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/function/define.d.ts b/test/function/define.d.ts new file mode 100644 index 00000000000..277a867082b --- /dev/null +++ b/test/function/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigFunction } from '../types'; + +declare global { + function defineTest(config: TestConfigFunction): TestConfigFunction; +} diff --git a/test/function/index.js b/test/function/index.js index 7adb8f2f182..80995398251 100644 --- a/test/function/index.js +++ b/test/function/index.js @@ -1,5 +1,9 @@ const assert = require('node:assert'); const path = require('node:path'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ +// @ts-expect-error not included in types const rollup = require('../../dist/rollup'); const { compareError, compareWarnings, runTestSuiteWithSamples } = require('../utils.js'); @@ -46,136 +50,149 @@ function runCodeSplitTest(codeMap, entryId, configContext) { return { exports }; } -runTestSuiteWithSamples('function', path.join(__dirname, 'samples'), (directory, config) => { - (config.skip ? it.skip : config.solo ? it.only : it)( - path.basename(directory) + ': ' + config.description, - () => { - if (config.show) console.group(path.basename(directory)); - if (config.before) config.before(); - process.chdir(directory); - const warnings = []; +runTestSuiteWithSamples( + 'function', + path.join(__dirname, 'samples'), + /** + * @param {import('../types').TestConfigFunction} config + */ + (directory, config) => { + (config.skip ? it.skip : config.solo ? it.only : it)( + path.basename(directory) + ': ' + config.description, + async () => { + if (config.show) console.group(path.basename(directory)); + if (config.before) { + await config.before(); + } + process.chdir(directory); + const warnings = []; - return rollup - .rollup({ - input: path.join(directory, 'main.js'), - onwarn: warning => warnings.push(warning), - strictDeprecations: true, - ...config.options - }) - .then(bundle => { - let unintendedError; + return rollup + .rollup({ + input: path.join(directory, 'main.js'), + onwarn: warning => warnings.push(warning), + strictDeprecations: true, + ...config.options + }) + .then(bundle => { + let unintendedError; - if (config.error) { - throw new Error('Expected an error while rolling up'); - } + if (config.error) { + throw new Error('Expected an error while rolling up'); + } - let result; + let result; - return bundle - .generate({ - exports: 'auto', - format: 'cjs', - ...(config.options || {}).output - }) - .then(({ output }) => { - if (config.generateError) { - unintendedError = new Error('Expected an error while generating output'); - } + return bundle + .generate({ + exports: 'auto', + format: 'cjs', + ...(config.options || {}).output + }) + .then(({ output }) => { + if (config.generateError) { + unintendedError = new Error('Expected an error while generating output'); + } - result = output; - }) - .catch(error => { - if (config.generateError) { - compareError(error, config.generateError); - } else { - throw error; - } - }) - .then(() => { - if (unintendedError) throw unintendedError; - if (config.error || config.generateError) return; + result = output; + }) + .catch(error => { + if (config.generateError) { + compareError(error, config.generateError); + } else { + throw error; + } + }) + .then(() => { + if (unintendedError) throw unintendedError; + if (config.error || config.generateError) return; - const codeMap = result.reduce((codeMap, chunk) => { - codeMap[chunk.fileName] = chunk.code; - return codeMap; - }, {}); - if (config.code) { - config.code(result.length === 1 ? result[0].code : codeMap); - } + const codeMap = result.reduce((codeMap, chunk) => { + codeMap[chunk.fileName] = chunk.code; + return codeMap; + }, {}); + if (config.code) { + config.code(result.length === 1 ? result[0].code : codeMap); + } - const entryId = result.length === 1 ? result[0].fileName : 'main.js'; - if (!codeMap.hasOwnProperty(entryId)) { - throw new Error( - `Could not find entry "${entryId}" in generated output.\nChunks:\n${Object.keys( - codeMap - ).join('\n')}` - ); - } - const { exports, error } = runCodeSplitTest(codeMap, entryId, config.context); - if (config.runtimeError) { - if (error) { - config.runtimeError(error); - } else { - unintendedError = new Error('Expected an error while executing output'); + const entryId = result.length === 1 ? result[0].fileName : 'main.js'; + if (!codeMap.hasOwnProperty(entryId)) { + throw new Error( + `Could not find entry "${entryId}" in generated output.\nChunks:\n${Object.keys( + codeMap + ).join('\n')}` + ); } - } else if (error) { - unintendedError = error; - } - return Promise.resolve() - .then(() => { - if (config.exports && !unintendedError) { - return config.exports(exports); - } - }) - .then(() => { - if (config.bundle && !unintendedError) { - return config.bundle(bundle); - } - }) - .catch(error_ => { - if (config.runtimeError) { - config.runtimeError(error_); + const { exports, error } = runCodeSplitTest(codeMap, entryId, config.context); + if (config.runtimeError) { + if (error) { + config.runtimeError(error); } else { - unintendedError = error_; + unintendedError = new Error('Expected an error while executing output'); } - }) - .then(() => { - if (config.show || unintendedError) { - for (const chunk of result) { - console.group(chunk.fileName); - console.log(chunk.code); - console.groupEnd(); - console.log(); + } else if (error) { + unintendedError = error; + } + return Promise.resolve() + .then(() => { + if (config.exports && !unintendedError) { + return config.exports(exports); } - } - - if (config.warnings) { - if (Array.isArray(config.warnings)) { - compareWarnings(warnings, config.warnings); + }) + .then(() => { + if (config.bundle && !unintendedError) { + return config.bundle(bundle); + } + }) + .catch(error_ => { + if (config.runtimeError) { + config.runtimeError(error_); } else { - config.warnings(warnings); + unintendedError = error_; } - } else if (warnings.length > 0) { - throw new Error( - `Got unexpected warnings:\n${warnings - .map(warning => warning.message) - .join('\n')}` - ); - } - if (config.show) console.groupEnd(); - if (unintendedError) throw unintendedError; - if (config.after) config.after(); - }); - }); - }) - .catch(error => { - if (config.error) { - compareError(error, config.error); - } else { - throw error; - } - if (config.after) config.after(); - }); - } - ); -}); + }) + .then(() => { + if (config.show || unintendedError) { + for (const chunk of result) { + console.group(chunk.fileName); + console.log(chunk.code); + console.groupEnd(); + console.log(); + } + } + + if (config.warnings) { + if (Array.isArray(config.warnings)) { + compareWarnings(warnings, config.warnings); + } else { + config.warnings(warnings); + } + } else if (warnings.length > 0) { + throw new Error( + `Got unexpected warnings:\n${warnings + .map(warning => warning.message) + .join('\n')}` + ); + } + if (config.show) console.groupEnd(); + if (unintendedError) throw unintendedError; + if (config.after) { + return config.after(); + } + }); + }); + }) + .catch(error => { + if (config.error) { + compareError(error, config.error); + } else { + throw error; + } + if (config.after) { + return config.after(); + } + }); + } + ); + } +); diff --git a/test/function/samples/access-instance-prop/_config.js b/test/function/samples/access-instance-prop/_config.js index 98b5968822b..cfe057741b2 100644 --- a/test/function/samples/access-instance-prop/_config.js +++ b/test/function/samples/access-instance-prop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'respects getters when accessing properties of an instance' -}; +}); diff --git a/test/function/samples/add-watch-file-generate/_config.js b/test/function/samples/add-watch-file-generate/_config.js index 19e2326f447..1a36f9f8afa 100644 --- a/test/function/samples/add-watch-file-generate/_config.js +++ b/test/function/samples/add-watch-file-generate/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when adding watch files during generate', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'INVALID_ROLLUP_PHASE' } -}; +}); diff --git a/test/function/samples/adds-json-hint-for-missing-export-if-is-json-file/_config.js b/test/function/samples/adds-json-hint-for-missing-export-if-is-json-file/_config.js index 5e6de887028..880360056f7 100644 --- a/test/function/samples/adds-json-hint-for-missing-export-if-is-json-file/_config.js +++ b/test/function/samples/adds-json-hint-for-missing-export-if-is-json-file/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_ARRAY_JSON = path.join(__dirname, 'array.json'); -module.exports = { +module.exports = defineTest({ description: 'should provide json hint when importing a no export json file', error: { binding: 'default', @@ -25,4 +25,4 @@ module.exports = { message: '"default" is not exported by "array.json", imported by "main.js". (Note that you need @rollup/plugin-json to import JSON files)' } -}; +}); diff --git a/test/function/samples/adds-semicolons-if-necessary-b/_config.js b/test/function/samples/adds-semicolons-if-necessary-b/_config.js index bb17123ec79..b7cbe7a3f55 100644 --- a/test/function/samples/adds-semicolons-if-necessary-b/_config.js +++ b/test/function/samples/adds-semicolons-if-necessary-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds semi-colons if necessary' -}; +}); diff --git a/test/function/samples/adds-semicolons-if-necessary-c/_config.js b/test/function/samples/adds-semicolons-if-necessary-c/_config.js index bb17123ec79..b7cbe7a3f55 100644 --- a/test/function/samples/adds-semicolons-if-necessary-c/_config.js +++ b/test/function/samples/adds-semicolons-if-necessary-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds semi-colons if necessary' -}; +}); diff --git a/test/function/samples/adds-semicolons-if-necessary-d/_config.js b/test/function/samples/adds-semicolons-if-necessary-d/_config.js index bb17123ec79..b7cbe7a3f55 100644 --- a/test/function/samples/adds-semicolons-if-necessary-d/_config.js +++ b/test/function/samples/adds-semicolons-if-necessary-d/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds semi-colons if necessary' -}; +}); diff --git a/test/function/samples/adds-semicolons-if-necessary/_config.js b/test/function/samples/adds-semicolons-if-necessary/_config.js index bb17123ec79..b7cbe7a3f55 100644 --- a/test/function/samples/adds-semicolons-if-necessary/_config.js +++ b/test/function/samples/adds-semicolons-if-necessary/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds semi-colons if necessary' -}; +}); diff --git a/test/function/samples/adds-timings-to-bundle-when-codesplitting/_config.js b/test/function/samples/adds-timings-to-bundle-when-codesplitting/_config.js index 33bc52f42e7..88086e2d5a8 100644 --- a/test/function/samples/adds-timings-to-bundle-when-codesplitting/_config.js +++ b/test/function/samples/adds-timings-to-bundle-when-codesplitting/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Adds timing information to bundle when bundling with perf=true', options: { input: ['main.js', 'main2.js'], @@ -17,4 +17,4 @@ module.exports = { assert.ok(timings[timer][0] >= 0, 'Timer is not non-negative.'); } } -}; +}); diff --git a/test/function/samples/adds-timings-to-bundle/_config.js b/test/function/samples/adds-timings-to-bundle/_config.js index 8595fe45a18..66ced94a3e2 100644 --- a/test/function/samples/adds-timings-to-bundle/_config.js +++ b/test/function/samples/adds-timings-to-bundle/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Adds timing information to bundle when bundling with perf=true', options: { perf: true @@ -16,4 +16,4 @@ module.exports = { assert.ok(timings[timer][0] >= 0, 'Timer is not non-negative.'); } } -}; +}); diff --git a/test/function/samples/aliased-not-exported-twice/_config.js b/test/function/samples/aliased-not-exported-twice/_config.js index 1bb827de735..0f9e90ff730 100644 --- a/test/function/samples/aliased-not-exported-twice/_config.js +++ b/test/function/samples/aliased-not-exported-twice/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not export aliased binding under original name (#438)', exports(exports) { assert.equal(exports.number, 0); @@ -9,4 +9,4 @@ module.exports = { assert.ok(!('count' in exports)); } -}; +}); diff --git a/test/function/samples/allow-reserved/_config.js b/test/function/samples/allow-reserved/_config.js index 63f2a11c03f..810d2959e67 100644 --- a/test/function/samples/allow-reserved/_config.js +++ b/test/function/samples/allow-reserved/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'allow reserved identifiers via custom acorn options', options: { acorn: { allowReserved: true } } -}; +}); diff --git a/test/function/samples/allow-undefined-as-parameter/_config.js b/test/function/samples/allow-undefined-as-parameter/_config.js index 5143691be92..9428adf5439 100644 --- a/test/function/samples/allow-undefined-as-parameter/_config.js +++ b/test/function/samples/allow-undefined-as-parameter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not make assumptions about its value when using undefined as a parameter name' -}; +}); diff --git a/test/function/samples/allows-external-modules-from-nested-module/_config.js b/test/function/samples/allows-external-modules-from-nested-module/_config.js index f59b20ffa1b..b3523c17432 100644 --- a/test/function/samples/allows-external-modules-from-nested-module/_config.js +++ b/test/function/samples/allows-external-modules-from-nested-module/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'imports external modules from nested internal modules', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/allows-unknown-binary-operators/_config.js b/test/function/samples/allows-unknown-binary-operators/_config.js index 59419b6caa7..8c4b6a8bd1a 100644 --- a/test/function/samples/allows-unknown-binary-operators/_config.js +++ b/test/function/samples/allows-unknown-binary-operators/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows unknown binary operators' -}; +}); diff --git a/test/function/samples/already-deshadowed-import/_config.js b/test/function/samples/already-deshadowed-import/_config.js index dea226671c3..abe0336dca5 100644 --- a/test/function/samples/already-deshadowed-import/_config.js +++ b/test/function/samples/already-deshadowed-import/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_BOB = path.join(__dirname, 'bob.js'); const ID_ALICE = path.join(__dirname, 'alice.js'); -module.exports = { +module.exports = defineTest({ description: 'handle already module import names correctly if they are have already been deshadowed', warnings: [ @@ -12,4 +12,4 @@ module.exports = { message: 'Circular dependency: bob.js -> alice.js -> bob.js' } ] -}; +}); diff --git a/test/function/samples/amd-auto-id-id/_config.js b/test/function/samples/amd-auto-id-id/_config.js index 5ba6165fc43..856db562577 100644 --- a/test/function/samples/amd-auto-id-id/_config.js +++ b/test/function/samples/amd-auto-id-id/_config.js @@ -1,7 +1,16 @@ -module.exports = { +// @ts-check + +module.exports = defineTest({ description: 'throws when using both the amd.autoId and the amd.id option', options: { - output: { dir: 'dist', amd: { autoId: 'a', id: 'a' } } + output: { + dir: 'dist', + amd: { + // @ts-expect-error expected error + autoId: 'a', + id: 'a' + } + } }, generateError: { code: 'INVALID_OPTION', @@ -9,4 +18,4 @@ module.exports = { 'Invalid value for option "output.amd.id" - this option cannot be used together with "output.amd.autoId"/"output.amd.basePath".', url: 'https://rollupjs.org/configuration-options/#output-amd-id' } -}; +}); diff --git a/test/function/samples/amd-base-path-id/_config.js b/test/function/samples/amd-base-path-id/_config.js index 7675080e10a..6fd36255965 100644 --- a/test/function/samples/amd-base-path-id/_config.js +++ b/test/function/samples/amd-base-path-id/_config.js @@ -1,7 +1,16 @@ -module.exports = { +// @ts-check + +module.exports = defineTest({ description: 'throws when using both the amd.basePath and the amd.id option', options: { - output: { dir: 'dist', amd: { basePath: 'a', id: 'a' } } + output: { + dir: 'dist', + amd: { + // @ts-expect-error expected error + basePath: 'a', + id: 'a' + } + } }, generateError: { code: 'INVALID_OPTION', @@ -9,4 +18,4 @@ module.exports = { 'Invalid value for option "output.amd.id" - this option cannot be used together with "output.amd.autoId"/"output.amd.basePath".', url: 'https://rollupjs.org/configuration-options/#output-amd-id' } -}; +}); diff --git a/test/function/samples/amd-base-path/_config.js b/test/function/samples/amd-base-path/_config.js index 98fff2c58e7..12d674d59a7 100644 --- a/test/function/samples/amd-base-path/_config.js +++ b/test/function/samples/amd-base-path/_config.js @@ -1,7 +1,13 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using only amd.basePath option', options: { - output: { dir: 'dist', amd: { basePath: 'a' } } + output: { + dir: 'dist', + amd: { + // @ts-expect-error expected error + basePath: 'a' + } + } }, generateError: { code: 'INVALID_OPTION', @@ -9,4 +15,4 @@ module.exports = { 'Invalid value for option "output.amd.basePath" - this option only works with "output.amd.autoId".', url: 'https://rollupjs.org/configuration-options/#output-amd-basepath' } -}; +}); diff --git a/test/function/samples/arbitrary-module-namespace-identifiers/_config.js b/test/function/samples/arbitrary-module-namespace-identifiers/_config.js index 91e53ae26c7..4de0134af78 100644 --- a/test/function/samples/arbitrary-module-namespace-identifiers/_config.js +++ b/test/function/samples/arbitrary-module-namespace-identifiers/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports arbitrary module namespace identifiers' -}; +}); diff --git a/test/function/samples/argument-deoptimization/global-calls/_config.js b/test/function/samples/argument-deoptimization/global-calls/_config.js index 1e1df493faf..4cae795a68a 100644 --- a/test/function/samples/argument-deoptimization/global-calls/_config.js +++ b/test/function/samples/argument-deoptimization/global-calls/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks argument mutations of calls to globals', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-access-mutation/_config.js b/test/function/samples/argument-deoptimization/parameter-access-mutation/_config.js index e087e067e42..e495ceb3b8c 100644 --- a/test/function/samples/argument-deoptimization/parameter-access-mutation/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-access-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters when accessed' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-call-mutation/_config.js b/test/function/samples/argument-deoptimization/parameter-call-mutation/_config.js index 944b9832756..0bbcc602c1f 100644 --- a/test/function/samples/argument-deoptimization/parameter-call-mutation/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-call-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters when called' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-deep-access-mutation/_config.js b/test/function/samples/argument-deoptimization/parameter-deep-access-mutation/_config.js index e087e067e42..e495ceb3b8c 100644 --- a/test/function/samples/argument-deoptimization/parameter-deep-access-mutation/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-deep-access-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters when accessed' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-mutation-destructured/_config.js b/test/function/samples/argument-deoptimization/parameter-mutation-destructured/_config.js index 4ffeb2f76ed..4513b76f394 100644 --- a/test/function/samples/argument-deoptimization/parameter-mutation-destructured/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-mutation-destructured/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of destructured function parameters' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-mutation-spread/_config.js b/test/function/samples/argument-deoptimization/parameter-mutation-spread/_config.js index ce41790c814..1bff8ad08c4 100644 --- a/test/function/samples/argument-deoptimization/parameter-mutation-spread/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-mutation-spread/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters picked up by spread operator' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-mutation/_config.js b/test/function/samples/argument-deoptimization/parameter-mutation/_config.js index aa4e69e24d6..b9398cb6bdf 100644 --- a/test/function/samples/argument-deoptimization/parameter-mutation/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters' -}; +}); diff --git a/test/function/samples/argument-deoptimization/parameter-variable-merge/_config.js b/test/function/samples/argument-deoptimization/parameter-variable-merge/_config.js index 9b8e311a1ea..6e54decc80b 100644 --- a/test/function/samples/argument-deoptimization/parameter-variable-merge/_config.js +++ b/test/function/samples/argument-deoptimization/parameter-variable-merge/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly merges parameters and variable declarations' -}; +}); diff --git a/test/function/samples/argument-deoptimization/return-function-known/_config.js b/test/function/samples/argument-deoptimization/return-function-known/_config.js index d73a9a80f11..d3d765cf06d 100644 --- a/test/function/samples/argument-deoptimization/return-function-known/_config.js +++ b/test/function/samples/argument-deoptimization/return-function-known/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters by known returned functions' -}; +}); diff --git a/test/function/samples/argument-deoptimization/return-function-unknown/_config.js b/test/function/samples/argument-deoptimization/return-function-unknown/_config.js index d73a9a80f11..d3d765cf06d 100644 --- a/test/function/samples/argument-deoptimization/return-function-unknown/_config.js +++ b/test/function/samples/argument-deoptimization/return-function-unknown/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of function parameters by known returned functions' -}; +}); diff --git a/test/function/samples/argument-deoptimization/unknown-global-assignment/_config.js b/test/function/samples/argument-deoptimization/unknown-global-assignment/_config.js index d45b151f079..14760749f35 100644 --- a/test/function/samples/argument-deoptimization/unknown-global-assignment/_config.js +++ b/test/function/samples/argument-deoptimization/unknown-global-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of assignments to unknown globals' -}; +}); diff --git a/test/function/samples/argument-deoptimization/unknown-global-call/_config.js b/test/function/samples/argument-deoptimization/unknown-global-call/_config.js index e583ed73ff6..e081e8244db 100644 --- a/test/function/samples/argument-deoptimization/unknown-global-call/_config.js +++ b/test/function/samples/argument-deoptimization/unknown-global-call/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks argument mutations of calls to unknown globals' -}; +}); diff --git a/test/function/samples/argument-treeshaking-parameter-conflict/_config.js b/test/function/samples/argument-treeshaking-parameter-conflict/_config.js index a5e3f2c5620..cccfdf70011 100644 --- a/test/function/samples/argument-treeshaking-parameter-conflict/_config.js +++ b/test/function/samples/argument-treeshaking-parameter-conflict/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not cause conflicts when deconflicting non-included parameters' -}; +}); diff --git a/test/function/samples/array-double-spread/_config.js b/test/function/samples/array-double-spread/_config.js index a46300f406f..131e3581fbf 100644 --- a/test/function/samples/array-double-spread/_config.js +++ b/test/function/samples/array-double-spread/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly deoptimizes when there is no proto' -}; +}); diff --git a/test/function/samples/array-from-side-effect/_config.js b/test/function/samples/array-from-side-effect/_config.js index 6c7562ed5c1..13db3d76d16 100644 --- a/test/function/samples/array-from-side-effect/_config.js +++ b/test/function/samples/array-from-side-effect/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Observes side-effects in Array.from', exports(exports) { assert.strictEqual(exports.x, 7); } -}; +}); diff --git a/test/function/samples/array-getter/_config.js b/test/function/samples/array-getter/_config.js index e0437548252..77d995f7548 100644 --- a/test/function/samples/array-getter/_config.js +++ b/test/function/samples/array-getter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters defined on arrays' -}; +}); diff --git a/test/function/samples/array-mutation/_config.js b/test/function/samples/array-mutation/_config.js index 612a42d2e21..7aedc8b8dad 100644 --- a/test/function/samples/array-mutation/_config.js +++ b/test/function/samples/array-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks array mutations' -}; +}); diff --git a/test/function/samples/asi-prevention-with-comment-like-strings/_config.js b/test/function/samples/asi-prevention-with-comment-like-strings/_config.js index 97a6b347859..c23920aa81d 100644 --- a/test/function/samples/asi-prevention-with-comment-like-strings/_config.js +++ b/test/function/samples/asi-prevention-with-comment-like-strings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'do not hang when scanning for line-breaks in ASI prevention and there are comment-like strings' -}; +}); diff --git a/test/function/samples/assign-namespace-to-var/_config.js b/test/function/samples/assign-namespace-to-var/_config.js index 1a7e54ffc20..dfa32a14fcd 100644 --- a/test/function/samples/assign-namespace-to-var/_config.js +++ b/test/function/samples/assign-namespace-to-var/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows a namespace to be assigned to a variable', warnings: [ { @@ -7,4 +7,4 @@ module.exports = { names: ['main'] } ] -}; +}); diff --git a/test/function/samples/assignment-deoptimization/assignee-is-deoptimized/_config.js b/test/function/samples/assignment-deoptimization/assignee-is-deoptimized/_config.js index 25bb08a0f03..746e1e85c49 100644 --- a/test/function/samples/assignment-deoptimization/assignee-is-deoptimized/_config.js +++ b/test/function/samples/assignment-deoptimization/assignee-is-deoptimized/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure the assignee is deoptimized' -}; +}); diff --git a/test/function/samples/assignment-deoptimization/assignment-target-is-deoptimized/_config.js b/test/function/samples/assignment-deoptimization/assignment-target-is-deoptimized/_config.js index cd94f45ae26..97798c8804f 100644 --- a/test/function/samples/assignment-deoptimization/assignment-target-is-deoptimized/_config.js +++ b/test/function/samples/assignment-deoptimization/assignment-target-is-deoptimized/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure the assignment target is deoptimized' -}; +}); diff --git a/test/function/samples/assignment-deoptimization/nested-assignment/_config.js b/test/function/samples/assignment-deoptimization/nested-assignment/_config.js index 7c3114ddadc..4fe911d3261 100644 --- a/test/function/samples/assignment-deoptimization/nested-assignment/_config.js +++ b/test/function/samples/assignment-deoptimization/nested-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks assigments nested in expressions that are included for other reasons' -}; +}); diff --git a/test/function/samples/assignment-deoptimization/try-catch-inclusion/_config.js b/test/function/samples/assignment-deoptimization/try-catch-inclusion/_config.js index 4a7b55c699a..16c632cf582 100644 --- a/test/function/samples/assignment-deoptimization/try-catch-inclusion/_config.js +++ b/test/function/samples/assignment-deoptimization/try-catch-inclusion/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks assigments included via try-catch-deoptimization' -}; +}); diff --git a/test/function/samples/assignment-patterns/_config.js b/test/function/samples/assignment-patterns/_config.js index 691299185ea..e106844c0c3 100644 --- a/test/function/samples/assignment-patterns/_config.js +++ b/test/function/samples/assignment-patterns/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows reassigments to default parameters that shadow imports' -}; +}); diff --git a/test/function/samples/assignment-to-exports-b/_config.js b/test/function/samples/assignment-to-exports-b/_config.js index a1b96267947..6a87b721e67 100644 --- a/test/function/samples/assignment-to-exports-b/_config.js +++ b/test/function/samples/assignment-to-exports-b/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports are rewritten inside a variable init', exports: exports => { assert.equal(exports.b, 42); } -}; +}); diff --git a/test/function/samples/assignment-to-exports/_config.js b/test/function/samples/assignment-to-exports/_config.js index 65f38c89c82..9c94ca8be1f 100644 --- a/test/function/samples/assignment-to-exports/_config.js +++ b/test/function/samples/assignment-to-exports/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports are kept up-to-date', exports(exports) { assert.equal(exports.count, 0); exports.incr(); assert.equal(exports.count, 1); } -}; +}); diff --git a/test/function/samples/assignment-to-re-exports-conflict/_config.js b/test/function/samples/assignment-to-re-exports-conflict/_config.js index bbe691c0698..831474af81d 100644 --- a/test/function/samples/assignment-to-re-exports-conflict/_config.js +++ b/test/function/samples/assignment-to-re-exports-conflict/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 're-exports are kept up-to-date', exports(exports) { assert.equal(exports.count, 0); exports.incr(); assert.equal(exports.count, 1); } -}; +}); diff --git a/test/function/samples/assignment-to-re-exports/_config.js b/test/function/samples/assignment-to-re-exports/_config.js index bbe691c0698..831474af81d 100644 --- a/test/function/samples/assignment-to-re-exports/_config.js +++ b/test/function/samples/assignment-to-re-exports/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 're-exports are kept up-to-date', exports(exports) { assert.equal(exports.count, 0); exports.incr(); assert.equal(exports.count, 1); } -}; +}); diff --git a/test/function/samples/associate-arrow-function-parameter-mutations/_config.js b/test/function/samples/associate-arrow-function-parameter-mutations/_config.js index ab5fdae4596..cb9e0ebafee 100644 --- a/test/function/samples/associate-arrow-function-parameter-mutations/_config.js +++ b/test/function/samples/associate-arrow-function-parameter-mutations/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates arrow function parameters with their call arguments with regard to mutations', exports(exports) { assert.equal(exports.baz, 'present'); } -}; +}); diff --git a/test/function/samples/associate-arrow-function-return-values/_config.js b/test/function/samples/associate-arrow-function-return-values/_config.js index 001f94ce2dd..9de1dd167b9 100644 --- a/test/function/samples/associate-arrow-function-return-values/_config.js +++ b/test/function/samples/associate-arrow-function-return-values/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function return values with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-es5-constructor-parameter-mutations/_config.js b/test/function/samples/associate-es5-constructor-parameter-mutations/_config.js index 99c28faadfd..58d8bdb147a 100644 --- a/test/function/samples/associate-es5-constructor-parameter-mutations/_config.js +++ b/test/function/samples/associate-es5-constructor-parameter-mutations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates ES5 constructor parameters with their call arguments', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-es6-constructor-parameter-mutations/_config.js b/test/function/samples/associate-es6-constructor-parameter-mutations/_config.js index 99c28faadfd..58d8bdb147a 100644 --- a/test/function/samples/associate-es6-constructor-parameter-mutations/_config.js +++ b/test/function/samples/associate-es6-constructor-parameter-mutations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates ES5 constructor parameters with their call arguments', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-parameter-mutations-2/_config.js b/test/function/samples/associate-function-parameter-mutations-2/_config.js index 88a9f917c47..7cb7c66853e 100644 --- a/test/function/samples/associate-function-parameter-mutations-2/_config.js +++ b/test/function/samples/associate-function-parameter-mutations-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function parameters with their call arguments with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-parameter-mutations/_config.js b/test/function/samples/associate-function-parameter-mutations/_config.js index 0a4917012dc..b9835c8de95 100644 --- a/test/function/samples/associate-function-parameter-mutations/_config.js +++ b/test/function/samples/associate-function-parameter-mutations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function parameters with their call arguments with regard to mutations', exports(exports) { assert.equal(exports.baz, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values-2/_config.js b/test/function/samples/associate-function-return-values-2/_config.js index 1fc6c4a79d9..459e20d848c 100644 --- a/test/function/samples/associate-function-return-values-2/_config.js +++ b/test/function/samples/associate-function-return-values-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function return values with regard to calls', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values-3/_config.js b/test/function/samples/associate-function-return-values-3/_config.js index 41967870d7c..5e415df184a 100644 --- a/test/function/samples/associate-function-return-values-3/_config.js +++ b/test/function/samples/associate-function-return-values-3/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function return values of returned functions', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values-4/_config.js b/test/function/samples/associate-function-return-values-4/_config.js index 358dccd5ea9..00eb1b235e0 100644 --- a/test/function/samples/associate-function-return-values-4/_config.js +++ b/test/function/samples/associate-function-return-values-4/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Handles empty return statements (#1702)', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values-5/_config.js b/test/function/samples/associate-function-return-values-5/_config.js index bfa427607d9..6884e5d5bd8 100644 --- a/test/function/samples/associate-function-return-values-5/_config.js +++ b/test/function/samples/associate-function-return-values-5/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates value mutations across return values', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values-across-other-expressions/_config.js b/test/function/samples/associate-function-return-values-across-other-expressions/_config.js index 001f94ce2dd..9de1dd167b9 100644 --- a/test/function/samples/associate-function-return-values-across-other-expressions/_config.js +++ b/test/function/samples/associate-function-return-values-across-other-expressions/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function return values with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-function-return-values/_config.js b/test/function/samples/associate-function-return-values/_config.js index 001f94ce2dd..9de1dd167b9 100644 --- a/test/function/samples/associate-function-return-values/_config.js +++ b/test/function/samples/associate-function-return-values/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates function return values with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-getter-return-values-2/_config.js b/test/function/samples/associate-getter-return-values-2/_config.js index 62569e5c57e..5019d71d961 100644 --- a/test/function/samples/associate-getter-return-values-2/_config.js +++ b/test/function/samples/associate-getter-return-values-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates getter return values with regard to calls', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-getter-return-values/_config.js b/test/function/samples/associate-getter-return-values/_config.js index 88bc3624f36..8d9ba8ae18a 100644 --- a/test/function/samples/associate-getter-return-values/_config.js +++ b/test/function/samples/associate-getter-return-values/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates getter return values with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-method-parameter-mutations-2/_config.js b/test/function/samples/associate-method-parameter-mutations-2/_config.js index 51cbe064113..ce60a4a200d 100644 --- a/test/function/samples/associate-method-parameter-mutations-2/_config.js +++ b/test/function/samples/associate-method-parameter-mutations-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates method parameters with their call arguments with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-method-parameter-mutations/_config.js b/test/function/samples/associate-method-parameter-mutations/_config.js index 4730ed755fa..9604ccf9bad 100644 --- a/test/function/samples/associate-method-parameter-mutations/_config.js +++ b/test/function/samples/associate-method-parameter-mutations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates method parameters with their call arguments with regard to mutations', exports(exports) { assert.equal(exports.baz, 'present'); } -}; +}); diff --git a/test/function/samples/associate-object-expression-parameter-mutations/_config.js b/test/function/samples/associate-object-expression-parameter-mutations/_config.js index ae5c10e63e4..5ce355cb425 100644 --- a/test/function/samples/associate-object-expression-parameter-mutations/_config.js +++ b/test/function/samples/associate-object-expression-parameter-mutations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates object expression member parameters with their call arguments', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-object-expression-return-values/_config.js b/test/function/samples/associate-object-expression-return-values/_config.js index ae5c10e63e4..5ce355cb425 100644 --- a/test/function/samples/associate-object-expression-return-values/_config.js +++ b/test/function/samples/associate-object-expression-return-values/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates object expression member parameters with their call arguments', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-parameter-mutations-across-other-expressions/_config.js b/test/function/samples/associate-parameter-mutations-across-other-expressions/_config.js index 966f2369199..0d06672ea9a 100644 --- a/test/function/samples/associate-parameter-mutations-across-other-expressions/_config.js +++ b/test/function/samples/associate-parameter-mutations-across-other-expressions/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates parameters with their call arguments across other expressions', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/associate-setter-parameters/_config.js b/test/function/samples/associate-setter-parameters/_config.js index 88bc3624f36..8d9ba8ae18a 100644 --- a/test/function/samples/associate-setter-parameters/_config.js +++ b/test/function/samples/associate-setter-parameters/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Associates getter return values with regard to mutations', exports(exports) { assert.equal(exports.bar, 'present'); } -}; +}); diff --git a/test/function/samples/async-function-return/_config.js b/test/function/samples/async-function-return/_config.js index 4b732210711..1f8ff777575 100644 --- a/test/function/samples/async-function-return/_config.js +++ b/test/function/samples/async-function-return/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses the correct return value for async functions' -}; +}); diff --git a/test/function/samples/avoid-exports-dot-asterisk/_config.js b/test/function/samples/avoid-exports-dot-asterisk/_config.js index 76470f6f02d..c33467238dd 100644 --- a/test/function/samples/avoid-exports-dot-asterisk/_config.js +++ b/test/function/samples/avoid-exports-dot-asterisk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'avoid return or set module.exports to dot-asterisk style', options: { external: () => true, @@ -6,4 +6,4 @@ module.exports = { format: 'cjs' } } -}; +}); diff --git a/test/function/samples/avoid-variable-be-empty/_config.js b/test/function/samples/avoid-variable-be-empty/_config.js index 425b44c4aec..c1458c2e12d 100644 --- a/test/function/samples/avoid-variable-be-empty/_config.js +++ b/test/function/samples/avoid-variable-be-empty/_config.js @@ -1,9 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'avoid variable from empty module name be empty', options: { input: '', plugins: [ { + name: 'test-plugin', resolveId() { return ''; }, @@ -16,4 +17,4 @@ module.exports = { format: 'cjs' } } -}; +}); diff --git a/test/function/samples/aync-options/_config.js b/test/function/samples/aync-options/_config.js index 799934267c3..837b483be0f 100644 --- a/test/function/samples/aync-options/_config.js +++ b/test/function/samples/aync-options/_config.js @@ -1,17 +1,19 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles async plugin options', options: { preserveEntrySignatures: false, plugins: [ { + name: 'test-plugin1', options(options) { assert.strictEqual(options.preserveEntrySignatures, false); return Promise.resolve({ ...options, preserveEntrySignatures: 'strict' }); } }, { + name: 'test-plugin2', options(options) { assert.strictEqual(options.preserveEntrySignatures, 'strict'); return Promise.resolve(null); @@ -22,4 +24,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports.foo, 1); } -}; +}); diff --git a/test/function/samples/banner-and-footer/_config.js b/test/function/samples/banner-and-footer/_config.js index 6d2b514849b..69ad8b91fa1 100644 --- a/test/function/samples/banner-and-footer/_config.js +++ b/test/function/samples/banner-and-footer/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds a banner/footer', options: { output: { @@ -7,18 +7,21 @@ module.exports = { }, plugins: [ { + name: 'test-plugin1', banner: '/* first banner */', footer() { return '/* first footer */'; } }, { + name: 'test-plugin2', banner() { return '/* second banner */'; }, footer: '/* second footer */' }, { + name: 'test-plugin3', banner() { return Promise.reject(new Error('Could not generate banner.')); }, @@ -29,7 +32,7 @@ module.exports = { generateError: { code: 'ADDON_ERROR', message: - 'Could not retrieve "banner". Check configuration of plugin "at position 3".\n' + + 'Could not retrieve "banner". Check configuration of plugin "test-plugin3".\n' + '\tError Message: Could not generate banner.' } -}; +}); diff --git a/test/function/samples/bindings/_config.js b/test/function/samples/bindings/_config.js index 963674adbca..33615aaf9d8 100644 --- a/test/function/samples/bindings/_config.js +++ b/test/function/samples/bindings/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'maintains live bindings' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/bindings diff --git a/test/function/samples/braceless-arrow-function-returning-function/_config.js b/test/function/samples/braceless-arrow-function-returning-function/_config.js index 03ddb4d4951..6b96e32c1b3 100644 --- a/test/function/samples/braceless-arrow-function-returning-function/_config.js +++ b/test/function/samples/braceless-arrow-function-returning-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'arrow function without braces returning a function (#1032)' -}; +}); diff --git a/test/function/samples/break-label/_config.js b/test/function/samples/break-label/_config.js index 960a4831f6d..d6d5bb4a607 100644 --- a/test/function/samples/break-label/_config.js +++ b/test/function/samples/break-label/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'do not deconflict break label (#2773)', exports(exports) { assert.deepStrictEqual(exports, { value: 'original', n: 1 }); } -}; +}); diff --git a/test/function/samples/build-promise-chain/_config.js b/test/function/samples/build-promise-chain/_config.js index 080c0fd694e..1bd9091454f 100644 --- a/test/function/samples/build-promise-chain/_config.js +++ b/test/function/samples/build-promise-chain/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not fail when iteratively chaining promises' -}; +}); diff --git a/test/function/samples/builtin-prototypes/argument-side-effects/_config.js b/test/function/samples/builtin-prototypes/argument-side-effects/_config.js index 5e77f83b5cc..7c090771b85 100644 --- a/test/function/samples/builtin-prototypes/argument-side-effects/_config.js +++ b/test/function/samples/builtin-prototypes/argument-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in chained string method arguments' -}; +}); diff --git a/test/function/samples/builtin-prototypes/truthiness/_config.js b/test/function/samples/builtin-prototypes/truthiness/_config.js index 9c57e067add..486d00cfbbc 100644 --- a/test/function/samples/builtin-prototypes/truthiness/_config.js +++ b/test/function/samples/builtin-prototypes/truthiness/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'regards builtin methods as truthy in objects' -}; +}); diff --git a/test/function/samples/bundle-facade-order/_config.js b/test/function/samples/bundle-facade-order/_config.js index d305f92fd25..9dd3332ec3c 100644 --- a/test/function/samples/bundle-facade-order/_config.js +++ b/test/function/samples/bundle-facade-order/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'respects the order of entry points when there are additional facades for chunks', options: { input: { @@ -9,6 +9,7 @@ module.exports = { other: 'other' }, plugins: { + name: 'test-plugin', generateBundle(options, bundle) { assert.deepStrictEqual( Object.keys(bundle).map(id => [id, bundle[id].code]), @@ -24,4 +25,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/call-external-function/_config.js b/test/function/samples/call-external-function/_config.js index 5e2f554e13d..173be565ecc 100644 --- a/test/function/samples/call-external-function/_config.js +++ b/test/function/samples/call-external-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles call of aliased external function (#957)', warnings() {}, context: { @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/call-marked-pure-with-plugin-parse-ast/_config.js b/test/function/samples/call-marked-pure-with-plugin-parse-ast/_config.js index e224995b0b5..9fe44391aee 100644 --- a/test/function/samples/call-marked-pure-with-plugin-parse-ast/_config.js +++ b/test/function/samples/call-marked-pure-with-plugin-parse-ast/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'external function calls marked with pure comment do not have effects and should be removed even if parsed by PluginContext.parse method', options: { @@ -30,4 +30,4 @@ module.exports = { code(code) { assert.ok(code.search(/socks\(\)/) === -1); } -}; +}); diff --git a/test/function/samples/call-marked-pure/_config.js b/test/function/samples/call-marked-pure/_config.js index 7eabd676ea5..577284c52d3 100644 --- a/test/function/samples/call-marked-pure/_config.js +++ b/test/function/samples/call-marked-pure/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'external function calls marked with pure comment do not have effects', options: { external: ['socks'] @@ -17,4 +17,4 @@ module.exports = { code(code) { assert.ok(code.search(/socks\(\)/) === -1); } -}; +}); diff --git a/test/function/samples/call-non-function-default-exports/_config.js b/test/function/samples/call-non-function-default-exports/_config.js index e03afa4b73a..0213570792c 100644 --- a/test/function/samples/call-non-function-default-exports/_config.js +++ b/test/function/samples/call-non-function-default-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'calls non-function default exports' -}; +}); diff --git a/test/function/samples/can-import-self-treeshake/_config.js b/test/function/samples/can-import-self-treeshake/_config.js index 167e675e9f6..6ab879fbb27 100644 --- a/test/function/samples/can-import-self-treeshake/_config.js +++ b/test/function/samples/can-import-self-treeshake/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_LIB = path.join(__dirname, 'lib.js'); -module.exports = { +module.exports = defineTest({ description: 'direct self import', warnings: [ { @@ -15,4 +15,4 @@ module.exports = { names: ['main'] } ] -}; +}); diff --git a/test/function/samples/can-import-self/_config.js b/test/function/samples/can-import-self/_config.js index 359e5767e4c..1cdda707710 100644 --- a/test/function/samples/can-import-self/_config.js +++ b/test/function/samples/can-import-self/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const ID_LIB = path.join(__dirname, 'lib.js'); -module.exports = { +module.exports = defineTest({ description: 'a module importing its own bindings', exports(exports) { assert.equal(exports.result, 4); @@ -14,4 +14,4 @@ module.exports = { message: 'Circular dependency: lib.js -> lib.js' } ] -}; +}); diff --git a/test/function/samples/cannot-call-external-namespace/_config.js b/test/function/samples/cannot-call-external-namespace/_config.js index 29db9a5baf3..72faabd454f 100644 --- a/test/function/samples/cannot-call-external-namespace/_config.js +++ b/test/function/samples/cannot-call-external-namespace/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'warns if code calls an external namespace', options: { external: ['fs'] @@ -11,4 +11,4 @@ module.exports = { 'main.js (8:1) Cannot call a namespace ("foo").' ]); } -}; +}); diff --git a/test/function/samples/cannot-call-internal-namespace/_config.js b/test/function/samples/cannot-call-internal-namespace/_config.js index 99945d564ea..15b28a84778 100644 --- a/test/function/samples/cannot-call-internal-namespace/_config.js +++ b/test/function/samples/cannot-call-internal-namespace/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'warns if code calls an internal namespace', warnings(warnings) { assert.deepStrictEqual(warnings.map(String), [ @@ -8,4 +8,4 @@ module.exports = { 'main.js (8:1) Cannot call a namespace ("foo").' ]); } -}; +}); diff --git a/test/function/samples/cannot-resolve-sourcemap-warning/_config.js b/test/function/samples/cannot-resolve-sourcemap-warning/_config.js index 5339c89df06..89dfd06cdf3 100644 --- a/test/function/samples/cannot-resolve-sourcemap-warning/_config.js +++ b/test/function/samples/cannot-resolve-sourcemap-warning/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'handles when a sourcemap cannot be resolved in a warning', options: { plugins: { @@ -45,4 +45,4 @@ module.exports = { url: 'https://rollupjs.org/troubleshooting/#error-this-is-undefined' } ] -}; +}); diff --git a/test/function/samples/catch-block-scope/_config.js b/test/function/samples/catch-block-scope/_config.js index 115e22e0260..aa81898ae7a 100644 --- a/test/function/samples/catch-block-scope/_config.js +++ b/test/function/samples/catch-block-scope/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct scope in catch blocks' -}; +}); diff --git a/test/function/samples/catch-dynamic-import-failure/_config.js b/test/function/samples/catch-dynamic-import-failure/_config.js index cf95730c8e7..bb2bfb4c966 100644 --- a/test/function/samples/catch-dynamic-import-failure/_config.js +++ b/test/function/samples/catch-dynamic-import-failure/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows catching failed dynamic imports', options: { input: ['main', 'exists-default'], @@ -14,4 +14,4 @@ module.exports = { assert.strictEqual(result[2].message.slice(0, expectedError.length), expectedError); }); } -}; +}); diff --git a/test/function/samples/catch-scope-shadowing/_config.js b/test/function/samples/catch-scope-shadowing/_config.js index 6a7cd9de660..4d19aa4f1f4 100644 --- a/test/function/samples/catch-scope-shadowing/_config.js +++ b/test/function/samples/catch-scope-shadowing/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly associates shadowed variables in catch scopes' -}; +}); diff --git a/test/function/samples/catch-scope-variables/_config.js b/test/function/samples/catch-scope-variables/_config.js index b902e7168d5..a18b60e2583 100644 --- a/test/function/samples/catch-scope-variables/_config.js +++ b/test/function/samples/catch-scope-variables/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles variable declarations in catch scopes' -}; +}); diff --git a/test/function/samples/chained-mutable-array-methods/_config.js b/test/function/samples/chained-mutable-array-methods/_config.js index c0ac15f1194..8d79493c4b8 100644 --- a/test/function/samples/chained-mutable-array-methods/_config.js +++ b/test/function/samples/chained-mutable-array-methods/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'recognizes side-effects when applying mutable array methods to chained array methods (#3555)', exports(exports) { assert.deepStrictEqual(exports.a, ['PASS']); } -}; +}); diff --git a/test/function/samples/check-exports-exportedBindings-as-a-supplementary-test/_config.js b/test/function/samples/check-exports-exportedBindings-as-a-supplementary-test/_config.js index 39fb90ab737..c2b0ddb5af9 100644 --- a/test/function/samples/check-exports-exportedBindings-as-a-supplementary-test/_config.js +++ b/test/function/samples/check-exports-exportedBindings-as-a-supplementary-test/_config.js @@ -20,14 +20,15 @@ const expectedResult = { } }; -module.exports = { +module.exports = defineTest({ description: 'check exports and exportedBindings in moduleParsed as a supplementary test', options: { plugins: { + name: 'test-plugin', moduleParsed(moduleInfo) { const { exports, exportedBindings, id } = moduleInfo; assert.deepStrictEqual({ exports, exportedBindings }, expectedResult[id]); } } } -}; +}); diff --git a/test/function/samples/check-resolve-for-entry/_config.js b/test/function/samples/check-resolve-for-entry/_config.js index b2120f29507..5fa4ed9deb9 100644 --- a/test/function/samples/check-resolve-for-entry/_config.js +++ b/test/function/samples/check-resolve-for-entry/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'checks that entry is resolved', options: { input: 'not/a/path/that/actually/really/exists' @@ -7,4 +7,4 @@ module.exports = { code: 'UNRESOLVED_ENTRY', message: 'Could not resolve entry module "not/a/path/that/actually/really/exists".' } -}; +}); diff --git a/test/function/samples/chunk-external-dependency-execution-order/_config.js b/test/function/samples/chunk-external-dependency-execution-order/_config.js index cc97adaa192..47ba9b5d48c 100644 --- a/test/function/samples/chunk-external-dependency-execution-order/_config.js +++ b/test/function/samples/chunk-external-dependency-execution-order/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const executionOrder = []; -module.exports = { +module.exports = defineTest({ description: 'Uses correct execution order when several modules in a chunk have external dependencies', context: { @@ -17,4 +17,4 @@ module.exports = { exports() { assert.deepStrictEqual(executionOrder, ['external-first', 'external-second', 'dep', 'main']); } -}; +}); diff --git a/test/function/samples/chunking-duplicate-reexport/_config.js b/test/function/samples/chunking-duplicate-reexport/_config.js index 14d2eb4b192..aa412cadade 100644 --- a/test/function/samples/chunking-duplicate-reexport/_config.js +++ b/test/function/samples/chunking-duplicate-reexport/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles duplicate reexports when using dynamic imports', exports(exports) { return exports.then(result => assert.deepStrictEqual(result, [{ answer: 42 }, { answer: 42 }])); } -}; +}); diff --git a/test/function/samples/circular-default-exports/_config.js b/test/function/samples/circular-default-exports/_config.js index 1614850f578..6d418f49b45 100644 --- a/test/function/samples/circular-default-exports/_config.js +++ b/test/function/samples/circular-default-exports/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'handles circular default exports', warnings: [ { @@ -10,4 +10,4 @@ module.exports = { message: 'Circular dependency: main.js -> main.js' } ] -}; +}); diff --git a/test/function/samples/circular-missed-reexports-2/_config.js b/test/function/samples/circular-missed-reexports-2/_config.js index 3bcb4160a8c..7aba287f3aa 100644 --- a/test/function/samples/circular-missed-reexports-2/_config.js +++ b/test/function/samples/circular-missed-reexports-2/_config.js @@ -4,7 +4,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP1 = path.join(__dirname, 'dep1.js'); const ID_DEP2 = path.join(__dirname, 'dep2.js'); -module.exports = { +module.exports = defineTest({ description: 'handles circular reexports', exports(exports) { assert.strictEqual(exports.exists, 42); @@ -16,4 +16,4 @@ module.exports = { '"doesNotExist" cannot be exported from "dep1.js" as it is a reexport that references itself.', watchFiles: [ID_DEP1, ID_DEP2, ID_MAIN] } -}; +}); diff --git a/test/function/samples/circular-missed-reexports/_config.js b/test/function/samples/circular-missed-reexports/_config.js index 727d8069c4a..95be334af7f 100644 --- a/test/function/samples/circular-missed-reexports/_config.js +++ b/test/function/samples/circular-missed-reexports/_config.js @@ -5,7 +5,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP1 = path.join(__dirname, 'dep1.js'); const ID_DEP2 = path.join(__dirname, 'dep2.js'); -module.exports = { +module.exports = defineTest({ description: 'handles circular reexports', exports(exports) { assert.strictEqual(exports.exists, 42); @@ -48,4 +48,4 @@ module.exports = { reexporter: ID_DEP2 } ] -}; +}); diff --git a/test/function/samples/circular-namespace-reexport-manual-chunks/_config.js b/test/function/samples/circular-namespace-reexport-manual-chunks/_config.js index eff91817d4c..9c8b304ce5a 100644 --- a/test/function/samples/circular-namespace-reexport-manual-chunks/_config.js +++ b/test/function/samples/circular-namespace-reexport-manual-chunks/_config.js @@ -5,7 +5,7 @@ const ID_TYPES = path.join(__dirname, 'types.js'); const ID_FORMATTERS = path.join(__dirname, 'formatters.js'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'correctly handles namespace reexports with circular dependencies when using manual chunks', options: { @@ -64,4 +64,4 @@ module.exports = { names: ['index.js'] } ] -}; +}); diff --git a/test/function/samples/circular-namespace-reexport-preserve-modules/_config.js b/test/function/samples/circular-namespace-reexport-preserve-modules/_config.js index a66f558f911..f6f9ce12192 100644 --- a/test/function/samples/circular-namespace-reexport-preserve-modules/_config.js +++ b/test/function/samples/circular-namespace-reexport-preserve-modules/_config.js @@ -5,7 +5,7 @@ const ID_TYPES = path.join(__dirname, 'types.js'); const ID_FORMATTERS = path.join(__dirname, 'formatters.js'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'correctly handles namespace reexports with circular dependencies when preserving modules', options: { @@ -57,4 +57,4 @@ module.exports = { reexporter: ID_INDEX } ] -}; +}); diff --git a/test/function/samples/circular-preserve-modules/_config.js b/test/function/samples/circular-preserve-modules/_config.js index ee8b3ded422..08e6b353be8 100644 --- a/test/function/samples/circular-preserve-modules/_config.js +++ b/test/function/samples/circular-preserve-modules/_config.js @@ -3,7 +3,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FIRST = path.join(__dirname, 'first.js'); const ID_SECOND = path.join(__dirname, 'second.js'); -module.exports = { +module.exports = defineTest({ description: 'correctly handles circular dependencies when preserving modules', options: { output: { preserveModules: true } @@ -36,4 +36,4 @@ module.exports = { reexporter: ID_MAIN } ] -}; +}); diff --git a/test/function/samples/circular-reexport/_config.js b/test/function/samples/circular-reexport/_config.js index 79e6f092a7f..bf4f6900872 100644 --- a/test/function/samples/circular-reexport/_config.js +++ b/test/function/samples/circular-reexport/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws proper error for circular reexports', error: { code: 'CIRCULAR_REEXPORT', @@ -9,4 +9,4 @@ module.exports = { message: '"foo" cannot be exported from "main.js" as it is a reexport that references itself.', watchFiles: [ID_MAIN] } -}; +}); diff --git a/test/function/samples/class-method-getter-properties/_config.js b/test/function/samples/class-method-getter-properties/_config.js index 6a6f5724505..d8e5749680a 100644 --- a/test/function/samples/class-method-getter-properties/_config.js +++ b/test/function/samples/class-method-getter-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'respects getters added to class methods' -}; +}); diff --git a/test/function/samples/class-method-mutation/_config.js b/test/function/samples/class-method-mutation/_config.js index fcf070b8b11..d8d9a82bf11 100644 --- a/test/function/samples/class-method-mutation/_config.js +++ b/test/function/samples/class-method-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of class methods' -}; +}); diff --git a/test/function/samples/class-method-mutations/_config.js b/test/function/samples/class-method-mutations/_config.js index 40da5095641..26bdbf66dae 100644 --- a/test/function/samples/class-method-mutations/_config.js +++ b/test/function/samples/class-method-mutations/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'includes variable mutations in class methods if tree-shaking is disabled', options: { treeshake: false @@ -8,4 +8,4 @@ module.exports = { async exports({ promise }) { assert.strictEqual(await promise, 'ok'); } -}; +}); diff --git a/test/function/samples/class-method-returns/_config.js b/test/function/samples/class-method-returns/_config.js index b2fc183b770..8ed280724b7 100644 --- a/test/function/samples/class-method-returns/_config.js +++ b/test/function/samples/class-method-returns/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes return values of class methods' -}; +}); diff --git a/test/function/samples/class-methods-not-renamed/_config.js b/test/function/samples/class-methods-not-renamed/_config.js index a5afb24b4d8..1ea78082822 100644 --- a/test/function/samples/class-methods-not-renamed/_config.js +++ b/test/function/samples/class-methods-not-renamed/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not rename class methods incorrectly', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/class-name-conflict-2/_config.js b/test/function/samples/class-name-conflict-2/_config.js index 922cad01591..95925814430 100644 --- a/test/function/samples/class-name-conflict-2/_config.js +++ b/test/function/samples/class-name-conflict-2/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not shadow variables when preserving class names' -}; +}); diff --git a/test/function/samples/class-name-conflict-3/_config.js b/test/function/samples/class-name-conflict-3/_config.js index 922cad01591..95925814430 100644 --- a/test/function/samples/class-name-conflict-3/_config.js +++ b/test/function/samples/class-name-conflict-3/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not shadow variables when preserving class names' -}; +}); diff --git a/test/function/samples/class-name-conflict-4/_config.js b/test/function/samples/class-name-conflict-4/_config.js index 922cad01591..95925814430 100644 --- a/test/function/samples/class-name-conflict-4/_config.js +++ b/test/function/samples/class-name-conflict-4/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not shadow variables when preserving class names' -}; +}); diff --git a/test/function/samples/class-name-conflict/_config.js b/test/function/samples/class-name-conflict/_config.js index 336557d03a1..035c45e3734 100644 --- a/test/function/samples/class-name-conflict/_config.js +++ b/test/function/samples/class-name-conflict/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves class names even if the class is renamed' -}; +}); diff --git a/test/function/samples/class-prop-returns/_config.js b/test/function/samples/class-prop-returns/_config.js index 0e621669013..20b3952ccc2 100644 --- a/test/function/samples/class-prop-returns/_config.js +++ b/test/function/samples/class-prop-returns/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not remove calls to props without value', exports({ callProp, callStaticProp }) { let hasError = false; @@ -18,4 +18,4 @@ module.exports = { } assert.ok(hasError); } -}; +}); diff --git a/test/function/samples/code-splitting-export-default-from-entry/_config.js b/test/function/samples/code-splitting-export-default-from-entry/_config.js index aa1c0533854..ec6ed9cb990 100644 --- a/test/function/samples/code-splitting-export-default-from-entry/_config.js +++ b/test/function/samples/code-splitting-export-default-from-entry/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly imports the default from an entry point', options: { input: ['main', 'dep'] @@ -10,4 +10,4 @@ module.exports = { value: 42 }); } -}; +}); diff --git a/test/function/samples/compact-multiple-imports/_config.js b/test/function/samples/compact-multiple-imports/_config.js index b651e98d09d..ac16f392074 100644 --- a/test/function/samples/compact-multiple-imports/_config.js +++ b/test/function/samples/compact-multiple-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles empty external imports in compact mode', context: { require(id) { @@ -13,4 +13,4 @@ module.exports = { compact: true } } -}; +}); diff --git a/test/function/samples/compact/_config.js b/test/function/samples/compact/_config.js index acacdf30b40..3575f7e9fe5 100644 --- a/test/function/samples/compact/_config.js +++ b/test/function/samples/compact/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'compact output with compact: true', options: { external: ['external'], @@ -22,4 +22,4 @@ module.exports = { return 42; } } -}; +}); diff --git a/test/function/samples/conditional-catch/_config.js b/test/function/samples/conditional-catch/_config.js index 7fe0c318b80..bc61ae8dd89 100644 --- a/test/function/samples/conditional-catch/_config.js +++ b/test/function/samples/conditional-catch/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles conditional catch blocks (#3869)' -}; +}); diff --git a/test/function/samples/conditional-definition/_config.js b/test/function/samples/conditional-definition/_config.js index a6b22f45c2e..66735855054 100644 --- a/test/function/samples/conditional-definition/_config.js +++ b/test/function/samples/conditional-definition/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'avoids infinite loop when testing conditional definitions' -}; +}); diff --git a/test/function/samples/conditionals-deoptimization/_config.js b/test/function/samples/conditionals-deoptimization/_config.js index 2f081f1dc6c..29fd6dc5609 100644 --- a/test/function/samples/conditionals-deoptimization/_config.js +++ b/test/function/samples/conditionals-deoptimization/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of conditionals', exports(exports) { assert.deepStrictEqual(exports, { @@ -14,4 +14,4 @@ module.exports = { log2b: true }); } -}; +}); diff --git a/test/function/samples/configure-external-module-b/_config.js b/test/function/samples/configure-external-module-b/_config.js index ebff63749b9..74bb65a6bec 100644 --- a/test/function/samples/configure-external-module-b/_config.js +++ b/test/function/samples/configure-external-module-b/_config.js @@ -1,11 +1,12 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows external module to be configured (b)', options: { external: ['path'] }, exports() { + // @ts-expect-error missing types assert.equal(require('node:path').resolve.configured, 'yes'); } -}; +}); diff --git a/test/function/samples/configure-external-module/_config.js b/test/function/samples/configure-external-module/_config.js index c9faeeea5f6..88a7d2b0c22 100644 --- a/test/function/samples/configure-external-module/_config.js +++ b/test/function/samples/configure-external-module/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows external module to be configured', options: { external: ['path'] @@ -8,4 +8,4 @@ module.exports = { exports() { assert.equal(require('node:path').resolve.configured, 'yes'); } -}; +}); diff --git a/test/function/samples/configure-relative-external-module/_config.js b/test/function/samples/configure-relative-external-module/_config.js index 531c906f647..2337110d002 100644 --- a/test/function/samples/configure-relative-external-module/_config.js +++ b/test/function/samples/configure-relative-external-module/_config.js @@ -5,7 +5,7 @@ const mockedValue = { val: 'A value' }; -module.exports = { +module.exports = defineTest({ description: 'allows a nonexistent relative module to be configured as external', options: { external: [path.join(__dirname, './nonexistent-relative-dependency.js')] @@ -18,4 +18,4 @@ module.exports = { exports() { assert.equal(mockedValue.wasAltered, true); } -}; +}); diff --git a/test/function/samples/conflicting-reexports/named-import-external/_config.js b/test/function/samples/conflicting-reexports/named-import-external/_config.js index a7c86096b51..cf0cfc19e42 100644 --- a/test/function/samples/conflicting-reexports/named-import-external/_config.js +++ b/test/function/samples/conflicting-reexports/named-import-external/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_REEXPORT = path.join(__dirname, 'reexport.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when a conflicting binding is imported via a named import from external namespaces', warnings: [ @@ -27,4 +27,4 @@ module.exports = { return { foo: id }; } } -}; +}); diff --git a/test/function/samples/conflicting-reexports/named-import/_config.js b/test/function/samples/conflicting-reexports/named-import/_config.js index 60e3a80d871..976a35db78f 100644 --- a/test/function/samples/conflicting-reexports/named-import/_config.js +++ b/test/function/samples/conflicting-reexports/named-import/_config.js @@ -5,7 +5,7 @@ const ID_REEXPORT = path.join(__dirname, 'reexport.js'); const ID_FIRST = path.join(__dirname, 'first.js'); const ID_SECOND = path.join(__dirname, 'second.js'); -module.exports = { +module.exports = defineTest({ description: 'throws when a conflicting binding is imported via a named import', error: { binding: 'foo', @@ -27,4 +27,4 @@ module.exports = { watchFiles: [ID_FIRST, ID_MAIN, ID_REEXPORT, ID_SECOND], message: '"foo" is not exported by "reexport.js", imported by "main.js".' } -}; +}); diff --git a/test/function/samples/conflicting-reexports/namespace-import/_config.js b/test/function/samples/conflicting-reexports/namespace-import/_config.js index ce3a21c3d89..8823d067a77 100644 --- a/test/function/samples/conflicting-reexports/namespace-import/_config.js +++ b/test/function/samples/conflicting-reexports/namespace-import/_config.js @@ -4,7 +4,7 @@ const ID_FIRST = path.join(__dirname, 'first.js'); const ID_SECOND = path.join(__dirname, 'second.js'); const ID_REEXPORT = path.join(__dirname, 'reexport.js'); -module.exports = { +module.exports = defineTest({ description: 'warns when a conflicting binding is imported via a namespace import', warnings: [ { @@ -35,4 +35,4 @@ module.exports = { ^` } ] -}; +}); diff --git a/test/function/samples/conflicting-reexports/same-binding/_config.js b/test/function/samples/conflicting-reexports/same-binding/_config.js index 3f46afb5feb..f11f6f192ad 100644 --- a/test/function/samples/conflicting-reexports/same-binding/_config.js +++ b/test/function/samples/conflicting-reexports/same-binding/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not fail when the same binding is reexported from different files' -}; +}); diff --git a/test/function/samples/confused-default-identifier/_config.js b/test/function/samples/confused-default-identifier/_config.js index adb7973ab8f..2da3393b6c4 100644 --- a/test/function/samples/confused-default-identifier/_config.js +++ b/test/function/samples/confused-default-identifier/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'Rollup should not get confused and allow "default" as an identifier name', warnings() {} // suppress -}; +}); // https://github.com/rollup/rollup/issues/215 diff --git a/test/function/samples/consistent-renaming-b/_config.js b/test/function/samples/consistent-renaming-b/_config.js index f1b3ee69460..5dbd2de1ae7 100644 --- a/test/function/samples/consistent-renaming-b/_config.js +++ b/test/function/samples/consistent-renaming-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test b' -}; +}); diff --git a/test/function/samples/consistent-renaming-c/_config.js b/test/function/samples/consistent-renaming-c/_config.js index 4b30d565081..8d572fa3132 100644 --- a/test/function/samples/consistent-renaming-c/_config.js +++ b/test/function/samples/consistent-renaming-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test c' -}; +}); diff --git a/test/function/samples/consistent-renaming-d/_config.js b/test/function/samples/consistent-renaming-d/_config.js index 6859f78784e..af41fcd4273 100644 --- a/test/function/samples/consistent-renaming-d/_config.js +++ b/test/function/samples/consistent-renaming-d/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test d' -}; +}); diff --git a/test/function/samples/consistent-renaming-e/_config.js b/test/function/samples/consistent-renaming-e/_config.js index 52455ada4c0..e939f587557 100644 --- a/test/function/samples/consistent-renaming-e/_config.js +++ b/test/function/samples/consistent-renaming-e/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test e' -}; +}); diff --git a/test/function/samples/consistent-renaming-f/_config.js b/test/function/samples/consistent-renaming-f/_config.js index 873e29605c1..e440022425e 100644 --- a/test/function/samples/consistent-renaming-f/_config.js +++ b/test/function/samples/consistent-renaming-f/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test f' -}; +}); diff --git a/test/function/samples/consistent-renaming/_config.js b/test/function/samples/consistent-renaming/_config.js index e6760b1fe5a..5a13ac8bd51 100644 --- a/test/function/samples/consistent-renaming/_config.js +++ b/test/function/samples/consistent-renaming/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistent renaming test' -}; +}); diff --git a/test/function/samples/consistently-renames-destructured-parameters/_config.js b/test/function/samples/consistently-renames-destructured-parameters/_config.js index 6eb58a04984..04b2a7b203b 100644 --- a/test/function/samples/consistently-renames-destructured-parameters/_config.js +++ b/test/function/samples/consistently-renames-destructured-parameters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'destructured parameters are properly renamed (#2418)' -}; +}); diff --git a/test/function/samples/context-resolve-skipself/_config.js b/test/function/samples/context-resolve-skipself/_config.js index 2e95077d921..75662842fcf 100644 --- a/test/function/samples/context-resolve-skipself/_config.js +++ b/test/function/samples/context-resolve-skipself/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'allows a plugin to skip its own resolveId hook when using this.resolve', options: { plugins: [ @@ -39,4 +39,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/context-resolve/_config.js b/test/function/samples/context-resolve/_config.js index c3afd5ff60c..680305939c9 100644 --- a/test/function/samples/context-resolve/_config.js +++ b/test/function/samples/context-resolve/_config.js @@ -120,7 +120,7 @@ const tests = [ } ]; -module.exports = { +module.exports = defineTest({ description: 'returns the correct results for the context resolve helper', options: { external: [ @@ -170,4 +170,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/correct-var-before-declaration-deopt/_config.js b/test/function/samples/correct-var-before-declaration-deopt/_config.js index c5e5b826788..3e202ed1193 100644 --- a/test/function/samples/correct-var-before-declaration-deopt/_config.js +++ b/test/function/samples/correct-var-before-declaration-deopt/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds necessary deoptimizations when using var' -}; +}); diff --git a/test/function/samples/create-undefined-export-property-compact/_config.js b/test/function/samples/create-undefined-export-property-compact/_config.js index bf7d6da2238..fa3cc4a85a8 100644 --- a/test/function/samples/create-undefined-export-property-compact/_config.js +++ b/test/function/samples/create-undefined-export-property-compact/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'creates an export as an exports property even if is has no initializer', options: { output: { compact: true } }, exports(exports) { @@ -14,4 +14,4 @@ module.exports = { assert.strictEqual(exports.foo, 'defined'); assert.strictEqual(exports.bar, 'defined'); } -}; +}); diff --git a/test/function/samples/create-undefined-export-property/_config.js b/test/function/samples/create-undefined-export-property/_config.js index 1e18df1a143..a08ad11a22e 100644 --- a/test/function/samples/create-undefined-export-property/_config.js +++ b/test/function/samples/create-undefined-export-property/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'creates an export as an exports property even if is has no initializer', exports(exports) { assert.strictEqual(exports.foo, undefined); @@ -13,4 +13,4 @@ module.exports = { assert.strictEqual(exports.foo, 'defined'); assert.strictEqual(exports.bar, 'defined'); } -}; +}); diff --git a/test/function/samples/cross-chunk-live-binding-compact/_config.js b/test/function/samples/cross-chunk-live-binding-compact/_config.js index d86b3a4f75b..b266c4e575f 100644 --- a/test/function/samples/cross-chunk-live-binding-compact/_config.js +++ b/test/function/samples/cross-chunk-live-binding-compact/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles cross-chunk live-bindings in compact mode', options: { input: ['main.js', 'named.js', 'star.js'], @@ -17,4 +17,4 @@ module.exports = { exports.incrementStar(); assert.equal(exports.star, 1, 'star'); } -}; +}); diff --git a/test/function/samples/cross-chunk-live-binding/_config.js b/test/function/samples/cross-chunk-live-binding/_config.js index 4e6c3df5be7..ec3f2bf877c 100644 --- a/test/function/samples/cross-chunk-live-binding/_config.js +++ b/test/function/samples/cross-chunk-live-binding/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles cross-chunk live-bindings', options: { input: ['main.js', 'named.js', 'star.js'] @@ -14,4 +14,4 @@ module.exports = { exports.incrementStar(); assert.equal(exports.star, 1, 'star'); } -}; +}); diff --git a/test/function/samples/custom-external-module-options/_config.js b/test/function/samples/custom-external-module-options/_config.js index ef00e08a25e..0447a5bd051 100644 --- a/test/function/samples/custom-external-module-options/_config.js +++ b/test/function/samples/custom-external-module-options/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports adding custom options to external modules', options: { plugins: [ @@ -22,4 +22,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/custom-external-resolver-async/_config.js b/test/function/samples/custom-external-resolver-async/_config.js index 5f5580d01e4..78dc805d4df 100644 --- a/test/function/samples/custom-external-resolver-async/_config.js +++ b/test/function/samples/custom-external-resolver-async/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'uses a custom external path resolver (asynchronous)', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { exports(exports) { assert.ok(exports.success); } -}; +}); diff --git a/test/function/samples/custom-external-resolver-sync/_config.js b/test/function/samples/custom-external-resolver-sync/_config.js index d58aabcb42c..f90dba7f7f5 100644 --- a/test/function/samples/custom-external-resolver-sync/_config.js +++ b/test/function/samples/custom-external-resolver-sync/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'uses a custom external path resolver (synchronous)', options: { plugins: [ @@ -15,4 +15,4 @@ module.exports = { exports(exports) { assert.ok(exports.success); } -}; +}); diff --git a/test/function/samples/custom-iterator-2/_config.js b/test/function/samples/custom-iterator-2/_config.js index 046c68b3d57..5c221ae64b5 100644 --- a/test/function/samples/custom-iterator-2/_config.js +++ b/test/function/samples/custom-iterator-2/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles manually defined iterators' -}; +}); diff --git a/test/function/samples/custom-iterator/_config.js b/test/function/samples/custom-iterator/_config.js index 046c68b3d57..5c221ae64b5 100644 --- a/test/function/samples/custom-iterator/_config.js +++ b/test/function/samples/custom-iterator/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles manually defined iterators' -}; +}); diff --git a/test/function/samples/custom-loaders/_config.js b/test/function/samples/custom-loaders/_config.js index f77543e1c65..d35f66376ce 100644 --- a/test/function/samples/custom-loaders/_config.js +++ b/test/function/samples/custom-loaders/_config.js @@ -1,6 +1,6 @@ const { readFileSync } = require('node:fs'); -module.exports = { +module.exports = defineTest({ description: 'uses custom loaders, falling back to default', options: { plugins: [ @@ -20,4 +20,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/custom-module-options/_config.js b/test/function/samples/custom-module-options/_config.js index eb5e1647b6c..9c54b601920 100644 --- a/test/function/samples/custom-module-options/_config.js +++ b/test/function/samples/custom-module-options/_config.js @@ -30,7 +30,7 @@ function getTestPlugin(index) { }; } -module.exports = { +module.exports = defineTest({ description: 'supports adding custom options to modules', options: { plugins: [ @@ -73,4 +73,4 @@ module.exports = { value3: { 'test-3': { loaded: 3 }, 'test-1': { transformed: 1 } } }); } -}; +}); diff --git a/test/function/samples/custom-path-resolver-async/_config.js b/test/function/samples/custom-path-resolver-async/_config.js index cb48e2a9ae0..85a34e95e8b 100644 --- a/test/function/samples/custom-path-resolver-async/_config.js +++ b/test/function/samples/custom-path-resolver-async/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'uses a custom path resolver (asynchronous)', options: { plugins: [ @@ -17,4 +17,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports.path, require('node:path')); } -}; +}); diff --git a/test/function/samples/custom-path-resolver-on-entry/_config.js b/test/function/samples/custom-path-resolver-on-entry/_config.js index 275a1b06662..a525fbffc30 100644 --- a/test/function/samples/custom-path-resolver-on-entry/_config.js +++ b/test/function/samples/custom-path-resolver-on-entry/_config.js @@ -6,7 +6,7 @@ const cachedModules = { '@main.js': 'import foo from "./foo"; export default foo();' }; -module.exports = { +module.exports = defineTest({ description: 'applies custom resolver to entry point', options: { plugins: [ @@ -33,4 +33,4 @@ module.exports = { exports(exports) { assert.equal(exports, 42); } -}; +}); diff --git a/test/function/samples/custom-path-resolver-plural-b/_config.js b/test/function/samples/custom-path-resolver-plural-b/_config.js index 8407c4a5632..f3313f15046 100644 --- a/test/function/samples/custom-path-resolver-plural-b/_config.js +++ b/test/function/samples/custom-path-resolver-plural-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'resolver error is not caught', options: { plugins: [ @@ -23,4 +23,4 @@ module.exports = { message: 'nope', plugin: 'at position 1' } -}; +}); diff --git a/test/function/samples/custom-path-resolver-plural/_config.js b/test/function/samples/custom-path-resolver-plural/_config.js index 9973c70df63..44b535d3e31 100644 --- a/test/function/samples/custom-path-resolver-plural/_config.js +++ b/test/function/samples/custom-path-resolver-plural/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'uses custom path resolvers (plural)', options: { plugins: [ @@ -24,4 +24,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports.res, 0); } -}; +}); diff --git a/test/function/samples/custom-path-resolver-sync/_config.js b/test/function/samples/custom-path-resolver-sync/_config.js index dd8d62fe666..4961137da1b 100644 --- a/test/function/samples/custom-path-resolver-sync/_config.js +++ b/test/function/samples/custom-path-resolver-sync/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'uses a custom path resolver (synchronous)', options: { plugins: [ @@ -18,4 +18,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports.path, require('node:path')); } -}; +}); diff --git a/test/function/samples/custom-resolve-options/_config.js b/test/function/samples/custom-resolve-options/_config.js index e3239753065..7828849764e 100644 --- a/test/function/samples/custom-resolve-options/_config.js +++ b/test/function/samples/custom-resolve-options/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'supports custom resolve options', options: { plugins: [ @@ -34,4 +34,4 @@ module.exports = { second: 'the-actual-id' }); } -}; +}); diff --git a/test/function/samples/cycles-default-anonymous-function-hoisted/_config.js b/test/function/samples/cycles-default-anonymous-function-hoisted/_config.js index 6b24720266f..60e599ad677 100644 --- a/test/function/samples/cycles-default-anonymous-function-hoisted/_config.js +++ b/test/function/samples/cycles-default-anonymous-function-hoisted/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_F = path.join(__dirname, 'f.js'); const ID_G = path.join(__dirname, 'g.js'); -module.exports = { +module.exports = defineTest({ description: 'Anonymous function declarations are hoisted', warnings: [ { @@ -11,4 +11,4 @@ module.exports = { message: 'Circular dependency: f.js -> g.js -> f.js' } ] -}; +}); diff --git a/test/function/samples/cycles-defaults/_config.js b/test/function/samples/cycles-defaults/_config.js index 0836a96ff5c..5c472c4ef87 100644 --- a/test/function/samples/cycles-defaults/_config.js +++ b/test/function/samples/cycles-defaults/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_A = path.join(__dirname, 'a.js'); const ID_B = path.join(__dirname, 'b.js'); -module.exports = { +module.exports = defineTest({ description: 'cycles work with default exports', warnings: [ { @@ -11,6 +11,6 @@ module.exports = { message: 'Circular dependency: a.js -> b.js -> a.js' } ] -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/cycles-defaults diff --git a/test/function/samples/cycles-export-star/_config.js b/test/function/samples/cycles-export-star/_config.js index dc04c179ae3..0396bfbca73 100644 --- a/test/function/samples/cycles-export-star/_config.js +++ b/test/function/samples/cycles-export-star/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_A = path.join(__dirname, 'a.js'); const ID_B = path.join(__dirname, 'b.js'); -module.exports = { +module.exports = defineTest({ description: 'does not stack overflow on `export * from X` cycles', code(code) { assert.equal( @@ -18,4 +18,4 @@ module.exports = { message: 'Circular dependency: a.js -> b.js -> a.js' } ] -}; +}); diff --git a/test/function/samples/cycles-immediate/_config.js b/test/function/samples/cycles-immediate/_config.js index b64647acfdd..2464a9d2bfc 100644 --- a/test/function/samples/cycles-immediate/_config.js +++ b/test/function/samples/cycles-immediate/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_EVENS = path.join(__dirname, 'evens.js'); const ID_ODDS = path.join(__dirname, 'odds.js'); -module.exports = { +module.exports = defineTest({ description: 'handles cycles where imports are immediately used', warnings: [ { @@ -11,6 +11,6 @@ module.exports = { message: 'Circular dependency: evens.js -> odds.js -> evens.js' } ] -}; +}); // Test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/cycles-immediate diff --git a/test/function/samples/cycles-pathological-2/_config.js b/test/function/samples/cycles-pathological-2/_config.js index 462bc546681..3856aa83021 100644 --- a/test/function/samples/cycles-pathological-2/_config.js +++ b/test/function/samples/cycles-pathological-2/_config.js @@ -4,7 +4,7 @@ const ID_B = path.join(__dirname, 'b.js'); const ID_C = path.join(__dirname, 'c.js'); const ID_D = path.join(__dirname, 'd.js'); -module.exports = { +module.exports = defineTest({ description: 'resolves even more pathological cyclical dependencies gracefully', warnings: [ { @@ -23,4 +23,4 @@ module.exports = { message: 'Circular dependency: main.js -> b.js -> d.js -> c.js -> main.js' } ] -}; +}); diff --git a/test/function/samples/cycles-stack-overflow/_config.js b/test/function/samples/cycles-stack-overflow/_config.js index 6dc79fbc2a9..24dc31d12ca 100644 --- a/test/function/samples/cycles-stack-overflow/_config.js +++ b/test/function/samples/cycles-stack-overflow/_config.js @@ -3,7 +3,7 @@ const ID_B = path.join(__dirname, 'b.js'); const ID_C = path.join(__dirname, 'c.js'); const ID_D = path.join(__dirname, 'd.js'); -module.exports = { +module.exports = defineTest({ description: 'does not stack overflow on crazy cyclical dependencies', warnings: [ { @@ -17,4 +17,4 @@ module.exports = { message: 'Circular dependency: c.js -> d.js -> c.js' } ] -}; +}); diff --git a/test/function/samples/cyclic-assignments/_config.js b/test/function/samples/cyclic-assignments/_config.js index ca96493478d..26be52cb8e7 100644 --- a/test/function/samples/cyclic-assignments/_config.js +++ b/test/function/samples/cyclic-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not fail for cyclic assignments' -}; +}); diff --git a/test/function/samples/deconflict-deconflicted/_config.js b/test/function/samples/deconflict-deconflicted/_config.js index a3fcda5c37c..2e2ed2b323d 100644 --- a/test/function/samples/deconflict-deconflicted/_config.js +++ b/test/function/samples/deconflict-deconflicted/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'also deconflict variables which already appear to be deconflicted (#2683)' -}; +}); diff --git a/test/function/samples/deconflict-default-exported-named-function/_config.js b/test/function/samples/deconflict-default-exported-named-function/_config.js index 20c051e2287..30ff2e3b248 100644 --- a/test/function/samples/deconflict-default-exported-named-function/_config.js +++ b/test/function/samples/deconflict-default-exported-named-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflict default exported named function and class expressions' -}; +}); diff --git a/test/function/samples/deconflict-ids/_config.js b/test/function/samples/deconflict-ids/_config.js index 0d91c9ee299..7e5ede0433f 100644 --- a/test/function/samples/deconflict-ids/_config.js +++ b/test/function/samples/deconflict-ids/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts reassigned ids' -}; +}); diff --git a/test/function/samples/deconflict-parameter-defaults/_config.js b/test/function/samples/deconflict-parameter-defaults/_config.js index dcba432ae02..b81ed6af1b6 100644 --- a/test/function/samples/deconflict-parameter-defaults/_config.js +++ b/test/function/samples/deconflict-parameter-defaults/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'consistently deconflict variable names for parameter defaults' -}; +}); diff --git a/test/function/samples/deconflict-synthetic-named-export-cross-chunk/_config.js b/test/function/samples/deconflict-synthetic-named-export-cross-chunk/_config.js index d7a4173726f..cd8c4b600a5 100644 --- a/test/function/samples/deconflict-synthetic-named-export-cross-chunk/_config.js +++ b/test/function/samples/deconflict-synthetic-named-export-cross-chunk/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts synthetic named exports across chunks', options: { input: ['main', 'foo'], @@ -16,4 +16,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports(2), 4); } -}; +}); diff --git a/test/function/samples/deconflict-synthetic-named-export/_config.js b/test/function/samples/deconflict-synthetic-named-export/_config.js index fe0b30c3995..d101643e5c0 100644 --- a/test/function/samples/deconflict-synthetic-named-export/_config.js +++ b/test/function/samples/deconflict-synthetic-named-export/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts synthetic named exports', options: { plugins: [ @@ -14,4 +14,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports(2), 4); } -}; +}); diff --git a/test/function/samples/deconflicts-classes/_config.js b/test/function/samples/deconflicts-classes/_config.js index ee66bd1122b..af419d4f56c 100644 --- a/test/function/samples/deconflicts-classes/_config.js +++ b/test/function/samples/deconflicts-classes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts top-level classes' -}; +}); diff --git a/test/function/samples/deconflicts-exports-2/_config.js b/test/function/samples/deconflicts-exports-2/_config.js index 7614e882491..5f401c8582f 100644 --- a/test/function/samples/deconflicts-exports-2/_config.js +++ b/test/function/samples/deconflicts-exports-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'renames nested variables named "exports" if necessary', exports(exports) { assert.equal(exports.x, 2); } -}; +}); diff --git a/test/function/samples/deconflicts-exports-3/_config.js b/test/function/samples/deconflicts-exports-3/_config.js index d28b7c2d4cd..51492dda6d0 100644 --- a/test/function/samples/deconflicts-exports-3/_config.js +++ b/test/function/samples/deconflicts-exports-3/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'renames variables named "module" if necessary', exports(exports) { assert.equal(exports, 1); } -}; +}); diff --git a/test/function/samples/deconflicts-exports/_config.js b/test/function/samples/deconflicts-exports/_config.js index c8c5d6617d0..d625077df69 100644 --- a/test/function/samples/deconflicts-exports/_config.js +++ b/test/function/samples/deconflicts-exports/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'renames variables named "exports" if necessary', exports(exports) { assert.deepEqual(Object.keys(exports), ['a', 'b']); assert.equal(exports.a, 'A'); assert.equal(exports.b, 42); } -}; +}); diff --git a/test/function/samples/deconflicts-external-imports/_config.js b/test/function/samples/deconflicts-external-imports/_config.js index 1e3b5d13baa..458adc6a05c 100644 --- a/test/function/samples/deconflicts-external-imports/_config.js +++ b/test/function/samples/deconflicts-external-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts external imports', context: { require(id) { @@ -10,4 +10,4 @@ module.exports = { options: { external: ['foo', 'bar'] } -}; +}); diff --git a/test/function/samples/deconflicts-generated-default-names/_config.js b/test/function/samples/deconflicts-generated-default-names/_config.js index ebf4a0748f9..ee6eca2098c 100644 --- a/test/function/samples/deconflicts-generated-default-names/_config.js +++ b/test/function/samples/deconflicts-generated-default-names/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts generated default export names' -}; +}); diff --git a/test/function/samples/deconflicts-globals/_config.js b/test/function/samples/deconflicts-globals/_config.js index 360ce512dc9..d6a0ce092f1 100644 --- a/test/function/samples/deconflicts-globals/_config.js +++ b/test/function/samples/deconflicts-globals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts names that are assumed to be global' -}; +}); diff --git a/test/function/samples/deconflicts-interop/_config.js b/test/function/samples/deconflicts-interop/_config.js index e569d383180..bd5f4665e8e 100644 --- a/test/function/samples/deconflicts-interop/_config.js +++ b/test/function/samples/deconflicts-interop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts the interop function', options: { external(id) { @@ -28,4 +28,4 @@ module.exports = { require: () => Object.defineProperty({ foo: 'foo', default: 'bar' }, '__esModule', { value: true }) } -}; +}); diff --git a/test/function/samples/deconstructed-exported-vars/_config.js b/test/function/samples/deconstructed-exported-vars/_config.js index 85daf65e32a..4570f1fb17e 100644 --- a/test/function/samples/deconstructed-exported-vars/_config.js +++ b/test/function/samples/deconstructed-exported-vars/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows destructuring in exported variable declarations, synthetic or otherwise', exports(exports) { assert.equal(exports.a, 1); assert.equal(exports.d, 4); } -}; +}); diff --git a/test/function/samples/default-export-as-is-bound/_config.js b/test/function/samples/default-export-as-is-bound/_config.js index 87d11362eae..9608b0e29ad 100644 --- a/test/function/samples/default-export-as-is-bound/_config.js +++ b/test/function/samples/default-export-as-is-bound/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does bind export as default (#1078)' -}; +}); diff --git a/test/function/samples/default-export-before-declaration/_config.js b/test/function/samples/default-export-before-declaration/_config.js index 3f33d6f7db1..e42ecbbad56 100644 --- a/test/function/samples/default-export-before-declaration/_config.js +++ b/test/function/samples/default-export-before-declaration/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles default exports before a variable is declared', exports(exports) { assert.strictEqual(exports, undefined); } -}; +}); diff --git a/test/function/samples/default-export-is-not-bound-b/_config.js b/test/function/samples/default-export-is-not-bound-b/_config.js index ce8cd11c43f..67004d32d3e 100644 --- a/test/function/samples/default-export-is-not-bound-b/_config.js +++ b/test/function/samples/default-export-is-not-bound-b/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not move default export statement above earlier statements', exports(exports) { assert.equal(exports.bar, 42); } -}; +}); diff --git a/test/function/samples/default-export-is-not-bound/_config.js b/test/function/samples/default-export-is-not-bound/_config.js index ca098561546..b62fbbd867e 100644 --- a/test/function/samples/default-export-is-not-bound/_config.js +++ b/test/function/samples/default-export-is-not-bound/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'does not bind default exports' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-default diff --git a/test/function/samples/default-export-with-null-prototype/_config.js b/test/function/samples/default-export-with-null-prototype/_config.js index 8912ca75d4c..2121ec23792 100644 --- a/test/function/samples/default-export-with-null-prototype/_config.js +++ b/test/function/samples/default-export-with-null-prototype/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'default exports of objects with null prototypes are supported', options: { external: ['foo'], @@ -15,4 +15,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/default-exported-global/_config.js b/test/function/samples/default-exported-global/_config.js index 2d759c9b578..4c5557f41a0 100644 --- a/test/function/samples/default-exported-global/_config.js +++ b/test/function/samples/default-exported-global/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Tracks updates of default exported globals', exports(exports) { assert.deepStrictEqual(exports, { original: 1, updated: 2 }); } -}; +}); diff --git a/test/function/samples/default-exports-in-parens-class-with-id/_config.js b/test/function/samples/default-exports-in-parens-class-with-id/_config.js index 464d56a7ca3..a7e97bb5338 100644 --- a/test/function/samples/default-exports-in-parens-class-with-id/_config.js +++ b/test/function/samples/default-exports-in-parens-class-with-id/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default class with id exports wrapped in parens' -}; +}); diff --git a/test/function/samples/default-exports-in-parens-class-without-id/_config.js b/test/function/samples/default-exports-in-parens-class-without-id/_config.js index bbde1c72917..a632ab6a4f7 100644 --- a/test/function/samples/default-exports-in-parens-class-without-id/_config.js +++ b/test/function/samples/default-exports-in-parens-class-without-id/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default class without id exports wrapped in parens' -}; +}); diff --git a/test/function/samples/default-exports-in-parens-function-with-id/_config.js b/test/function/samples/default-exports-in-parens-function-with-id/_config.js index bc7b8f3b5ea..b76523bd897 100644 --- a/test/function/samples/default-exports-in-parens-function-with-id/_config.js +++ b/test/function/samples/default-exports-in-parens-function-with-id/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default function with id exports wrapped in parens' -}; +}); diff --git a/test/function/samples/default-exports-in-parens-function-without-id/_config.js b/test/function/samples/default-exports-in-parens-function-without-id/_config.js index 1d26a7d399f..9c0d16b8881 100644 --- a/test/function/samples/default-exports-in-parens-function-without-id/_config.js +++ b/test/function/samples/default-exports-in-parens-function-without-id/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles default function without id exports wrapped in parens' -}; +}); diff --git a/test/function/samples/default-function-export-conflict/_config.js b/test/function/samples/default-function-export-conflict/_config.js index d062e00bd7e..7934a8be019 100644 --- a/test/function/samples/default-function-export-conflict/_config.js +++ b/test/function/samples/default-function-export-conflict/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'default export of anonymous function' -}; +}); diff --git a/test/function/samples/default-not-reexported/_config.js b/test/function/samples/default-not-reexported/_config.js index 529e747b09e..adbfc65eaa9 100644 --- a/test/function/samples/default-not-reexported/_config.js +++ b/test/function/samples/default-not-reexported/_config.js @@ -3,7 +3,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); const ID_BAR = path.join(__dirname, 'bar.js'); -module.exports = { +module.exports = defineTest({ description: 'default export is not re-exported with export *', error: { binding: 'default', @@ -26,4 +26,4 @@ module.exports = { `, url: `https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module` } -}; +}); diff --git a/test/function/samples/default-on-warn/_config.js b/test/function/samples/default-on-warn/_config.js index ee906462eac..824be0cafe8 100644 --- a/test/function/samples/default-on-warn/_config.js +++ b/test/function/samples/default-on-warn/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); let oldConsoleWarn; const warnings = []; -module.exports = { +module.exports = defineTest({ description: 'provides a default handler for warnings to onwarn that handles strings and objects', options: { onwarn(warning, defaultHandler) { @@ -24,4 +24,4 @@ module.exports = { 'Entry module "main.js" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.' ]); } -}; +}); diff --git a/test/function/samples/delete/_config.js b/test/function/samples/delete/_config.js index 3495183e618..6a64667ef0b 100644 --- a/test/function/samples/delete/_config.js +++ b/test/function/samples/delete/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: '`delete` operator at the top level is preserved' -}; +}); diff --git a/test/function/samples/deoptimize-assumes-getters/_config.js b/test/function/samples/deoptimize-assumes-getters/_config.js index c04d33fbc9b..78bb505bb7e 100644 --- a/test/function/samples/deoptimize-assumes-getters/_config.js +++ b/test/function/samples/deoptimize-assumes-getters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'assume full deoptimization may inject side-effectful getters' -}; +}); diff --git a/test/function/samples/deoptimize-cached-prop/_config.js b/test/function/samples/deoptimize-cached-prop/_config.js index 5bffd221ee2..0044a4af351 100644 --- a/test/function/samples/deoptimize-cached-prop/_config.js +++ b/test/function/samples/deoptimize-cached-prop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes cached properties and return values if necessary (#3264)' -}; +}); diff --git a/test/function/samples/deoptimize-call-expression-reassignments/_config.js b/test/function/samples/deoptimize-call-expression-reassignments/_config.js index 94ee87be2e7..a464b295af1 100644 --- a/test/function/samples/deoptimize-call-expression-reassignments/_config.js +++ b/test/function/samples/deoptimize-call-expression-reassignments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes call expressions of conditional expressions if their return value is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-call-expressions/_config.js b/test/function/samples/deoptimize-call-expressions/_config.js index 493fbc146d6..50faf79d57b 100644 --- a/test/function/samples/deoptimize-call-expressions/_config.js +++ b/test/function/samples/deoptimize-call-expressions/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes call expressions conditional expressions if their return value is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-class/_config.js b/test/function/samples/deoptimize-class/_config.js index 14bcdb722ee..e92d39ee268 100644 --- a/test/function/samples/deoptimize-class/_config.js +++ b/test/function/samples/deoptimize-class/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of static class properties' -}; +}); diff --git a/test/function/samples/deoptimize-computed-class-keys/_config.js b/test/function/samples/deoptimize-computed-class-keys/_config.js index dfe1e1e59b7..328acfdc0db 100644 --- a/test/function/samples/deoptimize-computed-class-keys/_config.js +++ b/test/function/samples/deoptimize-computed-class-keys/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes computed class property keys' -}; +}); diff --git a/test/function/samples/deoptimize-computed-keys/_config.js b/test/function/samples/deoptimize-computed-keys/_config.js index 2ac75a24810..f9dcf153b0d 100644 --- a/test/function/samples/deoptimize-computed-keys/_config.js +++ b/test/function/samples/deoptimize-computed-keys/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes computed object property keys' -}; +}); diff --git a/test/function/samples/deoptimize-conditional-expression-reassignments/_config.js b/test/function/samples/deoptimize-conditional-expression-reassignments/_config.js index 61dd10aee3b..866f6cf2787 100644 --- a/test/function/samples/deoptimize-conditional-expression-reassignments/_config.js +++ b/test/function/samples/deoptimize-conditional-expression-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of deoptimized conditional expressions' -}; +}); diff --git a/test/function/samples/deoptimize-conditional-expressions/_config.js b/test/function/samples/deoptimize-conditional-expressions/_config.js index d7cd37d7ce8..a09e621dc55 100644 --- a/test/function/samples/deoptimize-conditional-expressions/_config.js +++ b/test/function/samples/deoptimize-conditional-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps conditional expressions if their test value is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-logical-expression-reassignments/_config.js b/test/function/samples/deoptimize-logical-expression-reassignments/_config.js index 8626c0b4ffa..83b50025e9a 100644 --- a/test/function/samples/deoptimize-logical-expression-reassignments/_config.js +++ b/test/function/samples/deoptimize-logical-expression-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of deoptimized logical expressions' -}; +}); diff --git a/test/function/samples/deoptimize-logical-expressions/_config.js b/test/function/samples/deoptimize-logical-expressions/_config.js index fbdb65233c4..a73192c1f97 100644 --- a/test/function/samples/deoptimize-logical-expressions/_config.js +++ b/test/function/samples/deoptimize-logical-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps logical expressions if the first part is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-loop-element/_config.js b/test/function/samples/deoptimize-loop-element/_config.js index 0e0cd6ac573..dcfdd76b0b2 100644 --- a/test/function/samples/deoptimize-loop-element/_config.js +++ b/test/function/samples/deoptimize-loop-element/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes the loop element when it is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-member-expressions/_config.js b/test/function/samples/deoptimize-member-expressions/_config.js index ccd60b17f58..c79a8b71f2a 100644 --- a/test/function/samples/deoptimize-member-expressions/_config.js +++ b/test/function/samples/deoptimize-member-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps accesses to computed properties if their key is reassigned' -}; +}); diff --git a/test/function/samples/deoptimize-missing-namespace-members/_config.js b/test/function/samples/deoptimize-missing-namespace-members/_config.js index 908625e3bd2..e68ea27ed9b 100644 --- a/test/function/samples/deoptimize-missing-namespace-members/_config.js +++ b/test/function/samples/deoptimize-missing-namespace-members/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of non-existing namespace members', exports(exports) { assert.strictEqual(exports.bar, undefined); } -}; +}); diff --git a/test/function/samples/deoptimize-object-expressions-2/_config.js b/test/function/samples/deoptimize-object-expressions-2/_config.js index e813da503b0..0059042c404 100644 --- a/test/function/samples/deoptimize-object-expressions-2/_config.js +++ b/test/function/samples/deoptimize-object-expressions-2/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track deoptimizations of computed properties of empty objects' -}; +}); diff --git a/test/function/samples/deoptimize-object-expressions/_config.js b/test/function/samples/deoptimize-object-expressions/_config.js index c848c2ffc44..601c94248fd 100644 --- a/test/function/samples/deoptimize-object-expressions/_config.js +++ b/test/function/samples/deoptimize-object-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track deoptimizations of computed properties' -}; +}); diff --git a/test/function/samples/deoptimize-object/_config.js b/test/function/samples/deoptimize-object/_config.js index 2906b6780d7..8cb5aad18bd 100644 --- a/test/function/samples/deoptimize-object/_config.js +++ b/test/function/samples/deoptimize-object/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of object properties' -}; +}); diff --git a/test/function/samples/deoptimize-request-treeshaking-pass/_config.js b/test/function/samples/deoptimize-request-treeshaking-pass/_config.js index e397def2c06..c2edc9f8248 100644 --- a/test/function/samples/deoptimize-request-treeshaking-pass/_config.js +++ b/test/function/samples/deoptimize-request-treeshaking-pass/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); const result = { value: 0 }; -module.exports = { +module.exports = defineTest({ description: 'makes sure to request additional passes when a variable is deoptimized', context: { result }, exports() { assert.strictEqual(result.value, 2); } -}; +}); diff --git a/test/function/samples/deoptimize-this-parameters/_config.js b/test/function/samples/deoptimize-this-parameters/_config.js index 518f65d290a..942450e90a6 100644 --- a/test/function/samples/deoptimize-this-parameters/_config.js +++ b/test/function/samples/deoptimize-this-parameters/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles deoptimization of this parameters' -}; +}); diff --git a/test/function/samples/deprecated/compact/_config.js b/test/function/samples/deprecated/compact/_config.js index be9be0616c9..852426cfd24 100644 --- a/test/function/samples/deprecated/compact/_config.js +++ b/test/function/samples/deprecated/compact/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'compact output with compact: true', options: { strictDeprecations: false, @@ -29,4 +29,4 @@ module.exports = { return 42; } } -}; +}); diff --git a/test/function/samples/deprecated/dynamic-import-duplicates/_config.js b/test/function/samples/deprecated/dynamic-import-duplicates/_config.js index 10a22cf5ac9..fa2edf25f23 100644 --- a/test/function/samples/deprecated/dynamic-import-duplicates/_config.js +++ b/test/function/samples/deprecated/dynamic-import-duplicates/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining', options: { strictDeprecations: false, @@ -20,4 +20,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } ] -}; +}); diff --git a/test/function/samples/deprecated/dynamic-import-inlining/_config.js b/test/function/samples/deprecated/dynamic-import-inlining/_config.js index 10a22cf5ac9..fa2edf25f23 100644 --- a/test/function/samples/deprecated/dynamic-import-inlining/_config.js +++ b/test/function/samples/deprecated/dynamic-import-inlining/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining', options: { strictDeprecations: false, @@ -20,4 +20,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } ] -}; +}); diff --git a/test/function/samples/deprecated/dynamic-import-name-warn/_config.js b/test/function/samples/deprecated/dynamic-import-name-warn/_config.js index b4d19815736..60e45b2b356 100644 --- a/test/function/samples/deprecated/dynamic-import-name-warn/_config.js +++ b/test/function/samples/deprecated/dynamic-import-name-warn/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'warns when specifying a custom importer function for formats other than "es"', context: { require(path) { @@ -41,4 +41,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-dynamicimportfunction' } ] -}; +}); diff --git a/test/function/samples/deprecated/dynamic-import-name/_config.js b/test/function/samples/deprecated/dynamic-import-name/_config.js index 8f6372d0cc5..6a93ad2082a 100644 --- a/test/function/samples/deprecated/dynamic-import-name/_config.js +++ b/test/function/samples/deprecated/dynamic-import-name/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let imported = false; -module.exports = { +module.exports = defineTest({ description: 'allows specifying a custom importer function', context: { myImporter(path) { @@ -33,4 +33,4 @@ module.exports = { url: 'https://rollupjs.org/plugin-development/#renderdynamicimport' } ] -}; +}); diff --git a/test/function/samples/deprecated/inline-dynamic-imports-bundle/_config.js b/test/function/samples/deprecated/inline-dynamic-imports-bundle/_config.js index 0730ccf96d5..3a1c929fcda 100644 --- a/test/function/samples/deprecated/inline-dynamic-imports-bundle/_config.js +++ b/test/function/samples/deprecated/inline-dynamic-imports-bundle/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'ignores non-bundled modules when inlining dynamic imports', options: { strictDeprecations: false, @@ -23,4 +23,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } ] -}; +}); diff --git a/test/function/samples/deprecated/inline-imports-with-manual/_config.js b/test/function/samples/deprecated/inline-imports-with-manual/_config.js index 4dc1d33f0d7..b72dc7f5b46 100644 --- a/test/function/samples/deprecated/inline-imports-with-manual/_config.js +++ b/test/function/samples/deprecated/inline-imports-with-manual/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Manual chunks are not supported when inlining dynamic imports', options: { strictDeprecations: false, @@ -15,4 +15,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-manualchunks' }, warnings: [] -}; +}); diff --git a/test/function/samples/deprecated/inline-imports-with-multiple-array/_config.js b/test/function/samples/deprecated/inline-imports-with-multiple-array/_config.js index e2d77fbaa13..30eeb3b6ee6 100644 --- a/test/function/samples/deprecated/inline-imports-with-multiple-array/_config.js +++ b/test/function/samples/deprecated/inline-imports-with-multiple-array/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Having multiple inputs in an array is not supported when inlining dynamic imports', options: { strictDeprecations: false, @@ -12,4 +12,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' }, warnings: [] -}; +}); diff --git a/test/function/samples/deprecated/inline-imports-with-multiple-object/_config.js b/test/function/samples/deprecated/inline-imports-with-multiple-object/_config.js index 43dc300bda4..65df9df7e90 100644 --- a/test/function/samples/deprecated/inline-imports-with-multiple-object/_config.js +++ b/test/function/samples/deprecated/inline-imports-with-multiple-object/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Having multiple inputs in an object is not supported when inlining dynamic imports', options: { strictDeprecations: false, @@ -18,4 +18,4 @@ module.exports = { 'The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.' } ] -}; +}); diff --git a/test/function/samples/deprecated/manual-chunks-conflict/_config.js b/test/function/samples/deprecated/manual-chunks-conflict/_config.js index 04e0839bcca..789f7339c7b 100644 --- a/test/function/samples/deprecated/manual-chunks-conflict/_config.js +++ b/test/function/samples/deprecated/manual-chunks-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Throws for conflicts between manual chunks', options: { strictDeprecations: false, @@ -15,4 +15,4 @@ module.exports = { message: 'Cannot assign "dep.js" to the "dep2" chunk as it is already in the "dep1" chunk.' }, warnings: [] -}; +}); diff --git a/test/function/samples/deprecated/manual-chunks-info/_config.js b/test/function/samples/deprecated/manual-chunks-info/_config.js index 70b90be2704..6a7d5705087 100644 --- a/test/function/samples/deprecated/manual-chunks-info/_config.js +++ b/test/function/samples/deprecated/manual-chunks-info/_config.js @@ -6,7 +6,7 @@ function getId(name) { return path.join(__dirname, `${name}.js`); } -module.exports = { +module.exports = defineTest({ description: 'provides additional chunk information to a manualChunks function', options: { strictDeprecations: false, @@ -312,4 +312,4 @@ module.exports = { } }, warnings: [] -}; +}); diff --git a/test/function/samples/deprecated/manual-chunks-preserve-modules/_config.js b/test/function/samples/deprecated/manual-chunks-preserve-modules/_config.js index 43e347db608..1afbdff0e56 100644 --- a/test/function/samples/deprecated/manual-chunks-preserve-modules/_config.js +++ b/test/function/samples/deprecated/manual-chunks-preserve-modules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Assigning manual chunks fails when preserving modules', options: { strictDeprecations: false, @@ -15,4 +15,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-manualchunks' }, warnings: [] -}; +}); 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 26e2cd395f8..8f9700cf23e 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 @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileReads set to infinity', options: { strictDeprecations: false, @@ -34,4 +34,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#maxparallelfileops' } ] -}; +}); 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 0372a4abaa6..4f9d4e77b8e 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 @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileReads set to 3', options: { strictDeprecations: false, @@ -34,4 +34,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#maxparallelfileops' } ] -}; +}); 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 91ee4d01d95..b16cd3bf59e 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 @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileReads with plugin', options: { strictDeprecations: false, @@ -41,4 +41,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#maxparallelfileops' } ] -}; +}); diff --git a/test/function/samples/deprecated/name-conflict-symbol/_config.js b/test/function/samples/deprecated/name-conflict-symbol/_config.js index 1f48fa34975..e13f395ce3a 100644 --- a/test/function/samples/deprecated/name-conflict-symbol/_config.js +++ b/test/function/samples/deprecated/name-conflict-symbol/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'avoids name conflicts with local variables named Symbol', options: { strictDeprecations: false, @@ -20,4 +20,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js b/test/function/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js index 8ca96af6378..fdcc36cfa0d 100644 --- a/test/function/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/dynamic-import-default-mode/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports of entry chunks with default export mode', options: { @@ -24,4 +24,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/dynamic-import/_config.js b/test/function/samples/deprecated/namespace-tostring/dynamic-import/_config.js index 56dd2a94ec4..a7672c3e17c 100644 --- a/test/function/samples/deprecated/namespace-tostring/dynamic-import/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/dynamic-import/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports', options: { strictDeprecations: false, @@ -27,4 +27,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/entry-default/_config.js b/test/function/samples/deprecated/namespace-tostring/entry-default/_config.js index 7794d818589..bed1e2e5b5f 100644 --- a/test/function/samples/deprecated/namespace-tostring/entry-default/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/entry-default/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not add Symbol.toStringTag property to entry chunks with default export mode', options: { strictDeprecations: false, @@ -22,4 +22,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/entry-named/_config.js b/test/function/samples/deprecated/namespace-tostring/entry-named/_config.js index 4f74505c228..80242f61d29 100644 --- a/test/function/samples/deprecated/namespace-tostring/entry-named/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/entry-named/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to entry chunks with named exports', options: { strictDeprecations: false, @@ -27,4 +27,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/external-namespaces/_config.js b/test/function/samples/deprecated/namespace-tostring/external-namespaces/_config.js index 88b0c5f34a3..f5f42bc9bee 100644 --- a/test/function/samples/deprecated/namespace-tostring/external-namespaces/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/external-namespaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to external namespaces', options: { strictDeprecations: false, @@ -38,4 +38,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/inlined-namespace/_config.js b/test/function/samples/deprecated/namespace-tostring/inlined-namespace/_config.js index acf230e3c03..b13c2840c80 100644 --- a/test/function/samples/deprecated/namespace-tostring/inlined-namespace/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/inlined-namespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to inlined namespaces', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/interop-property-descriptor/_config.js b/test/function/samples/deprecated/namespace-tostring/interop-property-descriptor/_config.js index 9fb94d75c4a..56a9227acd3 100644 --- a/test/function/samples/deprecated/namespace-tostring/interop-property-descriptor/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/interop-property-descriptor/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generated interop namespaces should have correct Symbol.toStringTag', context: { require() { @@ -25,4 +25,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/namespace-tostring/property-descriptor/_config.js b/test/function/samples/deprecated/namespace-tostring/property-descriptor/_config.js index 16992cef3d0..c0a08b6ee7c 100644 --- a/test/function/samples/deprecated/namespace-tostring/property-descriptor/_config.js +++ b/test/function/samples/deprecated/namespace-tostring/property-descriptor/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'namespace export should have @@toStringTag with correct property descriptors #4336', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/nested-inlined-dynamic-import-1/_config.js b/test/function/samples/deprecated/nested-inlined-dynamic-import-1/_config.js index d35086d6969..8d567dff26c 100644 --- a/test/function/samples/deprecated/nested-inlined-dynamic-import-1/_config.js +++ b/test/function/samples/deprecated/nested-inlined-dynamic-import-1/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables when nested dynamic imports are inlined via inlineDynamicImports', options: { @@ -18,4 +18,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } ] -}; +}); diff --git a/test/function/samples/deprecated/plugin-module-ids/_config.js b/test/function/samples/deprecated/plugin-module-ids/_config.js index baf54daad9f..e296b0c915c 100644 --- a/test/function/samples/deprecated/plugin-module-ids/_config.js +++ b/test/function/samples/deprecated/plugin-module-ids/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); let rendered = false; -module.exports = { +module.exports = defineTest({ description: 'provides all module ids on the plugin context', options: { strictDeprecations: false, @@ -31,4 +31,4 @@ module.exports = { url: 'https://rollupjs.org/plugin-development/#this-getmoduleids' } ] -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/inline-dynamic-imports/_config.js b/test/function/samples/deprecated/preserveModules/inline-dynamic-imports/_config.js index e1426433492..f72dfda5b09 100644 --- a/test/function/samples/deprecated/preserveModules/inline-dynamic-imports/_config.js +++ b/test/function/samples/deprecated/preserveModules/inline-dynamic-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Inlining dynamic imports is not supported when preserving modules', options: { strictDeprecations: false, @@ -12,4 +12,4 @@ module.exports = { 'Invalid value for option "output.inlineDynamicImports" - this option is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/invalid-default-export-mode/_config.js b/test/function/samples/deprecated/preserveModules/invalid-default-export-mode/_config.js index c302bb8feb3..de7fd930549 100644 --- a/test/function/samples/deprecated/preserveModules/invalid-default-export-mode/_config.js +++ b/test/function/samples/deprecated/preserveModules/invalid-default-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using default export mode with named exports', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { '"default" was specified for "output.exports", but entry module "lib.js" has the following exports: "value"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/invalid-no-preserve-entry-signatures/_config.js b/test/function/samples/deprecated/preserveModules/invalid-no-preserve-entry-signatures/_config.js index 1b463e5a81e..c3fbb227305 100644 --- a/test/function/samples/deprecated/preserveModules/invalid-no-preserve-entry-signatures/_config.js +++ b/test/function/samples/deprecated/preserveModules/invalid-no-preserve-entry-signatures/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting preserveEntrySignatures to false', options: { strictDeprecations: false, @@ -12,4 +12,4 @@ module.exports = { 'Invalid value for option "preserveEntrySignatures" - setting this option to false is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#preserveentrysignatures' } -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/invalid-none-export-mode/_config.js b/test/function/samples/deprecated/preserveModules/invalid-none-export-mode/_config.js index 37b76ef043b..d8b42800847 100644 --- a/test/function/samples/deprecated/preserveModules/invalid-none-export-mode/_config.js +++ b/test/function/samples/deprecated/preserveModules/invalid-none-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using none export mode with named exports', options: { strictDeprecations: false, @@ -14,4 +14,4 @@ module.exports = { '"none" was specified for "output.exports", but entry module "lib.js" has the following exports: "value"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/manual-chunks/_config.js b/test/function/samples/deprecated/preserveModules/manual-chunks/_config.js index 0d314e54fa9..f5a3018c9ac 100644 --- a/test/function/samples/deprecated/preserveModules/manual-chunks/_config.js +++ b/test/function/samples/deprecated/preserveModules/manual-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Assigning manual chunks fails when preserving modules', options: { strictDeprecations: false, @@ -16,4 +16,4 @@ module.exports = { 'Invalid value for option "output.manualChunks" - this option is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#output-manualchunks' } -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/mixed-exports/_config.js b/test/function/samples/deprecated/preserveModules/mixed-exports/_config.js index fe6f283d018..a8b3919deb8 100644 --- a/test/function/samples/deprecated/preserveModules/mixed-exports/_config.js +++ b/test/function/samples/deprecated/preserveModules/mixed-exports/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_LIB1 = path.join(__dirname, 'lib1.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for mixed exports in all chunks when preserving modules', options: { strictDeprecations: false, @@ -31,4 +31,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-exports' } ] -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/virtual-modules-conflict/_config.js b/test/function/samples/deprecated/preserveModules/virtual-modules-conflict/_config.js index 0d118cec1bb..3210239e895 100644 --- a/test/function/samples/deprecated/preserveModules/virtual-modules-conflict/_config.js +++ b/test/function/samples/deprecated/preserveModules/virtual-modules-conflict/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { strictDeprecations: false, @@ -38,4 +38,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-preservemodules' } ] -}; +}); diff --git a/test/function/samples/deprecated/preserveModules/virtual-modules/_config.js b/test/function/samples/deprecated/preserveModules/virtual-modules/_config.js index 5b67e84442b..8aecc53f505 100644 --- a/test/function/samples/deprecated/preserveModules/virtual-modules/_config.js +++ b/test/function/samples/deprecated/preserveModules/virtual-modules/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { strictDeprecations: false, @@ -38,4 +38,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-preservemodules' } ] -}; +}); diff --git a/test/function/samples/deprecated/reexport-ns/_config.js b/test/function/samples/deprecated/reexport-ns/_config.js index 4400c062841..24750619e76 100644 --- a/test/function/samples/deprecated/reexport-ns/_config.js +++ b/test/function/samples/deprecated/reexport-ns/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'external namespace reexport', options: { strictDeprecations: false, @@ -22,4 +22,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } ] -}; +}); diff --git a/test/function/samples/deprecated/resolve-id-external/_config.js b/test/function/samples/deprecated/resolve-id-external/_config.js index d2b6316fd1a..c1cb13a3005 100644 --- a/test/function/samples/deprecated/resolve-id-external/_config.js +++ b/test/function/samples/deprecated/resolve-id-external/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const sideEffects = []; const { getObject } = require('../../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'does not include modules without used exports if moduleSideEffect is false', context: { require(id) { @@ -84,4 +84,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/deprecated/resolve-id/_config.js b/test/function/samples/deprecated/resolve-id/_config.js index c1599d972fc..825b6a69a03 100644 --- a/test/function/samples/deprecated/resolve-id/_config.js +++ b/test/function/samples/deprecated/resolve-id/_config.js @@ -4,7 +4,7 @@ const { getObject } = require('../../../../utils'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'does not include modules without used exports if moduleSideEffect is false', context: { sideEffects @@ -91,4 +91,4 @@ module.exports = { assert.strictEqual(warning.code, 'DEPRECATED_FEATURE'); } } -}; +}); diff --git a/test/function/samples/deprecations/dynamicImportFunction/_config.js b/test/function/samples/deprecations/dynamicImportFunction/_config.js index 0ce0b770125..e143d84cf7b 100644 --- a/test/function/samples/deprecations/dynamicImportFunction/_config.js +++ b/test/function/samples/deprecations/dynamicImportFunction/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "output.dynamicImportFunction" option as deprecated', options: { output: { @@ -11,4 +11,4 @@ module.exports = { 'The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.', url: 'https://rollupjs.org/plugin-development/#renderdynamicimport' } -}; +}); diff --git a/test/function/samples/deprecations/experimentalDeepDynamicChunkOptimization/_config.js b/test/function/samples/deprecations/experimentalDeepDynamicChunkOptimization/_config.js index e0a3d5fdac7..55497278ec1 100644 --- a/test/function/samples/deprecations/experimentalDeepDynamicChunkOptimization/_config.js +++ b/test/function/samples/deprecations/experimentalDeepDynamicChunkOptimization/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "output.experimentalDeepDynamicChunkOptimization" option as deprecated', options: { output: { @@ -11,4 +11,4 @@ module.exports = { 'The "output.experimentalDeepDynamicChunkOptimization" option is deprecated as Rollup always runs the full chunking algorithm now. The option should be removed.', url: 'https://rollupjs.org/configuration-options/#output-experimentaldeepdynamicchunkoptimization' } -}; +}); diff --git a/test/function/samples/deprecations/hasModuleSideEffects/_config.js b/test/function/samples/deprecations/hasModuleSideEffects/_config.js index 19fbbf73cd5..a711e73a995 100644 --- a/test/function/samples/deprecations/hasModuleSideEffects/_config.js +++ b/test/function/samples/deprecations/hasModuleSideEffects/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'warns that accessing "ModuleInfo.hasModuleSideEffects" is deprecated', options: { strictDeprecations: true, @@ -24,4 +24,4 @@ module.exports = { url: 'https://rollupjs.org/plugin-development/#this-getmoduleinfo', watchFiles: [path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/deprecations/inlineDynamicImports/_config.js b/test/function/samples/deprecations/inlineDynamicImports/_config.js index 53fcbadd7d8..cb5956690ca 100644 --- a/test/function/samples/deprecations/inlineDynamicImports/_config.js +++ b/test/function/samples/deprecations/inlineDynamicImports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "inlineDynamicImports" input option as deprecated', options: { inlineDynamicImports: true @@ -9,4 +9,4 @@ module.exports = { 'The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } -}; +}); diff --git a/test/function/samples/deprecations/manualChunks/_config.js b/test/function/samples/deprecations/manualChunks/_config.js index 4c32f14fabb..be135218fe0 100644 --- a/test/function/samples/deprecations/manualChunks/_config.js +++ b/test/function/samples/deprecations/manualChunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "manualChunks" input option as deprecated', options: { manualChunks() { @@ -11,4 +11,4 @@ module.exports = { 'The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', url: 'https://rollupjs.org/configuration-options/#output-manualchunks' } -}; +}); diff --git a/test/function/samples/deprecations/maxParallelFileReads/_config.js b/test/function/samples/deprecations/maxParallelFileReads/_config.js index 1a1909c9a74..3fb15c6e40a 100644 --- a/test/function/samples/deprecations/maxParallelFileReads/_config.js +++ b/test/function/samples/deprecations/maxParallelFileReads/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "maxParallelFileReads" option as deprecated', options: { maxParallelFileReads: 3 @@ -9,4 +9,4 @@ module.exports = { 'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', url: 'https://rollupjs.org/configuration-options/#maxparallelfileops' } -}; +}); diff --git a/test/function/samples/deprecations/namespaceToStringTag/_config.js b/test/function/samples/deprecations/namespaceToStringTag/_config.js index d9cc0fe9262..79b151732f4 100644 --- a/test/function/samples/deprecations/namespaceToStringTag/_config.js +++ b/test/function/samples/deprecations/namespaceToStringTag/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "output.namespaceToStringTag" option as deprecated', options: { output: { @@ -11,4 +11,4 @@ module.exports = { 'The "output.namespaceToStringTag" option is deprecated. Use the "output.generatedCode.symbols" option instead.', url: 'https://rollupjs.org/configuration-options/#output-generatedcode-symbols' } -}; +}); diff --git a/test/function/samples/deprecations/plugin-module-ids/_config.js b/test/function/samples/deprecations/plugin-module-ids/_config.js index fbdadac1740..0b49a46c96d 100644 --- a/test/function/samples/deprecations/plugin-module-ids/_config.js +++ b/test/function/samples/deprecations/plugin-module-ids/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'provides all module ids on the plugin context', options: { external: ['path'], @@ -18,4 +18,4 @@ module.exports = { pluginCode: 'DEPRECATED_FEATURE', url: 'https://rollupjs.org/plugin-development/#this-getmoduleids' } -}; +}); diff --git a/test/function/samples/deprecations/prefer-const/_config.js b/test/function/samples/deprecations/prefer-const/_config.js index d8f58e4b9b8..0e9a06f928c 100644 --- a/test/function/samples/deprecations/prefer-const/_config.js +++ b/test/function/samples/deprecations/prefer-const/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "output.preferConst" option as deprecated', options: { output: { @@ -11,4 +11,4 @@ module.exports = { 'The "output.preferConst" option is deprecated. Use the "output.generatedCode.constBindings" option instead.', url: 'https://rollupjs.org/configuration-options/#output-generatedcode-constbindings' } -}; +}); diff --git a/test/function/samples/deprecations/preserveModules/_config.js b/test/function/samples/deprecations/preserveModules/_config.js index 62dfaa250d0..0bb0d2140c3 100644 --- a/test/function/samples/deprecations/preserveModules/_config.js +++ b/test/function/samples/deprecations/preserveModules/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'marks the "preserveModules" input option as deprecated', options: { preserveModules: true @@ -9,4 +9,4 @@ module.exports = { 'The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', url: 'https://rollupjs.org/configuration-options/#output-preservemodules' } -}; +}); diff --git a/test/function/samples/deshadow-respect-existing/_config.js b/test/function/samples/deshadow-respect-existing/_config.js index f37914a5815..ee8efb8adf4 100644 --- a/test/function/samples/deshadow-respect-existing/_config.js +++ b/test/function/samples/deshadow-respect-existing/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'respect existing variable names when deshadowing', exports(exports) { assert.equal(exports.getValue(), 'mainmainmainmaindep'); } -}; +}); diff --git a/test/function/samples/deshadow-top-level-declaration/_config.js b/test/function/samples/deshadow-top-level-declaration/_config.js index b8d32ac0d85..46454ff8a4a 100644 --- a/test/function/samples/deshadow-top-level-declaration/_config.js +++ b/test/function/samples/deshadow-top-level-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deshadows top-level declarations' -}; +}); diff --git a/test/function/samples/deshadowed-destructured-parameter/_config.js b/test/function/samples/deshadowed-destructured-parameter/_config.js index 015ba4ce20c..a67f4436f45 100644 --- a/test/function/samples/deshadowed-destructured-parameter/_config.js +++ b/test/function/samples/deshadowed-destructured-parameter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly deshadows destructured function parameters (#1008)' -}; +}); diff --git a/test/function/samples/deshadowed-namespaced-external-import-ignored/_config.js b/test/function/samples/deshadowed-namespaced-external-import-ignored/_config.js index 1eb42243357..8b96dc77b36 100644 --- a/test/function/samples/deshadowed-namespaced-external-import-ignored/_config.js +++ b/test/function/samples/deshadowed-namespaced-external-import-ignored/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: '#1547', options: { external: ['external'] @@ -9,4 +9,4 @@ module.exports = { throw new Error('huh?'); } } -}; +}); diff --git a/test/function/samples/deshadowed-namespaced-import-renamed/_config.js b/test/function/samples/deshadowed-namespaced-import-renamed/_config.js index 00c9cc61173..a07e45ebee8 100644 --- a/test/function/samples/deshadowed-namespaced-import-renamed/_config.js +++ b/test/function/samples/deshadowed-namespaced-import-renamed/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: '#1550' -}; +}); diff --git a/test/function/samples/deshadowed-namespaced-import/_config.js b/test/function/samples/deshadowed-namespaced-import/_config.js index 99a1fdc71df..233145edacf 100644 --- a/test/function/samples/deshadowed-namespaced-import/_config.js +++ b/test/function/samples/deshadowed-namespaced-import/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: '#1488' -}; +}); diff --git a/test/function/samples/deshadowed-shorthand-property/_config.js b/test/function/samples/deshadowed-shorthand-property/_config.js index 352f7f3e8b9..e462f81d6e0 100644 --- a/test/function/samples/deshadowed-shorthand-property/_config.js +++ b/test/function/samples/deshadowed-shorthand-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'shorthand properties referencing deshadowed variables are expanded' -}; +}); diff --git a/test/function/samples/deshadows-function-expression-id/_config.js b/test/function/samples/deshadows-function-expression-id/_config.js index 2f0ff5381b9..679a6c996f8 100644 --- a/test/function/samples/deshadows-function-expression-id/_config.js +++ b/test/function/samples/deshadows-function-expression-id/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deshadows function expression ID (#1176)' -}; +}); diff --git a/test/function/samples/destructuring-loop/_config.js b/test/function/samples/destructuring-loop/_config.js index a7307a7e141..2a104f719ce 100644 --- a/test/function/samples/destructuring-loop/_config.js +++ b/test/function/samples/destructuring-loop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles loops with destructuring declarations' -}; +}); diff --git a/test/function/samples/disappearing-exported-value/_config.js b/test/function/samples/disappearing-exported-value/_config.js index 10be0e873e4..5f4a6b88169 100644 --- a/test/function/samples/disappearing-exported-value/_config.js +++ b/test/function/samples/disappearing-exported-value/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exported values do not mysteriously disappear (#484)', exports(exports) { assert.equal(exports.exportedAnswer, 42); assert.equal(exports.foo(), 42); } -}; +}); diff --git a/test/function/samples/do-while-conditional-break/_config.js b/test/function/samples/do-while-conditional-break/_config.js index f239588d8a8..3af21fa3032 100644 --- a/test/function/samples/do-while-conditional-break/_config.js +++ b/test/function/samples/do-while-conditional-break/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles conditional breaks in do-while loops with unconditional return' -}; +}); diff --git a/test/function/samples/does-not-deconflict-undefined/_config.js b/test/function/samples/does-not-deconflict-undefined/_config.js index 56a2f0daa8e..48623db166c 100644 --- a/test/function/samples/does-not-deconflict-undefined/_config.js +++ b/test/function/samples/does-not-deconflict-undefined/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not rename undefined' -}; +}); diff --git a/test/function/samples/does-not-fail-for-arguments-test/_config.js b/test/function/samples/does-not-fail-for-arguments-test/_config.js index b9ad98c8d17..485c0adca3d 100644 --- a/test/function/samples/does-not-fail-for-arguments-test/_config.js +++ b/test/function/samples/does-not-fail-for-arguments-test/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not fail when non-integer arguments properties are accessed' -}; +}); diff --git a/test/function/samples/does-not-hang-on-missing-module/_config.js b/test/function/samples/does-not-hang-on-missing-module/_config.js index 5c6f2ba2fd3..1369337288a 100644 --- a/test/function/samples/does-not-hang-on-missing-module/_config.js +++ b/test/function/samples/does-not-hang-on-missing-module/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'does not hang on missing module (#53)', warnings: [ { @@ -20,4 +20,4 @@ module.exports = { "Cannot find module 'unlessYouCreatedThisFileForSomeReason'" ); } -}; +}); diff --git a/test/function/samples/does-not-mangle-entry-point/_config.js b/test/function/samples/does-not-mangle-entry-point/_config.js index 7eebdc8bff3..4cf513eeafa 100644 --- a/test/function/samples/does-not-mangle-entry-point/_config.js +++ b/test/function/samples/does-not-mangle-entry-point/_config.js @@ -5,7 +5,7 @@ const modules = { 'x/y': 'export default 24;' }; -module.exports = { +module.exports = defineTest({ description: 'does not mangle input', options: { input: 'x\\y', @@ -23,4 +23,4 @@ module.exports = { exports(exports) { assert.equal(exports, 42); } -}; +}); diff --git a/test/function/samples/double-default-export/_config.js b/test/function/samples/double-default-export/_config.js index f10fcb73029..a6760044b75 100644 --- a/test/function/samples/double-default-export/_config.js +++ b/test/function/samples/double-default-export/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_FOO = path.join(__dirname, 'foo.js'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws on double default exports', error: { cause: { @@ -30,4 +30,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/double-named-export/_config.js b/test/function/samples/double-named-export/_config.js index 83f16414123..7e671029ad3 100644 --- a/test/function/samples/double-named-export/_config.js +++ b/test/function/samples/double-named-export/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'throws on duplicate named exports', error: { cause: { @@ -31,4 +31,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/double-named-reexport/_config.js b/test/function/samples/double-named-reexport/_config.js index 6e9a18d4fec..4488a569c5e 100644 --- a/test/function/samples/double-named-reexport/_config.js +++ b/test/function/samples/double-named-reexport/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'throws on duplicate named exports', error: { cause: { @@ -31,4 +31,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/double-namespace-reexport/_config.js b/test/function/samples/double-namespace-reexport/_config.js index 170c57c055c..25c28785975 100644 --- a/test/function/samples/double-namespace-reexport/_config.js +++ b/test/function/samples/double-namespace-reexport/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles chained namespace reexports from externals', options: { external: 'external' @@ -14,4 +14,4 @@ module.exports = { exports({ foo }) { assert.strictEqual(foo, 42); } -}; +}); diff --git a/test/function/samples/duplicate-import-fails/_config.js b/test/function/samples/duplicate-import-fails/_config.js index 30b69cd5df3..f4dee4a9339 100644 --- a/test/function/samples/duplicate-import-fails/_config.js +++ b/test/function/samples/duplicate-import-fails/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows duplicate imports', error: { cause: { @@ -31,6 +31,6 @@ module.exports = { 4: assert.equal(a, 1); ` } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/duplicate-import-fails diff --git a/test/function/samples/duplicate-import-specifier-fails/_config.js b/test/function/samples/duplicate-import-specifier-fails/_config.js index 7e8a5f5d435..17dd9bafc0f 100644 --- a/test/function/samples/duplicate-import-specifier-fails/_config.js +++ b/test/function/samples/duplicate-import-specifier-fails/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows duplicate import specifiers', error: { cause: { @@ -29,6 +29,6 @@ module.exports = { 2: assert.equal(a, 1); ` } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/duplicate-import-specifier-fails diff --git a/test/function/samples/duplicate-input-entry/_config.js b/test/function/samples/duplicate-input-entry/_config.js index eb83d0c39a2..d70246ccd92 100644 --- a/test/function/samples/duplicate-input-entry/_config.js +++ b/test/function/samples/duplicate-input-entry/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles duplicate entry modules when using the object form', options: { input: ['entry', 'entry.js'] @@ -8,4 +8,4 @@ module.exports = { exports(exports) { assert.deepStrictEqual(exports, { entry: 'main' }); } -}; +}); diff --git a/test/function/samples/dynamic-import-default-mode-facade/_config.js b/test/function/samples/dynamic-import-default-mode-facade/_config.js index 9c71bb47957..1d35721ce8e 100644 --- a/test/function/samples/dynamic-import-default-mode-facade/_config.js +++ b/test/function/samples/dynamic-import-default-mode-facade/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles dynamic imports from facades using default export mode', options: { input: ['main', 'foo', 'bar'] @@ -10,4 +10,4 @@ module.exports = { assert.deepStrictEqual(exported, { __proto__: null, default: 4 }) ); } -}; +}); diff --git a/test/function/samples/dynamic-import-duplicates/_config.js b/test/function/samples/dynamic-import-duplicates/_config.js index b1801582872..2bb12ee7cb1 100644 --- a/test/function/samples/dynamic-import-duplicates/_config.js +++ b/test/function/samples/dynamic-import-duplicates/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining', options: { output: { inlineDynamicImports: true } @@ -11,4 +11,4 @@ module.exports = { assert.equal(y, 42); }); } -}; +}); diff --git a/test/function/samples/dynamic-import-existing/_config.js b/test/function/samples/dynamic-import-existing/_config.js index faa8e4c1f05..9506eac1aff 100644 --- a/test/function/samples/dynamic-import-existing/_config.js +++ b/test/function/samples/dynamic-import-existing/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining when resolution id is a module in the bundle', exports(exports) { assert.equal(exports.y, 42); @@ -8,4 +8,4 @@ module.exports = { assert.equal(value, 84); }); } -}; +}); diff --git a/test/function/samples/dynamic-import-expression/_config.js b/test/function/samples/dynamic-import-expression/_config.js index 653706645d2..9e754bac9d0 100644 --- a/test/function/samples/dynamic-import-expression/_config.js +++ b/test/function/samples/dynamic-import-expression/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import expression replacement', options: { plugins: [ @@ -28,4 +28,4 @@ module.exports = { assert.strictEqual(error.message.slice(0, expectedError.length), expectedError) ); } -}; +}); diff --git a/test/function/samples/dynamic-import-inlining/_config.js b/test/function/samples/dynamic-import-inlining/_config.js index b1801582872..2bb12ee7cb1 100644 --- a/test/function/samples/dynamic-import-inlining/_config.js +++ b/test/function/samples/dynamic-import-inlining/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining', options: { output: { inlineDynamicImports: true } @@ -11,4 +11,4 @@ module.exports = { assert.equal(y, 42); }); } -}; +}); diff --git a/test/function/samples/dynamic-import-not-found/_config.js b/test/function/samples/dynamic-import-not-found/_config.js index ed852db42fe..bfb13a5f340 100644 --- a/test/function/samples/dynamic-import-not-found/_config.js +++ b/test/function/samples/dynamic-import-not-found/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'warns if a dynamic import is not found', context: { require(id) { @@ -20,4 +20,4 @@ module.exports = { url: 'https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency' } ] -}; +}); diff --git a/test/function/samples/dynamic-import-only-default/_config.js b/test/function/samples/dynamic-import-only-default/_config.js index fe6765e5bf1..bcd5cc10ec4 100644 --- a/test/function/samples/dynamic-import-only-default/_config.js +++ b/test/function/samples/dynamic-import-only-default/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly imports dynamic namespaces with only a default export from entry- and non-entry-point chunks', options: { @@ -11,4 +11,4 @@ module.exports = { assert.deepStrictEqual(result, [{ __proto__: null, default: 42 }, { default: 42 }]) ); } -}; +}); diff --git a/test/function/samples/dynamic-import-relative-not-found/_config.js b/test/function/samples/dynamic-import-relative-not-found/_config.js index a6958c78316..e1e598193eb 100644 --- a/test/function/samples/dynamic-import-relative-not-found/_config.js +++ b/test/function/samples/dynamic-import-relative-not-found/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws if a dynamic relative import is not found', error: { code: 'UNRESOLVED_IMPORT', @@ -10,4 +10,4 @@ module.exports = { message: 'Could not resolve "./mod" from "main.js"', watchFiles: [ID_MAIN] } -}; +}); diff --git a/test/function/samples/dynamic-import-rewriting/_config.js b/test/function/samples/dynamic-import-rewriting/_config.js index 2574fe4344d..5b7608a5a49 100644 --- a/test/function/samples/dynamic-import-rewriting/_config.js +++ b/test/function/samples/dynamic-import-rewriting/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import string specifier resolving', options: { external: ['asdf'], @@ -18,4 +18,4 @@ module.exports = { assert.strictEqual(error.message.slice(0, expectedError.length), expectedError) ); } -}; +}); diff --git a/test/function/samples/dynamic-import-this-arrow/_config.js b/test/function/samples/dynamic-import-this-arrow/_config.js index 7ebceb43d71..09d2320f1e9 100644 --- a/test/function/samples/dynamic-import-this-arrow/_config.js +++ b/test/function/samples/dynamic-import-this-arrow/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'uses correct "this" in dynamic imports when using arrow functions', context: { require(id) { @@ -27,4 +27,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/function/samples/dynamic-import-this-function/_config.js b/test/function/samples/dynamic-import-this-function/_config.js index a58e2bbb87d..069836e93b2 100644 --- a/test/function/samples/dynamic-import-this-function/_config.js +++ b/test/function/samples/dynamic-import-this-function/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'uses correct "this" in dynamic imports when not using arrow functions', context: { require(id) { @@ -27,4 +27,4 @@ module.exports = { dynamicImportInCjs: false } } -}; +}); diff --git a/test/function/samples/dynamic-imports-shared-exports/_config.js b/test/function/samples/dynamic-imports-shared-exports/_config.js index 20609cd5fed..7b43d4c92f2 100644 --- a/test/function/samples/dynamic-imports-shared-exports/_config.js +++ b/test/function/samples/dynamic-imports-shared-exports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows sharing imports between dynamic chunks', options: { preserveEntrySignatures: 'allow-extension' @@ -6,4 +6,4 @@ module.exports = { exports(exports) { return exports.promise; } -}; +}); diff --git a/test/function/samples/dynamic-namespace-lookup/_config.js b/test/function/samples/dynamic-namespace-lookup/_config.js index 3c2fe549cc2..d60a90bece8 100644 --- a/test/function/samples/dynamic-namespace-lookup/_config.js +++ b/test/function/samples/dynamic-namespace-lookup/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does namespace optimization when possible, but not for dynamic lookups' -}; +}); diff --git a/test/function/samples/emit-chunk-hash/_config.js b/test/function/samples/emit-chunk-hash/_config.js index 06b4563b867..cf145f5a87d 100644 --- a/test/function/samples/emit-chunk-hash/_config.js +++ b/test/function/samples/emit-chunk-hash/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'gives access to the hashed filed name via this.getFileName in generateBundle', options: { input: 'main', @@ -17,4 +17,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/emit-chunk-manual-asset-source/_config.js b/test/function/samples/emit-chunk-manual-asset-source/_config.js index 910f62f2cf1..36dd0dcc4df 100644 --- a/test/function/samples/emit-chunk-manual-asset-source/_config.js +++ b/test/function/samples/emit-chunk-manual-asset-source/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'supports setting asset sources as side effect of the manual chunks option', options: { output: { @@ -24,4 +24,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/emit-chunk-manual/_config.js b/test/function/samples/emit-chunk-manual/_config.js index ecf1ba393f1..09e17c86da7 100644 --- a/test/function/samples/emit-chunk-manual/_config.js +++ b/test/function/samples/emit-chunk-manual/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); let referenceId; -module.exports = { +module.exports = defineTest({ description: 'supports emitting chunks as side effect of the manual chunks option', options: { output: { @@ -19,4 +19,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-invalid/_config.js b/test/function/samples/emit-file/asset-source-invalid/_config.js index 95351e3fbee..e7176b36e91 100644 --- a/test/function/samples/emit-file/asset-source-invalid/_config.js +++ b/test/function/samples/emit-file/asset-source-invalid/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting an empty asset source', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-invalid2/_config.js b/test/function/samples/emit-file/asset-source-invalid2/_config.js index b41d8952062..f835adc9bb7 100644 --- a/test/function/samples/emit-file/asset-source-invalid2/_config.js +++ b/test/function/samples/emit-file/asset-source-invalid2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting an empty asset source', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-invalid3/_config.js b/test/function/samples/emit-file/asset-source-invalid3/_config.js index 411b195433c..0cf25fa9a8f 100644 --- a/test/function/samples/emit-file/asset-source-invalid3/_config.js +++ b/test/function/samples/emit-file/asset-source-invalid3/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting an empty asset source', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-invalid4/_config.js b/test/function/samples/emit-file/asset-source-invalid4/_config.js index c23119557b1..e1b66fa773a 100644 --- a/test/function/samples/emit-file/asset-source-invalid4/_config.js +++ b/test/function/samples/emit-file/asset-source-invalid4/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting an empty asset source', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-missing/_config.js b/test/function/samples/emit-file/asset-source-missing/_config.js index bb97104870f..5989d82a6e5 100644 --- a/test/function/samples/emit-file/asset-source-missing/_config.js +++ b/test/function/samples/emit-file/asset-source-missing/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when not setting the asset source', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { code: 'ASSET_SOURCE_MISSING', message: 'Plugin error creating asset "test.ext" - no asset source set.' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-missing2/_config.js b/test/function/samples/emit-file/asset-source-missing2/_config.js index 20a1975c3b5..b2ec171c523 100644 --- a/test/function/samples/emit-file/asset-source-missing2/_config.js +++ b/test/function/samples/emit-file/asset-source-missing2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when not setting the asset source', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { code: 'ASSET_SOURCE_MISSING', message: 'Plugin error creating asset "6b86b273" - no asset source set.' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-missing3/_config.js b/test/function/samples/emit-file/asset-source-missing3/_config.js index 202b2e01c59..f924cf85b86 100644 --- a/test/function/samples/emit-file/asset-source-missing3/_config.js +++ b/test/function/samples/emit-file/asset-source-missing3/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when accessing the file name before the asset source is set', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'ASSET_NOT_FINALISED' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-missing4/_config.js b/test/function/samples/emit-file/asset-source-missing4/_config.js index b55fb138b78..9e1b27eb3be 100644 --- a/test/function/samples/emit-file/asset-source-missing4/_config.js +++ b/test/function/samples/emit-file/asset-source-missing4/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when accessing the file name before the asset source is set', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'ASSET_NOT_FINALISED' } -}; +}); diff --git a/test/function/samples/emit-file/asset-source-missing5/_config.js b/test/function/samples/emit-file/asset-source-missing5/_config.js index 54b254be27f..346496edbe1 100644 --- a/test/function/samples/emit-file/asset-source-missing5/_config.js +++ b/test/function/samples/emit-file/asset-source-missing5/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when not setting the asset source and accessing the asset URL', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { message: 'Plugin error - Unable to get file name for asset "test.ext". Ensure that the source is set and that generate is called first. If you reference assets via import.meta.ROLLUP_FILE_URL_, you need to either have set their source after "renderStart" or need to provide an explicit "fileName" when emitting them.' } -}; +}); diff --git a/test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js b/test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js index dd470ea74cd..065cde79c31 100644 --- a/test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js +++ b/test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js @@ -1,6 +1,6 @@ let chunkId; -module.exports = { +module.exports = defineTest({ description: 'Throws when accessing the filename before it has been generated in buildEnd', options: { input: 'main.js', @@ -22,4 +22,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'CHUNK_NOT_GENERATED' } -}; +}); diff --git a/test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js b/test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js index 86e620e2fd5..8879dc2cbfd 100644 --- a/test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js +++ b/test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js @@ -1,6 +1,6 @@ let chunkId; -module.exports = { +module.exports = defineTest({ description: 'Throws when accessing the filename before it has been generated in renderStart', options: { input: 'main.js', @@ -22,4 +22,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'CHUNK_NOT_GENERATED' } -}; +}); diff --git a/test/function/samples/emit-file/chunk-filename-not-available/_config.js b/test/function/samples/emit-file/chunk-filename-not-available/_config.js index b56bd15667c..9eaa429e482 100644 --- a/test/function/samples/emit-file/chunk-filename-not-available/_config.js +++ b/test/function/samples/emit-file/chunk-filename-not-available/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Throws when accessing the filename before it has been generated', options: { input: 'main.js', @@ -18,4 +18,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'CHUNK_NOT_GENERATED' } -}; +}); diff --git a/test/function/samples/emit-file/chunk-not-found/_config.js b/test/function/samples/emit-file/chunk-not-found/_config.js index 4feb0b9182f..ebfa97a6ba9 100644 --- a/test/function/samples/emit-file/chunk-not-found/_config.js +++ b/test/function/samples/emit-file/chunk-not-found/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'Throws if an emitted entry chunk cannot be resolved', options: { input: 'main.js', @@ -16,4 +16,4 @@ module.exports = { watchFiles: [ID_MAIN], message: 'Could not resolve entry module "not-found.js".' } -}; +}); diff --git a/test/function/samples/emit-file/emit-from-output-options/_config.js b/test/function/samples/emit-file/emit-from-output-options/_config.js index bf3ce6381d7..ddbf0a8325a 100644 --- a/test/function/samples/emit-file/emit-from-output-options/_config.js +++ b/test/function/samples/emit-file/emit-from-output-options/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when trying to emit files from the outputOptions hook', options: { input: 'main', @@ -19,4 +19,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'CANNOT_EMIT_FROM_OPTIONS_HOOK' } -}; +}); diff --git a/test/function/samples/emit-file/emit-same-file/_config.js b/test/function/samples/emit-file/emit-same-file/_config.js index a0266d5791b..baf87fffcc6 100644 --- a/test/function/samples/emit-file/emit-same-file/_config.js +++ b/test/function/samples/emit-file/emit-same-file/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns if multiple files with the same name are emitted', options: { input: 'main.js', @@ -27,4 +27,4 @@ module.exports = { 'The emitted file "generateBundle" overwrites a previously emitted file of the same name.' } ] -}; +}); diff --git a/test/function/samples/emit-file/file-references-in-bundle/_config.js b/test/function/samples/emit-file/file-references-in-bundle/_config.js index e1ed74c6f88..3f676dc346a 100644 --- a/test/function/samples/emit-file/file-references-in-bundle/_config.js +++ b/test/function/samples/emit-file/file-references-in-bundle/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { pathToFileURL } = require('node:url'); -module.exports = { +module.exports = defineTest({ description: 'lists referenced files in the bundle', options: { input: 'main', @@ -43,4 +43,4 @@ module.exports = { urlEncoding: `${directoryURL}/chunks/My%252FFile.js` }); } -}; +}); diff --git a/test/function/samples/emit-file/invalid-asset-name/_config.js b/test/function/samples/emit-file/invalid-asset-name/_config.js index 1d58fe9c100..eb692ae74f3 100644 --- a/test/function/samples/emit-file/invalid-asset-name/_config.js +++ b/test/function/samples/emit-file/invalid-asset-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid asset names', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/invalid-asset-name3/_config.js b/test/function/samples/emit-file/invalid-asset-name3/_config.js index 5d720fda2e8..6f68bdf972e 100644 --- a/test/function/samples/emit-file/invalid-asset-name3/_config.js +++ b/test/function/samples/emit-file/invalid-asset-name3/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid asset names with absolute path on Windows OS', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/invalid-chunk-id/_config.js b/test/function/samples/emit-file/invalid-chunk-id/_config.js index ed73d4d4776..d72840d73eb 100644 --- a/test/function/samples/emit-file/invalid-chunk-id/_config.js +++ b/test/function/samples/emit-file/invalid-chunk-id/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid chunk ids', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/invalid-file-type/_config.js b/test/function/samples/emit-file/invalid-file-type/_config.js index 1c665fc2772..8641200205a 100644 --- a/test/function/samples/emit-file/invalid-file-type/_config.js +++ b/test/function/samples/emit-file/invalid-file-type/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid file types', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/invalid-reference-id/_config.js b/test/function/samples/emit-file/invalid-reference-id/_config.js index 43e4e38420f..e12a5463e79 100644 --- a/test/function/samples/emit-file/invalid-reference-id/_config.js +++ b/test/function/samples/emit-file/invalid-reference-id/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid reference ids', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { code: 'FILE_NOT_FOUND', message: 'Plugin error - Unable to get file name for unknown file "invalid".' } -}; +}); diff --git a/test/function/samples/emit-file/invalid-set-asset-source-id/_config.js b/test/function/samples/emit-file/invalid-set-asset-source-id/_config.js index 67ed85414a5..ea28ec8016c 100644 --- a/test/function/samples/emit-file/invalid-set-asset-source-id/_config.js +++ b/test/function/samples/emit-file/invalid-set-asset-source-id/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid asset ids', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'ASSET_NOT_FOUND' } -}; +}); diff --git a/test/function/samples/emit-file/modules-loaded/_config.js b/test/function/samples/emit-file/modules-loaded/_config.js index 3cd01bfcd83..9e76edefffd 100644 --- a/test/function/samples/emit-file/modules-loaded/_config.js +++ b/test/function/samples/emit-file/modules-loaded/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Throws when adding a chunk after the modules have finished loading', options: { input: 'main.js', @@ -16,4 +16,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'INVALID_ROLLUP_PHASE' } -}; +}); diff --git a/test/function/samples/emit-file/no-input/_config.js b/test/function/samples/emit-file/no-input/_config.js index c35eb800405..0665e74b5a8 100644 --- a/test/function/samples/emit-file/no-input/_config.js +++ b/test/function/samples/emit-file/no-input/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'It is not necessary to provide an input if a dynamic entry is emitted', options: { input: undefined, @@ -9,4 +9,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/emit-file/set-asset-source-chunk/_config.js b/test/function/samples/emit-file/set-asset-source-chunk/_config.js index 27b97f89fb1..ede4397957d 100644 --- a/test/function/samples/emit-file/set-asset-source-chunk/_config.js +++ b/test/function/samples/emit-file/set-asset-source-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when trying to set the asset source of a chunk', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } -}; +}); diff --git a/test/function/samples/emit-file/set-asset-source-transform/_config.js b/test/function/samples/emit-file/set-asset-source-transform/_config.js index 452630d7ce7..667055fdb92 100644 --- a/test/function/samples/emit-file/set-asset-source-transform/_config.js +++ b/test/function/samples/emit-file/set-asset-source-transform/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when setting the asset source in the transform hook', options: { plugins: { @@ -22,4 +22,4 @@ module.exports = { pluginCode: 'INVALID_SETASSETSOURCE', watchFiles: [path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/emit-file/set-asset-source-twice/_config.js b/test/function/samples/emit-file/set-asset-source-twice/_config.js index 52e798fec21..695ed5de025 100644 --- a/test/function/samples/emit-file/set-asset-source-twice/_config.js +++ b/test/function/samples/emit-file/set-asset-source-twice/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting the asset source twice', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'ASSET_SOURCE_ALREADY_SET' } -}; +}); diff --git a/test/function/samples/emit-file/set-asset-source-twice2/_config.js b/test/function/samples/emit-file/set-asset-source-twice2/_config.js index 92e38307cc0..45bcbb9fb0e 100644 --- a/test/function/samples/emit-file/set-asset-source-twice2/_config.js +++ b/test/function/samples/emit-file/set-asset-source-twice2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting the asset source twice', options: { plugins: { @@ -17,4 +17,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'ASSET_SOURCE_ALREADY_SET' } -}; +}); diff --git a/test/function/samples/emit-file/set-source-in-output-options/_config.js b/test/function/samples/emit-file/set-source-in-output-options/_config.js index 6cba91aa9a2..1f19e4a67ca 100644 --- a/test/function/samples/emit-file/set-source-in-output-options/_config.js +++ b/test/function/samples/emit-file/set-source-in-output-options/_config.js @@ -1,6 +1,6 @@ let referenceId; -module.exports = { +module.exports = defineTest({ description: 'throws when trying to set file sources in the outputOptions hook', options: { input: 'main', @@ -21,4 +21,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'CANNOT_EMIT_FROM_OPTIONS_HOOK' } -}; +}); diff --git a/test/function/samples/empty-imports-have-side-effects/_config.js b/test/function/samples/empty-imports-have-side-effects/_config.js index 683ca7598eb..b9b1ce68533 100644 --- a/test/function/samples/empty-imports-have-side-effects/_config.js +++ b/test/function/samples/empty-imports-have-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'empty imports are assumed to contain side-effects' -}; +}); diff --git a/test/function/samples/empty-string-as-module-name/_config.js b/test/function/samples/empty-string-as-module-name/_config.js index dfbc2595b37..df34004792a 100644 --- a/test/function/samples/empty-string-as-module-name/_config.js +++ b/test/function/samples/empty-string-as-module-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows using empty string as a valid module name', options: { external: () => false, @@ -12,4 +12,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/enforce-plugin-order/_config.js b/test/function/samples/enforce-plugin-order/_config.js index 0a5d3e78d68..1ce69b69fb9 100644 --- a/test/function/samples/enforce-plugin-order/_config.js +++ b/test/function/samples/enforce-plugin-order/_config.js @@ -73,7 +73,7 @@ function addPlugin(order) { plugins.push(plugin); } -module.exports = { +module.exports = defineTest({ description: 'allows to enforce plugin hook order', options: { plugins, @@ -105,4 +105,4 @@ module.exports = { ); } } -}; +}); diff --git a/test/function/samples/enforce-sequential-plugin-order/_config.js b/test/function/samples/enforce-sequential-plugin-order/_config.js index c297ef82bdd..138b7c25344 100644 --- a/test/function/samples/enforce-sequential-plugin-order/_config.js +++ b/test/function/samples/enforce-sequential-plugin-order/_config.js @@ -59,7 +59,7 @@ function addPlugin(order, sequential) { plugins.push(plugin); } -module.exports = { +module.exports = defineTest({ description: 'allows to enforce sequential plugin hook order for parallel plugin hooks', options: { plugins @@ -86,4 +86,4 @@ module.exports = { ); } } -}; +}); diff --git a/test/function/samples/error-after-transform-should-throw-correct-location/_config.js b/test/function/samples/error-after-transform-should-throw-correct-location/_config.js index 50be8fca2af..3d24ffa9c63 100644 --- a/test/function/samples/error-after-transform-should-throw-correct-location/_config.js +++ b/test/function/samples/error-after-transform-should-throw-correct-location/_config.js @@ -3,7 +3,7 @@ const MagicString = require('magic-string'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_EMPTY = path.join(__dirname, 'empty.js'); -module.exports = { +module.exports = defineTest({ description: 'error after transform should throw with correct location of file', options: { plugins: [ @@ -41,4 +41,4 @@ module.exports = { watchFiles: [ID_EMPTY, ID_MAIN], message: '"default" is not exported by "empty.js", imported by "main.js".' } -}; +}); diff --git a/test/function/samples/error-missing-umd-name/_config.js b/test/function/samples/error-missing-umd-name/_config.js index 356e40cd02b..650de3601c4 100644 --- a/test/function/samples/error-missing-umd-name/_config.js +++ b/test/function/samples/error-missing-umd-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws an error if no name is provided for a UMD bundle', options: { output: { format: 'umd' } }, generateError: { @@ -7,4 +7,4 @@ module.exports = { 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.', url: 'https://rollupjs.org/configuration-options/#output-name' } -}; +}); diff --git a/test/function/samples/error-parse-json/_config.js b/test/function/samples/error-parse-json/_config.js index cfe3e33e3d5..d3a36449ac3 100644 --- a/test/function/samples/error-parse-json/_config.js +++ b/test/function/samples/error-parse-json/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_JSON = path.join(__dirname, 'file.json'); -module.exports = { +module.exports = defineTest({ description: 'throws with an extended error message when failing to parse a file with ".json" extension', error: { @@ -32,4 +32,4 @@ module.exports = { watchFiles: [ID_JSON, ID_MAIN], message: 'Unexpected token (Note that you need @rollup/plugin-json to import JSON files)' } -}; +}); diff --git a/test/function/samples/error-parse-unknown-extension/_config.js b/test/function/samples/error-parse-unknown-extension/_config.js index 2af6075edda..ca130f979d0 100644 --- a/test/function/samples/error-parse-unknown-extension/_config.js +++ b/test/function/samples/error-parse-unknown-extension/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_CSS = path.join(__dirname, 'file.css'); -module.exports = { +module.exports = defineTest({ description: 'throws with an extended error message when failing to parse a file without .(m)js extension', error: { @@ -32,4 +32,4 @@ module.exports = { watchFiles: [ID_CSS, ID_MAIN], message: 'Unexpected token (Note that you need plugins to import files that are not JavaScript)' } -}; +}); diff --git a/test/function/samples/es5-class-called-without-new/_config.js b/test/function/samples/es5-class-called-without-new/_config.js index 8c25f24144c..76acf9c94b0 100644 --- a/test/function/samples/es5-class-called-without-new/_config.js +++ b/test/function/samples/es5-class-called-without-new/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not swallow type errors when running constructor functions without "new"' -}; +}); diff --git a/test/function/samples/escape-arguments/_config.js b/test/function/samples/escape-arguments/_config.js index 126dcda005f..d6a327e57a5 100644 --- a/test/function/samples/escape-arguments/_config.js +++ b/test/function/samples/escape-arguments/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not use "arguments" as a placeholder variable for a default export', exports(exports) { assert.deepStrictEqual(exports, { foo: { __proto__: null, default: 42 } }); } -}; +}); diff --git a/test/function/samples/export-all-from-external/_config.js b/test/function/samples/export-all-from-external/_config.js index 86240a5d4cb..20a52edb094 100644 --- a/test/function/samples/export-all-from-external/_config.js +++ b/test/function/samples/export-all-from-external/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'allows `export *` from external module, internally', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/export-all-multiple/_config.js b/test/function/samples/export-all-multiple/_config.js index 409610baa79..8fac9a0598d 100644 --- a/test/function/samples/export-all-multiple/_config.js +++ b/test/function/samples/export-all-multiple/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows multiple export * statements' -}; +}); diff --git a/test/function/samples/export-all/_config.js b/test/function/samples/export-all/_config.js index 806031691fa..8afb75446b8 100644 --- a/test/function/samples/export-all/_config.js +++ b/test/function/samples/export-all/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows export *' -}; +}); diff --git a/test/function/samples/export-and-import-reference-share-var/_config.js b/test/function/samples/export-and-import-reference-share-var/_config.js index 55ace33d09e..f68560540d1 100644 --- a/test/function/samples/export-and-import-reference-share-var/_config.js +++ b/test/function/samples/export-and-import-reference-share-var/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows export and import reference to share name', exports(exports) { assert.equal(exports.b, 9); } -}; +}); // adapted from es6-module-transpiler diff --git a/test/function/samples/export-as/_config.js b/test/function/samples/export-as/_config.js index ed89b856725..a9bb4b25e06 100644 --- a/test/function/samples/export-as/_config.js +++ b/test/function/samples/export-as/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows export { x as y }' -}; +}); diff --git a/test/function/samples/export-deconflicted-names/_config.js b/test/function/samples/export-deconflicted-names/_config.js index c7e6c7ac10a..00393c19e77 100644 --- a/test/function/samples/export-deconflicted-names/_config.js +++ b/test/function/samples/export-deconflicted-names/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly exports deconflicted names', exports(exports) { assert.equal(exports.bar(), 'bar'); } -}; +}); diff --git a/test/function/samples/export-default-anonymous-function/_config.js b/test/function/samples/export-default-anonymous-function/_config.js index 7c1a6e3f7d0..a01760d97b0 100644 --- a/test/function/samples/export-default-anonymous-function/_config.js +++ b/test/function/samples/export-default-anonymous-function/_config.js @@ -1,7 +1,7 @@ const { readFileSync } = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'exports an anonymous function with custom ID resolver', // yeah, this is a real edge case options: { plugins: [ @@ -15,4 +15,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/export-default-as-b/_config.js b/test/function/samples/export-default-as-b/_config.js index dc8136824ce..9755f45e3c8 100644 --- a/test/function/samples/export-default-as-b/_config.js +++ b/test/function/samples/export-default-as-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'exports default-as-named from sibling module (b)' -}; +}); diff --git a/test/function/samples/export-default-as-c/_config.js b/test/function/samples/export-default-as-c/_config.js index 9dfbc0be0e2..941a5f01610 100644 --- a/test/function/samples/export-default-as-c/_config.js +++ b/test/function/samples/export-default-as-c/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports default-as-named from sibling module (c)', exports(exports) { assert.equal(exports.namespace.baz, 'BAZ'); } -}; +}); diff --git a/test/function/samples/export-default-as/_config.js b/test/function/samples/export-default-as/_config.js index 3047c4d5d93..5ab369b8ed4 100644 --- a/test/function/samples/export-default-as/_config.js +++ b/test/function/samples/export-default-as/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports default-as-named from sibling module', exports(exports) { assert.equal(exports.foo, 'FOO'); } -}; +}); diff --git a/test/function/samples/export-default-exported-id/_config.js b/test/function/samples/export-default-exported-id/_config.js index 6e3c0ca2b03..cd35ba842a4 100644 --- a/test/function/samples/export-default-exported-id/_config.js +++ b/test/function/samples/export-default-exported-id/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports an id that is also a default export', options: { output: { exports: 'named' } @@ -9,4 +9,4 @@ module.exports = { assert.ok(new exports.default().ok); assert.ok(new exports.Image().ok); } -}; +}); diff --git a/test/function/samples/export-default-expression/_config.js b/test/function/samples/export-default-expression/_config.js index e3f438a6aa5..49325dbe0ed 100644 --- a/test/function/samples/export-default-expression/_config.js +++ b/test/function/samples/export-default-expression/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports a default value as module.exports', exports(exports) { assert.equal(exports, 42); } -}; +}); diff --git a/test/function/samples/export-default-from-external/_config.js b/test/function/samples/export-default-from-external/_config.js index e02be969d52..1d539072e3b 100644 --- a/test/function/samples/export-default-from-external/_config.js +++ b/test/function/samples/export-default-from-external/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'ensures external modules have correct names', options: { external: ['path'] @@ -9,4 +9,4 @@ module.exports = { exports(exports) { assert.equal(exports, path.sep); } -}; +}); diff --git a/test/function/samples/export-default-named-function/_config.js b/test/function/samples/export-default-named-function/_config.js index c1b160dc009..1cb4ade0599 100644 --- a/test/function/samples/export-default-named-function/_config.js +++ b/test/function/samples/export-default-named-function/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports a default named function', exports(exports) { assert.equal(exports(), 42); } -}; +}); diff --git a/test/function/samples/export-default-no-space/_config.js b/test/function/samples/export-default-no-space/_config.js index 4acbd451146..3cbc2cd9ec9 100644 --- a/test/function/samples/export-default-no-space/_config.js +++ b/test/function/samples/export-default-no-space/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles default exports with no space before declaration', exports: exports => { assert.deepEqual(exports, {}); } -}; +}); diff --git a/test/function/samples/export-destruction/_config.js b/test/function/samples/export-destruction/_config.js index 4541253cd72..67e9ef50538 100644 --- a/test/function/samples/export-destruction/_config.js +++ b/test/function/samples/export-destruction/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handle destruction patterns in export declarations', exports(exports) { @@ -8,4 +8,4 @@ module.exports = { assert.equal(exports.baz, 5); assert.equal(exports.quux, 17); } -}; +}); diff --git a/test/function/samples/export-from-default-renamed/_config.js b/test/function/samples/export-from-default-renamed/_config.js index 2c9c52ad511..248b8bff2c2 100644 --- a/test/function/samples/export-from-default-renamed/_config.js +++ b/test/function/samples/export-from-default-renamed/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'export from works with multiple renamed default exports' -}; +}); diff --git a/test/function/samples/export-from-default/_config.js b/test/function/samples/export-from-default/_config.js index 81d51466e79..1c69852f27c 100644 --- a/test/function/samples/export-from-default/_config.js +++ b/test/function/samples/export-from-default/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'export from works with default exports' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-from-default diff --git a/test/function/samples/export-from-external/_config.js b/test/function/samples/export-from-external/_config.js index dbc597aad6d..e389acb7a46 100644 --- a/test/function/samples/export-from-external/_config.js +++ b/test/function/samples/export-from-external/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'exports directly from an external module', options: { external: ['path'] @@ -9,6 +9,6 @@ module.exports = { exports(exports) { assert.equal(exports.sep, path.sep); } -}; +}); // https://github.com/esperantojs/esperanto/issues/161 diff --git a/test/function/samples/export-from-internal-module/_config.js b/test/function/samples/export-from-internal-module/_config.js index 3af8c98fb1a..f9435024a18 100644 --- a/test/function/samples/export-from-internal-module/_config.js +++ b/test/function/samples/export-from-internal-module/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports from an internal module', exports(exports) { assert.equal(exports.foo, 42); } -}; +}); diff --git a/test/function/samples/export-from-multiple-no-default-conflict/_config.js b/test/function/samples/export-from-multiple-no-default-conflict/_config.js index 65ea8861425..a40476decb8 100644 --- a/test/function/samples/export-from-multiple-no-default-conflict/_config.js +++ b/test/function/samples/export-from-multiple-no-default-conflict/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'export from does not cause erroneous warning if multiple modules export default', warnings: [], exports: exports => { @@ -9,4 +9,4 @@ module.exports = { bar: 'bar' }); } -}; +}); diff --git a/test/function/samples/export-from-no-local-binding-var/_config.js b/test/function/samples/export-from-no-local-binding-var/_config.js index b5ae9aebe6a..7857a2c5270 100644 --- a/test/function/samples/export-from-no-local-binding-var/_config.js +++ b/test/function/samples/export-from-no-local-binding-var/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'export from does not create a local binding', runtimeError(error) { assert.ok(/foo is not defined/.test(error.message)); } -}; +}); diff --git a/test/function/samples/export-from-no-local-binding/_config.js b/test/function/samples/export-from-no-local-binding/_config.js index 7500be3ac77..b4d3d6a524b 100644 --- a/test/function/samples/export-from-no-local-binding/_config.js +++ b/test/function/samples/export-from-no-local-binding/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'export from does not create a local binding' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-from diff --git a/test/function/samples/export-from-renamed/_config.js b/test/function/samples/export-from-renamed/_config.js index 333e2a90e96..e22fd52dff8 100644 --- a/test/function/samples/export-from-renamed/_config.js +++ b/test/function/samples/export-from-renamed/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows export { x as y } from ...', exports(exports) { assert.equal(exports.y, 42); assert.ok(!('x' in exports)); } -}; +}); diff --git a/test/function/samples/export-from-with-definition-conflict/_config.js b/test/function/samples/export-from-with-definition-conflict/_config.js index 539e5f0a0b4..64b549c6ad0 100644 --- a/test/function/samples/export-from-with-definition-conflict/_config.js +++ b/test/function/samples/export-from-with-definition-conflict/_config.js @@ -1,12 +1,12 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'ignores conflict between local definitions and export from declaration', exports(exports) { assert.equal(exports.foo, 'a-bar'); assert.equal(exports.bar, 'a-foo'); assert.equal(exports.baz, 'a-baz'); } -}; +}); // https://github.com/rollup/rollup/issues/16 diff --git a/test/function/samples/export-from-with-import-conflict/_config.js b/test/function/samples/export-from-with-import-conflict/_config.js index 1918de16386..cade051df75 100644 --- a/test/function/samples/export-from-with-import-conflict/_config.js +++ b/test/function/samples/export-from-with-import-conflict/_config.js @@ -1,12 +1,12 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'ignores conflict between import declaration and export from declaration', exports(exports) { assert.equal(exports.foo, 'a-bar'); assert.equal(exports.bar, 'a-foo'); assert.equal(exports.baz, 'a-baz'); } -}; +}); // https://github.com/rollup/rollup/issues/16 diff --git a/test/function/samples/export-global/_config.js b/test/function/samples/export-global/_config.js index f67ad67a3a1..888caf9ae95 100644 --- a/test/function/samples/export-global/_config.js +++ b/test/function/samples/export-global/_config.js @@ -5,10 +5,10 @@ const assert = require('node:assert'); // see https://github.com/acornjs/acorn/issues/806 // Consider reverting this change should this become an acorn option -module.exports = { +module.exports = defineTest({ description: '"variables corresponding to globals can be exported"', exports(exports) { assert.equal(exports.Buffer, Buffer); } -}; +}); diff --git a/test/function/samples/export-not-at-top-level-fails/_config.js b/test/function/samples/export-not-at-top-level-fails/_config.js index 8fe22cf09ff..74eca72d482 100644 --- a/test/function/samples/export-not-at-top-level-fails/_config.js +++ b/test/function/samples/export-not-at-top-level-fails/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows non-top-level exports', error: { cause: { @@ -30,4 +30,4 @@ module.exports = { watchFiles: [ID_MAIN], message: "'import' and 'export' may only appear at the top level" } -}; +}); diff --git a/test/function/samples/export-two-ways-default-b/_config.js b/test/function/samples/export-two-ways-default-b/_config.js index 95e3fb7ac89..15cadf2373c 100644 --- a/test/function/samples/export-two-ways-default-b/_config.js +++ b/test/function/samples/export-two-ways-default-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects are preserved if subject is exported in multiple ways, even if default export has no direct link to original (#733)' -}; +}); diff --git a/test/function/samples/export-two-ways-default/_config.js b/test/function/samples/export-two-ways-default/_config.js index 88b207f4bca..7633a12e50e 100644 --- a/test/function/samples/export-two-ways-default/_config.js +++ b/test/function/samples/export-two-ways-default/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'side-effects are preserved if subject is exported in multiple ways (#733)' -}; +}); diff --git a/test/function/samples/export-two-ways-function/_config.js b/test/function/samples/export-two-ways-function/_config.js index 4027382f311..3c6145a4791 100644 --- a/test/function/samples/export-two-ways-function/_config.js +++ b/test/function/samples/export-two-ways-function/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports the same function more than one way (#648)', exports(exports) { assert.equal(exports.foo, exports.bar); assert.equal(exports.foo(), 42); } -}; +}); diff --git a/test/function/samples/export-two-ways/_config.js b/test/function/samples/export-two-ways/_config.js index a25253941ad..eea2c7b07c6 100644 --- a/test/function/samples/export-two-ways/_config.js +++ b/test/function/samples/export-two-ways/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports the same binding more than one way', exports(exports) { assert.equal(exports.a, 2); assert.equal(exports.b, 2); assert.equal(exports.c, 2); } -}; +}); diff --git a/test/function/samples/export-type-mismatch-b/_config.js b/test/function/samples/export-type-mismatch-b/_config.js index 163eadf8097..548ede76828 100644 --- a/test/function/samples/export-type-mismatch-b/_config.js +++ b/test/function/samples/export-type-mismatch-b/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'export type must be auto, default, named or none', options: { output: { exports: 'blah' } }, generateError: { @@ -7,4 +7,4 @@ module.exports = { message: '"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "blah".' } -}; +}); diff --git a/test/function/samples/export-type-mismatch-c/_config.js b/test/function/samples/export-type-mismatch-c/_config.js index c2115ab2973..be7b3966ac7 100644 --- a/test/function/samples/export-type-mismatch-c/_config.js +++ b/test/function/samples/export-type-mismatch-c/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'cannot have named exports if explicit export type is default', options: { output: { exports: 'none' } }, generateError: { @@ -7,4 +7,4 @@ module.exports = { '"none" was specified for "output.exports", but entry module "main.js" has the following exports: "default"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/export-type-mismatch/_config.js b/test/function/samples/export-type-mismatch/_config.js index d407bd29665..ff7f55fb83b 100644 --- a/test/function/samples/export-type-mismatch/_config.js +++ b/test/function/samples/export-type-mismatch/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'cannot have named exports if explicit export type is default', options: { output: { exports: 'default' } }, generateError: { @@ -7,4 +7,4 @@ module.exports = { '"default" was specified for "output.exports", but entry module "main.js" has the following exports: "foo"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/exports-flag-allowed-in-options/_config.js b/test/function/samples/exports-flag-allowed-in-options/_config.js index 3d14f61d542..4ec097478a8 100644 --- a/test/function/samples/exports-flag-allowed-in-options/_config.js +++ b/test/function/samples/exports-flag-allowed-in-options/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports flag is passed through to bundle options', options: { output: { exports: 'named' } @@ -9,4 +9,4 @@ module.exports = { assert.equal(exports.y, 42); assert.ok(!('x' in exports)); } -}; +}); diff --git a/test/function/samples/exports-named-values/_config.js b/test/function/samples/exports-named-values/_config.js index 543d0e07458..c14ac2da2a4 100644 --- a/test/function/samples/exports-named-values/_config.js +++ b/test/function/samples/exports-named-values/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'exports named values from the bundle entry module', exports(exports) { assert.equal(exports.answer, 42); } -}; +}); diff --git a/test/function/samples/external-alias-parent/_config.js b/test/function/samples/external-alias-parent/_config.js index ef245b089ef..00ce290e63c 100644 --- a/test/function/samples/external-alias-parent/_config.js +++ b/test/function/samples/external-alias-parent/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes an external module included dynamically by an alias', options: { input: path.join(__dirname, 'first', 'main.js'), @@ -28,4 +28,4 @@ module.exports = { return 1; } } -}; +}); diff --git a/test/function/samples/external-alias/_config.js b/test/function/samples/external-alias/_config.js index 926b11ca619..179e6d925d8 100644 --- a/test/function/samples/external-alias/_config.js +++ b/test/function/samples/external-alias/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes an external module included dynamically by an alias', options: { input: path.join(__dirname, 'first', 'main.js'), @@ -25,4 +25,4 @@ module.exports = { return 1; } } -}; +}); diff --git a/test/function/samples/external-conflict/_config.js b/test/function/samples/external-conflict/_config.js index fdcb29b8656..372c4c7c5d9 100644 --- a/test/function/samples/external-conflict/_config.js +++ b/test/function/samples/external-conflict/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'external paths from custom resolver remain external (#633)', options: { external: (_id, parent) => parent === 'dep', @@ -22,4 +22,4 @@ module.exports = { message: '"dep" is imported as an external by "dep", but is already an existing non-external module id.' } -}; +}); diff --git a/test/function/samples/external-directory-import/_config.js b/test/function/samples/external-directory-import/_config.js index 1a715a7be12..ca23b880156 100644 --- a/test/function/samples/external-directory-import/_config.js +++ b/test/function/samples/external-directory-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles using ../ as external import (#4349)', options: { external() { @@ -8,4 +8,4 @@ module.exports = { context: { require: id => id } -}; +}); diff --git a/test/function/samples/external-dynamic-import-live-binding-compact/_config.js b/test/function/samples/external-dynamic-import-live-binding-compact/_config.js index e1306031240..9601e9279e4 100644 --- a/test/function/samples/external-dynamic-import-live-binding-compact/_config.js +++ b/test/function/samples/external-dynamic-import-live-binding-compact/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports external dynamic imports with live bindings in compact mode', options: { external() { @@ -75,4 +75,4 @@ module.exports = { assert.strictEqual(results[3].default.otherValue, 4); }); } -}; +}); diff --git a/test/function/samples/external-dynamic-import-live-binding/_config.js b/test/function/samples/external-dynamic-import-live-binding/_config.js index 97f37b77f5b..8c77233964c 100644 --- a/test/function/samples/external-dynamic-import-live-binding/_config.js +++ b/test/function/samples/external-dynamic-import-live-binding/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports external dynamic imports with live bindings', options: { external() { @@ -71,4 +71,4 @@ module.exports = { assert.strictEqual(results[3].default.otherValue, 4); }); } -}; +}); diff --git a/test/function/samples/external-entry-point-object/_config.js b/test/function/samples/external-entry-point-object/_config.js index 5b74aaf2dc9..4618a0f27a5 100644 --- a/test/function/samples/external-entry-point-object/_config.js +++ b/test/function/samples/external-entry-point-object/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for entry points that are resolved as an external object by plugins', options: { plugins: { @@ -11,4 +11,4 @@ module.exports = { code: 'UNRESOLVED_ENTRY', message: 'Entry module "main.js" cannot be external.' } -}; +}); diff --git a/test/function/samples/external-entry-point/_config.js b/test/function/samples/external-entry-point/_config.js index 1e7921b6115..bfaa5d82286 100644 --- a/test/function/samples/external-entry-point/_config.js +++ b/test/function/samples/external-entry-point/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for entry points that are resolved as false by plugins', options: { plugins: { @@ -11,4 +11,4 @@ module.exports = { code: 'UNRESOLVED_ENTRY', message: 'Entry module "main.js" cannot be external.' } -}; +}); diff --git a/test/function/samples/external-function-always-true/_config.js b/test/function/samples/external-function-always-true/_config.js index b95854bc955..4cf8147cb3d 100644 --- a/test/function/samples/external-function-always-true/_config.js +++ b/test/function/samples/external-function-always-true/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Does not call external for entry point', options: { external(id, parentId) { @@ -6,4 +6,4 @@ module.exports = { return true; } } -}; +}); diff --git a/test/function/samples/external-function/_config.js b/test/function/samples/external-function/_config.js index 05832e1686a..b795ca84f90 100644 --- a/test/function/samples/external-function/_config.js +++ b/test/function/samples/external-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows external option to be a function (#522)', options: { external: id => id === 'external' @@ -9,4 +9,4 @@ module.exports = { return require(id); } } -}; +}); diff --git a/test/function/samples/external-ids-not-resolved/_config.js b/test/function/samples/external-ids-not-resolved/_config.js index 10982d1af3e..aa1c6979162 100644 --- a/test/function/samples/external-ids-not-resolved/_config.js +++ b/test/function/samples/external-ids-not-resolved/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not attempt to resolve external IDs', options: { external: ['external'], @@ -12,4 +12,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/external-ignore-reserved-null-marker/_config.js b/test/function/samples/external-ignore-reserved-null-marker/_config.js index cf06a0c0a5b..9af6e35ef9f 100644 --- a/test/function/samples/external-ignore-reserved-null-marker/_config.js +++ b/test/function/samples/external-ignore-reserved-null-marker/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'external function ignores \\0 started ids', options: { external(id) { @@ -26,4 +26,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/external-live-binding-compact/_config.js b/test/function/samples/external-live-binding-compact/_config.js index 3b3d29b06d4..f2f087dc7bb 100644 --- a/test/function/samples/external-live-binding-compact/_config.js +++ b/test/function/samples/external-live-binding-compact/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles external live-bindings', options: { external: ['named', 'star'], @@ -42,4 +42,4 @@ module.exports = { exports.incrementStar(); assert.equal(exports.star, 1, 'star'); } -}; +}); diff --git a/test/function/samples/external-live-binding/_config.js b/test/function/samples/external-live-binding/_config.js index 4b5cad7cfcb..fdfbcd3d435 100644 --- a/test/function/samples/external-live-binding/_config.js +++ b/test/function/samples/external-live-binding/_config.js @@ -4,7 +4,7 @@ let named; let star; let defaulted; -module.exports = { +module.exports = defineTest({ description: 'handles external live-bindings', options: { external: ['named', 'star', 'defaulted'], @@ -57,4 +57,4 @@ module.exports = { // make sure the default is not reexported assert.equal(exports.default, undefined); } -}; +}); diff --git a/test/function/samples/external-normalization/_config.js b/test/function/samples/external-normalization/_config.js index 56ae23974c2..94f4a0674bf 100644 --- a/test/function/samples/external-normalization/_config.js +++ b/test/function/samples/external-normalization/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'external paths from custom resolver remain external (#633)', options: { external: ['path'], @@ -17,4 +17,4 @@ module.exports = { exports: exports => { assert.equal(exports, path.resolve); } -}; +}); diff --git a/test/function/samples/external-regex-array/_config.js b/test/function/samples/external-regex-array/_config.js index 44c7fed70dc..7e4d1e16d6a 100644 --- a/test/function/samples/external-regex-array/_config.js +++ b/test/function/samples/external-regex-array/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows external option to be an array of regex and strings', options: { external: [/external/, 'other'] @@ -10,4 +10,4 @@ module.exports = { return require(id); } } -}; +}); diff --git a/test/function/samples/external-regex/_config.js b/test/function/samples/external-regex/_config.js index 6be55508350..8dc20af4a7b 100644 --- a/test/function/samples/external-regex/_config.js +++ b/test/function/samples/external-regex/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows external option to be a regex', options: { external: /external/ @@ -9,4 +9,4 @@ module.exports = { return require(id); } } -}; +}); diff --git a/test/function/samples/external-resolve-false/_config.js b/test/function/samples/external-resolve-false/_config.js index ec25513d0ec..51a23830865 100644 --- a/test/function/samples/external-resolve-false/_config.js +++ b/test/function/samples/external-resolve-false/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'includes an external module with a false resolve return', options: { input: 'main.js', @@ -18,4 +18,4 @@ module.exports = { return 1; } } -}; +}); diff --git a/test/function/samples/external-resolved/_config.js b/test/function/samples/external-resolved/_config.js index 7bd52013841..9e00a9bac9b 100644 --- a/test/function/samples/external-resolved/_config.js +++ b/test/function/samples/external-resolved/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const testedIds = []; -module.exports = { +module.exports = defineTest({ description: 'passes both unresolved and resolved ids to the external option', context: { require() { @@ -53,4 +53,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/externally-reassigned-default-exports/_config.js b/test/function/samples/externally-reassigned-default-exports/_config.js index e753654ccb5..e360e0e8bfc 100644 --- a/test/function/samples/externally-reassigned-default-exports/_config.js +++ b/test/function/samples/externally-reassigned-default-exports/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'calls to externally reassigned methods of default exports must be retained', exports(exports) { let triggered = false; @@ -10,4 +10,4 @@ module.exports = { exports.test(); assert.ok(triggered); } -}; +}); diff --git a/test/function/samples/externally-reassigned-globals/_config.js b/test/function/samples/externally-reassigned-globals/_config.js index 10c9e3ed99b..387c8ed9793 100644 --- a/test/function/samples/externally-reassigned-globals/_config.js +++ b/test/function/samples/externally-reassigned-globals/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'calls to externally reassigned global methods must be retained', exports(exports) { let triggered1 = false; @@ -20,4 +20,4 @@ module.exports = { assert.ok(triggered1); assert.ok(triggered2); } -}; +}); diff --git a/test/function/samples/externally-reassigned-named-exports/_config.js b/test/function/samples/externally-reassigned-named-exports/_config.js index 4ecd09cb041..1ee23f4b552 100644 --- a/test/function/samples/externally-reassigned-named-exports/_config.js +++ b/test/function/samples/externally-reassigned-named-exports/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'calls to externally reassigned methods of named exports must be retained', exports(exports) { let triggered1 = false; @@ -16,4 +16,4 @@ module.exports = { assert.ok(triggered1); assert.ok(triggered2); } -}; +}); diff --git a/test/function/samples/externally-reassigned-named-reexports/_config.js b/test/function/samples/externally-reassigned-named-reexports/_config.js index 8515722136d..15fab6b87eb 100644 --- a/test/function/samples/externally-reassigned-named-reexports/_config.js +++ b/test/function/samples/externally-reassigned-named-reexports/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'calls to externally reassigned methods of named reexports must be retained', exports(exports) { let triggered = false; @@ -10,4 +10,4 @@ module.exports = { exports.test(); assert.ok(triggered); } -}; +}); diff --git a/test/function/samples/externally-reassigned-star-reexports/_config.js b/test/function/samples/externally-reassigned-star-reexports/_config.js index 6016153ed1b..c726c1ae3e4 100644 --- a/test/function/samples/externally-reassigned-star-reexports/_config.js +++ b/test/function/samples/externally-reassigned-star-reexports/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'calls to externally reassigned methods of namespace reexports must be retained', exports(exports) { let triggered = false; @@ -10,4 +10,4 @@ module.exports = { exports.test(); assert.ok(triggered); } -}; +}); diff --git a/test/function/samples/facade-reexports/_config.js b/test/function/samples/facade-reexports/_config.js index dfbe2cb222e..4144e6becf4 100644 --- a/test/function/samples/facade-reexports/_config.js +++ b/test/function/samples/facade-reexports/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles reexports when creating a facade chunk and transitive dependencies are not hoisted', options: { @@ -13,4 +13,4 @@ module.exports = { assert.strictEqual(exports.external, true); assert.strictEqual(await exports.dynamic(), 'liblib'); } -}; +}); diff --git a/test/function/samples/fallback-on-warn/_config.js b/test/function/samples/fallback-on-warn/_config.js index ed2796c8ddf..78737c182a3 100644 --- a/test/function/samples/fallback-on-warn/_config.js +++ b/test/function/samples/fallback-on-warn/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); let oldConsoleWarn; const warnings = []; -module.exports = { +module.exports = defineTest({ description: 'logs as a fallback if no onwarn handler is provided', options: { onwarn: null @@ -17,4 +17,4 @@ module.exports = { 'Use of eval in "main.js" is strongly discouraged as it poses security risks and may cause issues with minification.' ]); } -}; +}); diff --git a/test/function/samples/file-and-dir/_config.js b/test/function/samples/file-and-dir/_config.js index ebcb5c78b91..80213977ca9 100644 --- a/test/function/samples/file-and-dir/_config.js +++ b/test/function/samples/file-and-dir/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using both the file and the dir option', options: { output: { file: 'bundle.js', dir: 'dist' } @@ -9,4 +9,4 @@ module.exports = { 'Invalid value for option "output.dir" - you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks.', url: 'https://rollupjs.org/configuration-options/#output-dir' } -}; +}); diff --git a/test/function/samples/for-in-accessors/_config.js b/test/function/samples/for-in-accessors/_config.js index 70c608f68b2..74c22c4655b 100644 --- a/test/function/samples/for-in-accessors/_config.js +++ b/test/function/samples/for-in-accessors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes "this" for accessors triggered by for-in loops' -}; +}); diff --git a/test/function/samples/for-in-loop-head-dependencies/_config.js b/test/function/samples/for-in-loop-head-dependencies/_config.js index cb555be06af..98cc663fd7d 100644 --- a/test/function/samples/for-in-loop-head-dependencies/_config.js +++ b/test/function/samples/for-in-loop-head-dependencies/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses parent scope for right-hand-side in for-in statement (#1480)' -}; +}); diff --git a/test/function/samples/for-loop-head-dependencies/_config.js b/test/function/samples/for-loop-head-dependencies/_config.js index cdd3321626f..b215e966462 100644 --- a/test/function/samples/for-loop-head-dependencies/_config.js +++ b/test/function/samples/for-loop-head-dependencies/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses correct scope in for statement (#1538)' -}; +}); diff --git a/test/function/samples/for-loop-parameter/_config.js b/test/function/samples/for-loop-parameter/_config.js index faea21cac26..5b608c21d64 100644 --- a/test/function/samples/for-loop-parameter/_config.js +++ b/test/function/samples/for-loop-parameter/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'includes for-loop parameters', exports({ checkObject, checkArray }) { assert.strictEqual(checkObject({ foo: 1 }), 1, 'object'); assert.strictEqual(checkArray([2]), 2, 'array'); } -}; +}); diff --git a/test/function/samples/for-loops-as-assignments/_config.js b/test/function/samples/for-loops-as-assignments/_config.js index 4ba53db414c..1b166fb4b5d 100644 --- a/test/function/samples/for-loops-as-assignments/_config.js +++ b/test/function/samples/for-loops-as-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'make sure for loops are counted as variable assignments (#2199)' -}; +}); diff --git a/test/function/samples/for-of-accessors/_config.js b/test/function/samples/for-of-accessors/_config.js index e54f1f0ac4c..768c251a6c8 100644 --- a/test/function/samples/for-of-accessors/_config.js +++ b/test/function/samples/for-of-accessors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes "this" for accessors triggered by for-of loops' -}; +}); diff --git a/test/function/samples/for-of-loop-head-dependencies/_config.js b/test/function/samples/for-of-loop-head-dependencies/_config.js index 24bba078afc..10a5199dde4 100644 --- a/test/function/samples/for-of-loop-head-dependencies/_config.js +++ b/test/function/samples/for-of-loop-head-dependencies/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses parent scope for right-hand-side in for-of statement (#1539)' -}; +}); diff --git a/test/function/samples/for-of-with-in-operator/_config.js b/test/function/samples/for-of-with-in-operator/_config.js index 721aac80114..cde77532f9c 100644 --- a/test/function/samples/for-of-with-in-operator/_config.js +++ b/test/function/samples/for-of-with-in-operator/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles using the in operator in the iterator of a for-of loop (#2337)' -}; +}); diff --git a/test/function/samples/function-asm-directive/_config.js b/test/function/samples/function-asm-directive/_config.js index 6160aa97060..b1180a59f11 100644 --- a/test/function/samples/function-asm-directive/_config.js +++ b/test/function/samples/function-asm-directive/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: "shouldn't delete use asm from the start of a function body", code(code) { assert.notEqual(code.indexOf('use asm'), -1); } -}; +}); diff --git a/test/function/samples/function-directive-not-first/_config.js b/test/function/samples/function-directive-not-first/_config.js index 8afaeb64093..7a4a593c3c9 100644 --- a/test/function/samples/function-directive-not-first/_config.js +++ b/test/function/samples/function-directive-not-first/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'should delete use asm from function body if it is not the first expression', code(code) { assert.ok(!code.includes('use asm')); } -}; +}); diff --git a/test/function/samples/function-expressions-simplified-to-statement/_config.js b/test/function/samples/function-expressions-simplified-to-statement/_config.js index 2a43659a713..46403b4721d 100644 --- a/test/function/samples/function-expressions-simplified-to-statement/_config.js +++ b/test/function/samples/function-expressions-simplified-to-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly handles function expressions which are simplified to statements' -}; +}); diff --git a/test/function/samples/function-getter-side-effects/_config.js b/test/function/samples/function-getter-side-effects/_config.js index 904e3d0e679..54e6d953558 100644 --- a/test/function/samples/function-getter-side-effects/_config.js +++ b/test/function/samples/function-getter-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'respects getters created on functions' -}; +}); diff --git a/test/function/samples/function-side-effects/_config.js b/test/function/samples/function-side-effects/_config.js index cdbb6090e71..5752f688a50 100644 --- a/test/function/samples/function-side-effects/_config.js +++ b/test/function/samples/function-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'assumes functions may mutate objects passed in' -}; +}); diff --git a/test/function/samples/function-use-strict-directive-removed/_config.js b/test/function/samples/function-use-strict-directive-removed/_config.js index fb5a895e896..412c158b82f 100644 --- a/test/function/samples/function-use-strict-directive-removed/_config.js +++ b/test/function/samples/function-use-strict-directive-removed/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'should delete use strict from function body', code(code) { assert.equal(code.lastIndexOf('use strict'), 1); } -}; +}); diff --git a/test/function/samples/functions-renamed-correctly/_config.js b/test/function/samples/functions-renamed-correctly/_config.js index b0719a05d4e..c9824eb0d8f 100644 --- a/test/function/samples/functions-renamed-correctly/_config.js +++ b/test/function/samples/functions-renamed-correctly/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'renames function expression IDs correctly' -}; +}); diff --git a/test/function/samples/generate-bundle-mutation/_config.js b/test/function/samples/generate-bundle-mutation/_config.js index 04bddc406a6..83085e18144 100644 --- a/test/function/samples/generate-bundle-mutation/_config.js +++ b/test/function/samples/generate-bundle-mutation/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles adding or deleting symbols in generateBundle', options: { plugins: [ @@ -12,4 +12,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/globally-called-modifying-function/_config.js b/test/function/samples/globally-called-modifying-function/_config.js index 86b2f620dbd..b4b847d500a 100644 --- a/test/function/samples/globally-called-modifying-function/_config.js +++ b/test/function/samples/globally-called-modifying-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'globally called function should be included if it modifies an exported value (#112)' -}; +}); diff --git a/test/function/samples/handle-calling-uncallable/_config.js b/test/function/samples/handle-calling-uncallable/_config.js index 74b7d983f48..0f3939a476b 100644 --- a/test/function/samples/handle-calling-uncallable/_config.js +++ b/test/function/samples/handle-calling-uncallable/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not give cryptic error when calling uncallable things (#1257)' -}; +}); diff --git a/test/function/samples/handle-labels-inside-functions/_config.js b/test/function/samples/handle-labels-inside-functions/_config.js index ca46e3f11ec..35cd1299978 100644 --- a/test/function/samples/handle-labels-inside-functions/_config.js +++ b/test/function/samples/handle-labels-inside-functions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not fail when using labels inside functions (#1706)' -}; +}); diff --git a/test/function/samples/handle-missing-export-source/_config.js b/test/function/samples/handle-missing-export-source/_config.js index 0488306701a..80f965ccb04 100644 --- a/test/function/samples/handle-missing-export-source/_config.js +++ b/test/function/samples/handle-missing-export-source/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not fail if a pre-generated AST is omitting the source property of an unused named export (#3210)', options: { @@ -12,4 +12,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/handle-object-rest-spread-patterns/_config.js b/test/function/samples/handle-object-rest-spread-patterns/_config.js index 33660506b71..d0f87e8bd68 100644 --- a/test/function/samples/handle-object-rest-spread-patterns/_config.js +++ b/test/function/samples/handle-object-rest-spread-patterns/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles properties created by an object rest spread operator' -}; +}); diff --git a/test/function/samples/handle-object-rest-spread-properties/_config.js b/test/function/samples/handle-object-rest-spread-properties/_config.js index 33660506b71..d0f87e8bd68 100644 --- a/test/function/samples/handle-object-rest-spread-properties/_config.js +++ b/test/function/samples/handle-object-rest-spread-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles properties created by an object rest spread operator' -}; +}); diff --git a/test/function/samples/handle-object-rest-spread-reassigments/_config.js b/test/function/samples/handle-object-rest-spread-reassigments/_config.js index 33660506b71..d0f87e8bd68 100644 --- a/test/function/samples/handle-object-rest-spread-reassigments/_config.js +++ b/test/function/samples/handle-object-rest-spread-reassigments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles properties created by an object rest spread operator' -}; +}); diff --git a/test/function/samples/handle-statically-resolvable-if-statements/_config.js b/test/function/samples/handle-statically-resolvable-if-statements/_config.js index bf7be5e68c6..7ea2bbd27be 100644 --- a/test/function/samples/handle-statically-resolvable-if-statements/_config.js +++ b/test/function/samples/handle-statically-resolvable-if-statements/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles statically resolvable "if" statements (#2134)', context: { value: 1 @@ -8,4 +8,4 @@ module.exports = { exports({ x }) { assert.equal(x, 1); } -}; +}); diff --git a/test/function/samples/handles-double-declarations/_config.js b/test/function/samples/handles-double-declarations/_config.js index bbeffbcd1d1..054fa15679a 100644 --- a/test/function/samples/handles-double-declarations/_config.js +++ b/test/function/samples/handles-double-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not fail for double declarations with initializers from other modules' -}; +}); diff --git a/test/function/samples/handles-empty-string-sourcemap-mappings/_config.js b/test/function/samples/handles-empty-string-sourcemap-mappings/_config.js index 764c77a324a..1e6ea8a6311 100644 --- a/test/function/samples/handles-empty-string-sourcemap-mappings/_config.js +++ b/test/function/samples/handles-empty-string-sourcemap-mappings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles transforms that return sourcemap with empty mappings', options: { @@ -15,4 +15,4 @@ module.exports = { // ensure source maps are generated output: { sourcemap: true } } -}; +}); diff --git a/test/function/samples/handles-stringified-sourcemaps/_config.js b/test/function/samples/handles-stringified-sourcemaps/_config.js index cf7ff1e18c1..b8a91a55b82 100644 --- a/test/function/samples/handles-stringified-sourcemaps/_config.js +++ b/test/function/samples/handles-stringified-sourcemaps/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles transforms that return stringified source maps (#377)', options: { @@ -16,4 +16,4 @@ module.exports = { // ensure source maps are generated output: { sourcemap: true } } -}; +}); diff --git a/test/function/samples/has-default-export/_config.js b/test/function/samples/has-default-export/_config.js index 9f99c50b9f4..c90fb861252 100644 --- a/test/function/samples/has-default-export/_config.js +++ b/test/function/samples/has-default-export/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'reports if a module has a default export', options: { plugins: [ @@ -42,4 +42,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/has-modules-array/_config.js b/test/function/samples/has-modules-array/_config.js index c56b1cc9d2a..61bd8a5fd1a 100644 --- a/test/function/samples/has-modules-array/_config.js +++ b/test/function/samples/has-modules-array/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'user-facing bundle has modules array', bundle(bundle) { assert.ok(bundle.cache.modules); @@ -9,4 +9,4 @@ module.exports = { assert.equal(path.relative(bundle.cache.modules[0].id, path.join(__dirname, 'foo.js')), ''); assert.equal(path.relative(bundle.cache.modules[1].id, path.join(__dirname, 'main.js')), ''); } -}; +}); diff --git a/test/function/samples/hashing/length-at-non-hash/_config.js b/test/function/samples/hashing/length-at-non-hash/_config.js index be57051eb69..2e40dbf8c52 100644 --- a/test/function/samples/hashing/length-at-non-hash/_config.js +++ b/test/function/samples/hashing/length-at-non-hash/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when configuring a length for placeholder other than "hash"', options: { output: { chunkFileNames: '[name:3].js' } }, generateError: { code: 'VALIDATION_ERROR', message: '"[name:3]" is not a valid placeholder in the "output.chunkFileNames" pattern.' } -}; +}); diff --git a/test/function/samples/hashing/maximum-hash-size/_config.js b/test/function/samples/hashing/maximum-hash-size/_config.js index 4818302d041..fb8159901df 100644 --- a/test/function/samples/hashing/maximum-hash-size/_config.js +++ b/test/function/samples/hashing/maximum-hash-size/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when the maximum hash size is exceeded', options: { output: { chunkFileNames: '[hash:65].js' } }, generateError: { @@ -6,4 +6,4 @@ module.exports = { message: 'Hashes cannot be longer than 64 characters, received 65. Check the "output.chunkFileNames" option.' } -}; +}); diff --git a/test/function/samples/hashing/minimum-hash-size/_config.js b/test/function/samples/hashing/minimum-hash-size/_config.js index 9ef9dfcf253..b5500a3be19 100644 --- a/test/function/samples/hashing/minimum-hash-size/_config.js +++ b/test/function/samples/hashing/minimum-hash-size/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when the maximum hash size is exceeded', options: { output: { chunkFileNames: '[hash:3].js' } }, generateError: { @@ -6,4 +6,4 @@ module.exports = { message: 'To generate hashes for this number of chunks (currently 1), you need a minimum hash size of 6, received 3. Check the "output.chunkFileNames" option.' } -}; +}); diff --git a/test/function/samples/hidden-directories/_config.js b/test/function/samples/hidden-directories/_config.js index 80cd78429a6..d8927e53f72 100644 --- a/test/function/samples/hidden-directories/_config.js +++ b/test/function/samples/hidden-directories/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows imports from directories with leading "." character' -}; +}); diff --git a/test/function/samples/hoisted-variable-if-else/_config.js b/test/function/samples/hoisted-variable-if-else/_config.js index fac4e9a21f7..16dce08e17c 100644 --- a/test/function/samples/hoisted-variable-if-else/_config.js +++ b/test/function/samples/hoisted-variable-if-else/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles hoisted variables in chained if statements', exports(exports) { exports.test(true); @@ -10,4 +10,4 @@ module.exports = { exports.test('loop'); assert.strictEqual(exports.result, 'fourth'); } -}; +}); diff --git a/test/function/samples/identifiers-in-template-literals/_config.js b/test/function/samples/identifiers-in-template-literals/_config.js index 8b031cdab65..0e5cdcad754 100644 --- a/test/function/samples/identifiers-in-template-literals/_config.js +++ b/test/function/samples/identifiers-in-template-literals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'identifiers in template literals are rendered correctly' -}; +}); diff --git a/test/function/samples/if-statement-insert-whitespace/_config.js b/test/function/samples/if-statement-insert-whitespace/_config.js index 22b005eccbd..ea2b1b462d3 100644 --- a/test/function/samples/if-statement-insert-whitespace/_config.js +++ b/test/function/samples/if-statement-insert-whitespace/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'inserts necessary white-space when simplifying if-statements (#3419)', options: { external: 'external' @@ -8,4 +8,4 @@ module.exports = { return false; } } -}; +}); diff --git a/test/function/samples/if-statement-with-assignment/_config.js b/test/function/samples/if-statement-with-assignment/_config.js index 6c573d5e7bf..2f41d0cbbb4 100644 --- a/test/function/samples/if-statement-with-assignment/_config.js +++ b/test/function/samples/if-statement-with-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'update assignments to names are preserved (#930)' -}; +}); diff --git a/test/function/samples/if-statement-with-false-condition/_config.js b/test/function/samples/if-statement-with-false-condition/_config.js index b7eda7a022f..19caab3443b 100644 --- a/test/function/samples/if-statement-with-false-condition/_config.js +++ b/test/function/samples/if-statement-with-false-condition/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'if statements with false condition do not break render (#973)' -}; +}); diff --git a/test/function/samples/if-statement-with-update/_config.js b/test/function/samples/if-statement-with-update/_config.js index 8601e12f716..65771fc03e0 100644 --- a/test/function/samples/if-statement-with-update/_config.js +++ b/test/function/samples/if-statement-with-update/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'updates to names are preserved (#930)' -}; +}); diff --git a/test/function/samples/iife-code-splitting/_config.js b/test/function/samples/iife-code-splitting/_config.js index 0387086aeff..5544f274155 100644 --- a/test/function/samples/iife-code-splitting/_config.js +++ b/test/function/samples/iife-code-splitting/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when generating multiple chunks for an IIFE build', options: { output: { format: 'iife' } @@ -9,4 +9,4 @@ module.exports = { 'Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.', url: 'https://rollupjs.org/configuration-options/#output-format' } -}; +}); diff --git a/test/function/samples/iife-comments/_config.js b/test/function/samples/iife-comments/_config.js index 05b3fd9eaf0..911aadc6933 100644 --- a/test/function/samples/iife-comments/_config.js +++ b/test/function/samples/iife-comments/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not wrongly append comments', exports(exports) { assert.equal(exports, 42); } -}; +}); diff --git a/test/function/samples/implicit-dependencies/dependant-dynamic-import-no-effects/_config.js b/test/function/samples/implicit-dependencies/dependant-dynamic-import-no-effects/_config.js index a7ef8d81401..e9ad92105a8 100644 --- a/test/function/samples/implicit-dependencies/dependant-dynamic-import-no-effects/_config.js +++ b/test/function/samples/implicit-dependencies/dependant-dynamic-import-no-effects/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module that is loaded before an emitted chunk is fully tree-shaken', options: { plugins: { @@ -24,4 +24,4 @@ module.exports = { path.join(__dirname, 'main.js') ] } -}; +}); diff --git a/test/function/samples/implicit-dependencies/dependant-dynamic-import-not-included/_config.js b/test/function/samples/implicit-dependencies/dependant-dynamic-import-not-included/_config.js index a9b8c3fe35c..fbc85389ebf 100644 --- a/test/function/samples/implicit-dependencies/dependant-dynamic-import-not-included/_config.js +++ b/test/function/samples/implicit-dependencies/dependant-dynamic-import-not-included/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module that is loaded before an emitted chunk is only linked to the module graph via a tree-shaken dynamic import', options: { @@ -31,4 +31,4 @@ module.exports = { path.join(__dirname, 'main.js') ] } -}; +}); diff --git a/test/function/samples/implicit-dependencies/dependant-not-part-of-graph/_config.js b/test/function/samples/implicit-dependencies/dependant-not-part-of-graph/_config.js index 40c777629af..1239ea0e146 100644 --- a/test/function/samples/implicit-dependencies/dependant-not-part-of-graph/_config.js +++ b/test/function/samples/implicit-dependencies/dependant-not-part-of-graph/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module that is loaded before an emitted chunk is not part of the module graph', options: { @@ -37,4 +37,4 @@ module.exports = { path.join(__dirname, 'main.js') ] } -}; +}); diff --git a/test/function/samples/implicit-dependencies/external-dependant/_config.js b/test/function/samples/implicit-dependencies/external-dependant/_config.js index 4f8b9d9b40c..41d77574084 100644 --- a/test/function/samples/implicit-dependencies/external-dependant/_config.js +++ b/test/function/samples/implicit-dependencies/external-dependant/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module that is loaded before an emitted chunk does not exist', options: { plugins: { @@ -20,4 +20,4 @@ module.exports = { 'Module "does-not-exist" that should be implicitly loaded before "dep.js" could not be resolved.', watchFiles: [path.join(__dirname, 'dep.js'), path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/implicit-dependencies/missing-dependant/_config.js b/test/function/samples/implicit-dependencies/missing-dependant/_config.js index 10de97d4156..3b833ff0552 100644 --- a/test/function/samples/implicit-dependencies/missing-dependant/_config.js +++ b/test/function/samples/implicit-dependencies/missing-dependant/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module that is loaded before an emitted chunk is external', options: { plugins: { @@ -25,4 +25,4 @@ module.exports = { 'Module "external" that should be implicitly loaded before "dep.js" cannot be external.', watchFiles: [path.join(__dirname, 'dep.js'), path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/import-as/_config.js b/test/function/samples/import-as/_config.js index 7831d8cd02b..d54b17334d1 100644 --- a/test/function/samples/import-as/_config.js +++ b/test/function/samples/import-as/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'renames named and default imports' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/import-as diff --git a/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js b/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js index 6601996faf3..fa8f8b69e1b 100644 --- a/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js +++ b/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows plugins to provide assertions for this.resolve', options: { plugins: [ @@ -46,4 +46,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/import-assertions/warn-assertion-conflicts/_config.js b/test/function/samples/import-assertions/warn-assertion-conflicts/_config.js index 868006d6e99..45bfe811da1 100644 --- a/test/function/samples/import-assertions/warn-assertion-conflicts/_config.js +++ b/test/function/samples/import-assertions/warn-assertion-conflicts/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for conflicting import assertions', options: { external: id => id.startsWith('external') @@ -61,4 +61,4 @@ module.exports = { 'Module "other.js" tried to import "dep.js" with "type": "bar" assertions, but it was already imported elsewhere with "type": "foo" assertions. Please ensure that import assertions for the same module are always consistent.' } ] -}; +}); diff --git a/test/function/samples/import-binding/_config.js b/test/function/samples/import-binding/_config.js index d4f7a763af0..bb0c9aff598 100644 --- a/test/function/samples/import-binding/_config.js +++ b/test/function/samples/import-binding/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'import binding' -}; +}); diff --git a/test/function/samples/import-chain-as/_config.js b/test/function/samples/import-chain-as/_config.js index 9294fd44fba..e63edbe8fa0 100644 --- a/test/function/samples/import-chain-as/_config.js +++ b/test/function/samples/import-chain-as/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports as- chained exports' -}; +}); diff --git a/test/function/samples/import-chain/_config.js b/test/function/samples/import-chain/_config.js index c6c7a1b124a..34b4702f62e 100644 --- a/test/function/samples/import-chain/_config.js +++ b/test/function/samples/import-chain/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports chained exports' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/import-chain diff --git a/test/function/samples/import-default-and-named-function/_config.js b/test/function/samples/import-default-and-named-function/_config.js index bd54c449dd1..56341431d1c 100644 --- a/test/function/samples/import-default-and-named-function/_config.js +++ b/test/function/samples/import-default-and-named-function/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports default and named exports in same declaration' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-default-named-function diff --git a/test/function/samples/import-default-as-named/_config.js b/test/function/samples/import-default-as-named/_config.js index e11a2ea1a4d..524fc8bdc2a 100644 --- a/test/function/samples/import-default-as-named/_config.js +++ b/test/function/samples/import-default-as-named/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a default export by a name' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-default-function diff --git a/test/function/samples/import-default-as-other/_config.js b/test/function/samples/import-default-as-other/_config.js index cb7290bd926..0223a0de039 100644 --- a/test/function/samples/import-default-as-other/_config.js +++ b/test/function/samples/import-default-as-other/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a default import by another name' -}; +}); diff --git a/test/function/samples/import-default-class/_config.js b/test/function/samples/import-default-class/_config.js index becd71d101f..c5b4da3743a 100644 --- a/test/function/samples/import-default-class/_config.js +++ b/test/function/samples/import-default-class/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a default class' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-default-class diff --git a/test/function/samples/import-default-expression/_config.js b/test/function/samples/import-default-expression/_config.js index b43e8e08046..24227282531 100644 --- a/test/function/samples/import-default-expression/_config.js +++ b/test/function/samples/import-default-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a default expression' -}; +}); diff --git a/test/function/samples/import-default-from-external/_config.js b/test/function/samples/import-default-from-external/_config.js index 9120a3063c3..5dc0683e7db 100644 --- a/test/function/samples/import-default-from-external/_config.js +++ b/test/function/samples/import-default-from-external/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'imports default from external module', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/import-default-function/_config.js b/test/function/samples/import-default-function/_config.js index 77dea2133f8..418b9d421e9 100644 --- a/test/function/samples/import-default-function/_config.js +++ b/test/function/samples/import-default-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a default function' -}; +}); diff --git a/test/function/samples/import-dependency-in-other-module/_config.js b/test/function/samples/import-dependency-in-other-module/_config.js index b29eec89fc9..5daebf9f5e3 100644 --- a/test/function/samples/import-dependency-in-other-module/_config.js +++ b/test/function/samples/import-dependency-in-other-module/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a dependency from a separate module' -}; +}); diff --git a/test/function/samples/import-dependency-in-same-module/_config.js b/test/function/samples/import-dependency-in-same-module/_config.js index a08ff3cdab7..c77b1524141 100644 --- a/test/function/samples/import-dependency-in-same-module/_config.js +++ b/test/function/samples/import-dependency-in-same-module/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a dependency from the same module' -}; +}); diff --git a/test/function/samples/import-empty-from-external/_config.js b/test/function/samples/import-empty-from-external/_config.js index 80c91ae85a9..0727f120eed 100644 --- a/test/function/samples/import-empty-from-external/_config.js +++ b/test/function/samples/import-empty-from-external/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'imports external module for side effects', context: { // override require here, making "foo" appear as a global module @@ -12,4 +12,4 @@ module.exports = { options: { external: ['foo'] } -}; +}); diff --git a/test/function/samples/import-meta-url/_config.js b/test/function/samples/import-meta-url/_config.js index 5e9754545a9..e64f382480d 100644 --- a/test/function/samples/import-meta-url/_config.js +++ b/test/function/samples/import-meta-url/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const URL = require('node:url').URL; -module.exports = { +module.exports = defineTest({ description: 'resolves import.meta.url', context: { __filename: path.join(__dirname, 'main.js') @@ -10,4 +10,4 @@ module.exports = { exports(exports) { assert.strictEqual(exports, new URL('file:' + path.join(__dirname, 'main.js')).href); } -}; +}); diff --git a/test/function/samples/import-named-class/_config.js b/test/function/samples/import-named-class/_config.js index 60ebeda4bf6..df42f64087a 100644 --- a/test/function/samples/import-named-class/_config.js +++ b/test/function/samples/import-named-class/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a named class' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-named-class diff --git a/test/function/samples/import-named-from-external/_config.js b/test/function/samples/import-named-from-external/_config.js index de235679722..2c57d1a22b8 100644 --- a/test/function/samples/import-named-from-external/_config.js +++ b/test/function/samples/import-named-from-external/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'imports names from an external module', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/import-named-function-as-other/_config.js b/test/function/samples/import-named-function-as-other/_config.js index 6a949fda9a7..84d41aadf42 100644 --- a/test/function/samples/import-named-function-as-other/_config.js +++ b/test/function/samples/import-named-function-as-other/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a named function by another name' -}; +}); diff --git a/test/function/samples/import-named-function/_config.js b/test/function/samples/import-named-function/_config.js index 56c1faf6f76..6563ac91667 100644 --- a/test/function/samples/import-named-function/_config.js +++ b/test/function/samples/import-named-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a named function' -}; +}); diff --git a/test/function/samples/import-nameless-class-expression/_config.js b/test/function/samples/import-nameless-class-expression/_config.js index a001faaa2c3..93771bba1ad 100644 --- a/test/function/samples/import-nameless-class-expression/_config.js +++ b/test/function/samples/import-nameless-class-expression/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a nameless class expression' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-class-expression diff --git a/test/function/samples/import-namespace-from-external-module-renamed/_config.js b/test/function/samples/import-namespace-from-external-module-renamed/_config.js index 99b31818dfa..7ac860b7dc8 100644 --- a/test/function/samples/import-namespace-from-external-module-renamed/_config.js +++ b/test/function/samples/import-namespace-from-external-module-renamed/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a namespace from an external module and renames it', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/import-namespace-from-external-module/_config.js b/test/function/samples/import-namespace-from-external-module/_config.js index 72d81d042e6..5590999a6a8 100644 --- a/test/function/samples/import-namespace-from-external-module/_config.js +++ b/test/function/samples/import-namespace-from-external-module/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a namespace from an external module', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/import-namespace-from-internal-module-renamed/_config.js b/test/function/samples/import-namespace-from-internal-module-renamed/_config.js index 77f908af9e8..80097934062 100644 --- a/test/function/samples/import-namespace-from-internal-module-renamed/_config.js +++ b/test/function/samples/import-namespace-from-internal-module-renamed/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly exports x as y inside a bundle' -}; +}); diff --git a/test/function/samples/import-namespace-from-internal-module/_config.js b/test/function/samples/import-namespace-from-internal-module/_config.js index d6d0671ffc4..7ce1e566f39 100644 --- a/test/function/samples/import-namespace-from-internal-module/_config.js +++ b/test/function/samples/import-namespace-from-internal-module/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a namespace from an internal module' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/namespaces diff --git a/test/function/samples/import-not-at-top-level-fails/_config.js b/test/function/samples/import-not-at-top-level-fails/_config.js index ada39cdee18..9cf9999a022 100644 --- a/test/function/samples/import-not-at-top-level-fails/_config.js +++ b/test/function/samples/import-not-at-top-level-fails/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows non-top-level imports', error: { cause: { @@ -30,4 +30,4 @@ module.exports = { watchFiles: [ID_MAIN], message: "'import' and 'export' may only appear at the top level" } -}; +}); diff --git a/test/function/samples/import-of-unexported-fails/_config.js b/test/function/samples/import-of-unexported-fails/_config.js index 83b7d1a97ce..a50bbaf0664 100644 --- a/test/function/samples/import-of-unexported-fails/_config.js +++ b/test/function/samples/import-of-unexported-fails/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_EMPTY = path.join(__dirname, 'empty.js'); -module.exports = { +module.exports = defineTest({ description: 'marking an imported, but unexported, identifier should throw', error: { binding: 'default', @@ -25,4 +25,4 @@ module.exports = { watchFiles: [ID_EMPTY, ID_MAIN], message: '"default" is not exported by "empty.js", imported by "main.js".' } -}; +}); diff --git a/test/function/samples/import-var-declaration/_config.js b/test/function/samples/import-var-declaration/_config.js index f0f30a4e1c8..f09d8c9eeaa 100644 --- a/test/function/samples/import-var-declaration/_config.js +++ b/test/function/samples/import-var-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'imports a variable declaration' -}; +}); diff --git a/test/function/samples/imports-are-deconflicted-b/_config.js b/test/function/samples/imports-are-deconflicted-b/_config.js index f89a1b06c1c..6513e42a50c 100644 --- a/test/function/samples/imports-are-deconflicted-b/_config.js +++ b/test/function/samples/imports-are-deconflicted-b/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts imports (redux)', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/imports-are-deconflicted-c/_config.js b/test/function/samples/imports-are-deconflicted-c/_config.js index b33a03f5ce6..4995fb27bd2 100644 --- a/test/function/samples/imports-are-deconflicted-c/_config.js +++ b/test/function/samples/imports-are-deconflicted-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts imports, again' -}; +}); diff --git a/test/function/samples/imports-are-deconflicted/_config.js b/test/function/samples/imports-are-deconflicted/_config.js index b6b364ff345..bffa735ccd0 100644 --- a/test/function/samples/imports-are-deconflicted/_config.js +++ b/test/function/samples/imports-are-deconflicted/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'deconflicts imports', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/includes-internally-used-default-export/_config.js b/test/function/samples/includes-internally-used-default-export/_config.js index 3eab34086ad..0a2c6c9f02c 100644 --- a/test/function/samples/includes-internally-used-default-export/_config.js +++ b/test/function/samples/includes-internally-used-default-export/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes default exports that are only used internally' -}; +}); diff --git a/test/function/samples/includes-reassignments/_config.js b/test/function/samples/includes-reassignments/_config.js index 1d66654e7d1..bf17b4186f3 100644 --- a/test/function/samples/includes-reassignments/_config.js +++ b/test/function/samples/includes-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes reassignments that are ignored on an initial pass' -}; +}); diff --git a/test/function/samples/includes-superclass/_config.js b/test/function/samples/includes-superclass/_config.js index 7baf3857813..aef55b3abe2 100644 --- a/test/function/samples/includes-superclass/_config.js +++ b/test/function/samples/includes-superclass/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes superclass (#932)' -}; +}); diff --git a/test/function/samples/inline-dynamic-imports-bundle/_config.js b/test/function/samples/inline-dynamic-imports-bundle/_config.js index 94df96d2f5a..c5c4a99d7c6 100644 --- a/test/function/samples/inline-dynamic-imports-bundle/_config.js +++ b/test/function/samples/inline-dynamic-imports-bundle/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'ignores non-bundled modules when inlining dynamic imports', options: { output: { inlineDynamicImports: true }, @@ -14,4 +14,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/inline-dynamic-no-treeshake/_config.js b/test/function/samples/inline-dynamic-no-treeshake/_config.js index 326238d2f61..89f7f7caedf 100644 --- a/test/function/samples/inline-dynamic-no-treeshake/_config.js +++ b/test/function/samples/inline-dynamic-no-treeshake/_config.js @@ -1,6 +1,6 @@ const MAGIC_ENTRY = 'main'; -module.exports = { +module.exports = defineTest({ description: 'handles inlining dynamic imports when treeshaking is disabled for modules (#4098)', options: { input: MAGIC_ENTRY, @@ -26,4 +26,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/inline-imports-with-manual/_config.js b/test/function/samples/inline-imports-with-manual/_config.js index fe0df8a84d6..df7b34acd33 100644 --- a/test/function/samples/inline-imports-with-manual/_config.js +++ b/test/function/samples/inline-imports-with-manual/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Manual chunks are not supported when inlining dynamic imports', options: { input: ['main.js'], @@ -15,4 +15,4 @@ module.exports = { 'Invalid value for option "output.manualChunks" - this option is not supported for "output.inlineDynamicImports".', url: 'https://rollupjs.org/configuration-options/#output-manualchunks' } -}; +}); diff --git a/test/function/samples/inline-imports-with-multiple-array/_config.js b/test/function/samples/inline-imports-with-multiple-array/_config.js index bbff9c82769..d2494f70b8a 100644 --- a/test/function/samples/inline-imports-with-multiple-array/_config.js +++ b/test/function/samples/inline-imports-with-multiple-array/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Having multiple inputs in an array is not supported when inlining dynamic imports', options: { input: ['main.js', 'lib.js'], @@ -10,4 +10,4 @@ module.exports = { 'Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.', url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } -}; +}); diff --git a/test/function/samples/inline-imports-with-multiple-object/_config.js b/test/function/samples/inline-imports-with-multiple-object/_config.js index 7cd02ba69e3..bc8dc2150a8 100644 --- a/test/function/samples/inline-imports-with-multiple-object/_config.js +++ b/test/function/samples/inline-imports-with-multiple-object/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Having multiple inputs in an object is not supported when inlining dynamic imports', options: { input: { main: 'main.js', lib: 'lib.js' }, @@ -10,4 +10,4 @@ module.exports = { 'Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.', url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } -}; +}); diff --git a/test/function/samples/inlined-dynamic-namespace-compact/_config.js b/test/function/samples/inlined-dynamic-namespace-compact/_config.js index 7a59aab0960..46930df80e3 100644 --- a/test/function/samples/inlined-dynamic-namespace-compact/_config.js +++ b/test/function/samples/inlined-dynamic-namespace-compact/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'properly resolves inlined dynamic namespaces in compact mode', options: { output: { compact: true } }, exports(exports) { return exports.then(result => assert.strictEqual(result, 42 * 3)); } -}; +}); diff --git a/test/function/samples/input-name-validation/_config.js b/test/function/samples/input-name-validation/_config.js index e080d4098c9..5dc766e619f 100644 --- a/test/function/samples/input-name-validation/_config.js +++ b/test/function/samples/input-name-validation/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for absolute paths as input names', options: { input: { '/test': 'main.js' } @@ -8,4 +8,4 @@ module.exports = { message: 'Invalid substitution "/test" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.' } -}; +}); diff --git a/test/function/samples/input-name-validation2/_config.js b/test/function/samples/input-name-validation2/_config.js index 66b864ccf6c..24f9b5b0a2a 100644 --- a/test/function/samples/input-name-validation2/_config.js +++ b/test/function/samples/input-name-validation2/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for relative paths as input names', options: { input: { './test': 'main.js' } @@ -8,4 +8,4 @@ module.exports = { message: 'Invalid substitution "./test" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.' } -}; +}); diff --git a/test/function/samples/input-name-validation3/_config.js b/test/function/samples/input-name-validation3/_config.js index 5c40d5fb728..f7eaa0e73f9 100644 --- a/test/function/samples/input-name-validation3/_config.js +++ b/test/function/samples/input-name-validation3/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for relative paths as input names', options: { input: { '../test': 'main.js' } @@ -8,4 +8,4 @@ module.exports = { message: 'Invalid substitution "../test" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.' } -}; +}); diff --git a/test/function/samples/instanceof/left-hand-effect/_config.js b/test/function/samples/instanceof/left-hand-effect/_config.js index edadb884deb..20f3087b793 100644 --- a/test/function/samples/instanceof/left-hand-effect/_config.js +++ b/test/function/samples/instanceof/left-hand-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side effects in the left hand side of instanceof' -}; +}); diff --git a/test/function/samples/instanceof/right-hand-effect/_config.js b/test/function/samples/instanceof/right-hand-effect/_config.js index 466922bcd67..16ad2a1dece 100644 --- a/test/function/samples/instanceof/right-hand-effect/_config.js +++ b/test/function/samples/instanceof/right-hand-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains side effects in the right hand side of instanceof' -}; +}); diff --git a/test/function/samples/instanceof/used-parameter/_config.js b/test/function/samples/instanceof/used-parameter/_config.js index 1312a923985..b054dd1b8fa 100644 --- a/test/function/samples/instanceof/used-parameter/_config.js +++ b/test/function/samples/instanceof/used-parameter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains instanceof for function parameters' -}; +}); diff --git a/test/function/samples/instanceof/used/_config.js b/test/function/samples/instanceof/used/_config.js index fe5faa35411..9056ea08051 100644 --- a/test/function/samples/instanceof/used/_config.js +++ b/test/function/samples/instanceof/used/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains instanceof if it is true' -}; +}); diff --git a/test/function/samples/inter-chunk-execution-order/_config.js b/test/function/samples/inter-chunk-execution-order/_config.js index c8fe5823947..7fa0f55be46 100644 --- a/test/function/samples/inter-chunk-execution-order/_config.js +++ b/test/function/samples/inter-chunk-execution-order/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const execution = { index: 0 }; -module.exports = { +module.exports = defineTest({ description: 'sorts imports between chunks to closely match the actual execution order', context: { execution }, options: { @@ -10,4 +10,4 @@ module.exports = { exports() { assert.equal(execution.index, 4); } -}; +}); diff --git a/test/function/samples/internal-reexports-from-external/_config.js b/test/function/samples/internal-reexports-from-external/_config.js index 7956f81e137..88e1dcb3a01 100644 --- a/test/function/samples/internal-reexports-from-external/_config.js +++ b/test/function/samples/internal-reexports-from-external/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const fs = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'supports namespaces with external star reexports', options: { external: ['fs', 'path'], @@ -27,4 +27,4 @@ module.exports = { assert.strictEqual(exports.fsOverride.readFileSync, fs.readFileSync); assert.strictEqual(exports.fsOverride.dirname, path.dirname); } -}; +}); diff --git a/test/function/samples/interop-auto-live-bindings/_config.js b/test/function/samples/interop-auto-live-bindings/_config.js index a9b033a4419..7680e514d9f 100644 --- a/test/function/samples/interop-auto-live-bindings/_config.js +++ b/test/function/samples/interop-auto-live-bindings/_config.js @@ -4,7 +4,7 @@ let barCjs = 'bar'; let fooDefault = 'foo'; let barDefault = 'bar'; -module.exports = { +module.exports = defineTest({ description: 'handles interop "auto" with live-bindings support', options: { external: id => id.startsWith('external') || id === 'update', @@ -62,4 +62,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/interop-auto-no-live-bindings/_config.js b/test/function/samples/interop-auto-no-live-bindings/_config.js index 59b9aff39bb..38031492af8 100644 --- a/test/function/samples/interop-auto-no-live-bindings/_config.js +++ b/test/function/samples/interop-auto-no-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles interop "auto" without live-bindings support', options: { external: id => id.startsWith('external') || id === 'update', @@ -48,4 +48,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/interop-default-conflict/_config.js b/test/function/samples/interop-default-conflict/_config.js index 56becebcb73..48271360c7b 100644 --- a/test/function/samples/interop-default-conflict/_config.js +++ b/test/function/samples/interop-default-conflict/_config.js @@ -3,7 +3,7 @@ const assert = require('node:assert'); let bar = 'initial bar'; let defaultValue = 'initial foo'; -module.exports = { +module.exports = defineTest({ description: 'handles conflicts with added interop default variables and supports default live bindings', options: { @@ -39,4 +39,4 @@ module.exports = { external__default: 2 }); } -}; +}); diff --git a/test/function/samples/interop-default-only-named-import/_config.js b/test/function/samples/interop-default-only-named-import/_config.js index 7b74466cbab..2b03b54fae3 100644 --- a/test/function/samples/interop-default-only-named-import/_config.js +++ b/test/function/samples/interop-default-only-named-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using a named import with interop "defaultOnly"', options: { external: 'external', @@ -13,4 +13,4 @@ module.exports = { message: 'The named export "foo" was imported from the external module "external" even though its interop type is "defaultOnly". Either remove or change this import or change the value of the "output.interop" option.' } -}; +}); diff --git a/test/function/samples/interop-default-only-named-namespace-reexport/_config.js b/test/function/samples/interop-default-only-named-namespace-reexport/_config.js index 458b0256710..ee2ecff0135 100644 --- a/test/function/samples/interop-default-only-named-namespace-reexport/_config.js +++ b/test/function/samples/interop-default-only-named-namespace-reexport/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows reexporting a namespace as a name when interop is "defaultOnly"', options: { external: 'external', @@ -11,4 +11,4 @@ module.exports = { exports(exports) { assert.deepStrictEqual(exports, { foo: { __proto__: null, default: { external: true } } }); } -}; +}); diff --git a/test/function/samples/interop-default-only-named-reexport/_config.js b/test/function/samples/interop-default-only-named-reexport/_config.js index 8e98270f279..2c45a5cdbb1 100644 --- a/test/function/samples/interop-default-only-named-reexport/_config.js +++ b/test/function/samples/interop-default-only-named-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when reexporting a namespace with interop "defaultOnly"', options: { external: 'external', @@ -13,4 +13,4 @@ module.exports = { message: 'The named export "foo" was reexported from the external module "external" even though its interop type is "defaultOnly". Either remove or change this reexport or change the value of the "output.interop" option.' } -}; +}); diff --git a/test/function/samples/interop-default-only-namespace-import/_config.js b/test/function/samples/interop-default-only-namespace-import/_config.js index 754c3628c0b..c817587da2e 100644 --- a/test/function/samples/interop-default-only-namespace-import/_config.js +++ b/test/function/samples/interop-default-only-namespace-import/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows importing a namespace when interop is "defaultOnly"', options: { external: 'external', @@ -6,4 +6,4 @@ module.exports = { interop: 'defaultOnly' } } -}; +}); diff --git a/test/function/samples/interop-default-only-namespace-reexport/_config.js b/test/function/samples/interop-default-only-namespace-reexport/_config.js index 9d84671476f..90522d2ae92 100644 --- a/test/function/samples/interop-default-only-namespace-reexport/_config.js +++ b/test/function/samples/interop-default-only-namespace-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns when reexporting a namespace with interop "defaultOnly"', options: { external: 'external', @@ -15,4 +15,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-interop' } ] -}; +}); diff --git a/test/function/samples/interop-default-only/_config.js b/test/function/samples/interop-default-only/_config.js index a1a8529c58e..1e229dca03b 100644 --- a/test/function/samples/interop-default-only/_config.js +++ b/test/function/samples/interop-default-only/_config.js @@ -4,7 +4,7 @@ let barCjs = 'bar'; let fooDefault = 'foo'; let barDefault = 'bar'; -module.exports = { +module.exports = defineTest({ description: 'handles interop "defaultOnly"', options: { external: id => id.startsWith('external') || id === 'update', @@ -62,4 +62,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/interop-default/_config.js b/test/function/samples/interop-default/_config.js index 021c2117d32..9e97be301ad 100644 --- a/test/function/samples/interop-default/_config.js +++ b/test/function/samples/interop-default/_config.js @@ -4,7 +4,7 @@ let barCjs = 'bar'; let fooDefault = 'foo'; let barDefault = 'bar'; -module.exports = { +module.exports = defineTest({ description: 'handles interop "default" with live-bindings support', options: { external: id => id.startsWith('external') || id === 'update', @@ -62,4 +62,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/interop-esmodule/_config.js b/test/function/samples/interop-esmodule/_config.js index d901354150c..219e1b96223 100644 --- a/test/function/samples/interop-esmodule/_config.js +++ b/test/function/samples/interop-esmodule/_config.js @@ -4,7 +4,7 @@ let barCjs = 'bar'; let fooDefault = 'foo'; let barDefault = 'bar'; -module.exports = { +module.exports = defineTest({ description: 'handles interop "esModule" with live-bindings support', options: { external: id => id.startsWith('external') || id === 'update', @@ -64,4 +64,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/invalid-addon-hook/_config.js b/test/function/samples/invalid-addon-hook/_config.js index beb5cdea593..685dd940e0f 100644 --- a/test/function/samples/invalid-addon-hook/_config.js +++ b/test/function/samples/invalid-addon-hook/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when providing a non-string value for an addon hook', options: { plugins: { @@ -10,4 +10,4 @@ module.exports = { message: 'Could not retrieve "intro". Check configuration of plugin "at position 1".\n\tError Message: Error running plugin hook "intro" for plugin "at position 1", expected a string, a function hook or an object with a "handler" string or function.' } -}; +}); diff --git a/test/function/samples/invalid-default-export-mode/_config.js b/test/function/samples/invalid-default-export-mode/_config.js index de89dd3899c..bef2235260f 100644 --- a/test/function/samples/invalid-default-export-mode/_config.js +++ b/test/function/samples/invalid-default-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throw for invalid default export mode', options: { output: { @@ -11,4 +11,4 @@ module.exports = { '"default" was specified for "output.exports", but entry module "main.js" has the following exports: "default" and "foo"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/invalid-ignore-list-function/_config.js b/test/function/samples/invalid-ignore-list-function/_config.js index b6d47edd563..48a4611f758 100644 --- a/test/function/samples/invalid-ignore-list-function/_config.js +++ b/test/function/samples/invalid-ignore-list-function/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throw descriptive error if sourcemapIgnoreList-function does not return a boolean', options: { output: { @@ -14,4 +14,4 @@ module.exports = { code: 'VALIDATION_ERROR', message: 'sourcemapIgnoreList function must return a boolean.' } -}; +}); diff --git a/test/function/samples/invalid-interop/_config.js b/test/function/samples/invalid-interop/_config.js index b341e7dbff6..2dae351f071 100644 --- a/test/function/samples/invalid-interop/_config.js +++ b/test/function/samples/invalid-interop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid interop values', options: { external: 'external', @@ -12,4 +12,4 @@ module.exports = { 'Invalid value "true" for option "output.interop" - use one of "compat", "auto", "esModule", "default", "defaultOnly".', url: 'https://rollupjs.org/configuration-options/#output-interop' } -}; +}); diff --git a/test/function/samples/invalid-pattern-replacement/_config.js b/test/function/samples/invalid-pattern-replacement/_config.js index 09ec57507ca..31b7448b93d 100644 --- a/test/function/samples/invalid-pattern-replacement/_config.js +++ b/test/function/samples/invalid-pattern-replacement/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid placeholders in patterns', options: { output: { entryFileNames: '[invalid].js' } @@ -7,4 +7,4 @@ module.exports = { code: 'VALIDATION_ERROR', message: '"[invalid]" is not a valid placeholder in the "output.entryFileNames" pattern.' } -}; +}); diff --git a/test/function/samples/invalid-pattern/_config.js b/test/function/samples/invalid-pattern/_config.js index 9fefd4d5be0..26d8f1cde7f 100644 --- a/test/function/samples/invalid-pattern/_config.js +++ b/test/function/samples/invalid-pattern/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid patterns', options: { output: { entryFileNames: '../main.js' } @@ -8,4 +8,4 @@ module.exports = { message: 'Invalid pattern "../main.js" for "output.entryFileNames", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.' } -}; +}); diff --git a/test/function/samples/invalid-property-assignments/_config.js b/test/function/samples/invalid-property-assignments/_config.js index 77c1bcbb785..430ec38353b 100644 --- a/test/function/samples/invalid-property-assignments/_config.js +++ b/test/function/samples/invalid-property-assignments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes invalid property assignments', context: { globalOther: 'other' }, options: { @@ -8,4 +8,4 @@ module.exports = { unknownGlobalSideEffects: false } } -}; +}); diff --git a/test/function/samples/invalid-property-calls/_config.js b/test/function/samples/invalid-property-calls/_config.js index b9a1c9c33f3..eca49dda3b0 100644 --- a/test/function/samples/invalid-property-calls/_config.js +++ b/test/function/samples/invalid-property-calls/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes invalid property calls', context: { globalFirst: 'first', globalOther: 'other' }, options: { @@ -8,4 +8,4 @@ module.exports = { unknownGlobalSideEffects: false } } -}; +}); diff --git a/test/function/samples/invalid-top-level-await/_config.js b/test/function/samples/invalid-top-level-await/_config.js index 182cf1a1a1c..4586d5a5d62 100644 --- a/test/function/samples/invalid-top-level-await/_config.js +++ b/test/function/samples/invalid-top-level-await/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws for invalid top-level-await format', generateError: { code: 'INVALID_TLA_FORMAT', @@ -9,4 +9,4 @@ module.exports = { message: 'Module format "cjs" does not support top-level await. Use the "es" or "system" output formats rather.' } -}; +}); diff --git a/test/function/samples/invalid-transform-source-function/_config.js b/test/function/samples/invalid-transform-source-function/_config.js index 4e5f4b99d8e..375e67a57d6 100644 --- a/test/function/samples/invalid-transform-source-function/_config.js +++ b/test/function/samples/invalid-transform-source-function/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throw descriptive error if sourcemapPathTransform-function does not return a string (#3484)', options: { @@ -15,4 +15,4 @@ module.exports = { code: 'VALIDATION_ERROR', message: 'sourcemapPathTransform function must return a string.' } -}; +}); diff --git a/test/function/samples/keep-cjs-dynamic-import/_config.js b/test/function/samples/keep-cjs-dynamic-import/_config.js index 3d9a5e0ff86..1bfa3cc2443 100644 --- a/test/function/samples/keep-cjs-dynamic-import/_config.js +++ b/test/function/samples/keep-cjs-dynamic-import/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'keeps dynamic imports in CJS output by default', options: { external: ['external-esm'] }, async exports({ result }) { @@ -11,4 +11,4 @@ module.exports = { Object.defineProperty(expected, Symbol.toStringTag, { value: 'Module' }); assert.deepStrictEqual(await result, expected); } -}; +}); diff --git a/test/function/samples/keep-used-imports-from-pure-external-modules/_config.js b/test/function/samples/keep-used-imports-from-pure-external-modules/_config.js index 468f4707138..b63182345a9 100644 --- a/test/function/samples/keep-used-imports-from-pure-external-modules/_config.js +++ b/test/function/samples/keep-used-imports-from-pure-external-modules/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'imports from pure external modules that are used should not be omitted', options: { external: ['warning'], @@ -14,4 +14,4 @@ module.exports = { throw new Error('Unexpected import', id); } } -}; +}); diff --git a/test/function/samples/labeled-statement-conditional-break/_config.js b/test/function/samples/labeled-statement-conditional-break/_config.js index 01c552f861b..53fd176d78b 100644 --- a/test/function/samples/labeled-statement-conditional-break/_config.js +++ b/test/function/samples/labeled-statement-conditional-break/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles conditional control flow due to labeled statements' -}; +}); diff --git a/test/function/samples/legal-import-modification/_config.js b/test/function/samples/legal-import-modification/_config.js index 37928575c6b..d53f41da92e 100644 --- a/test/function/samples/legal-import-modification/_config.js +++ b/test/function/samples/legal-import-modification/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'assigning to properties of imported bindings is permitted' -}; +}); diff --git a/test/function/samples/legal-suggested-names/_config.js b/test/function/samples/legal-suggested-names/_config.js index d68f4e75b25..3bca1753545 100644 --- a/test/function/samples/legal-suggested-names/_config.js +++ b/test/function/samples/legal-suggested-names/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'illegal name suggestions are ignored' -}; +}); diff --git a/test/function/samples/load-module-error/buildEnd/_config.js b/test/function/samples/load-module-error/buildEnd/_config.js index 0f3c27d4143..327db966a4a 100644 --- a/test/function/samples/load-module-error/buildEnd/_config.js +++ b/test/function/samples/load-module-error/buildEnd/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'buildEnd' } -}; +}); diff --git a/test/function/samples/load-module-error/buildStart/_config.js b/test/function/samples/load-module-error/buildStart/_config.js index 47657147100..6ea085f42fc 100644 --- a/test/function/samples/load-module-error/buildStart/_config.js +++ b/test/function/samples/load-module-error/buildStart/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'buildStart' } -}; +}); diff --git a/test/function/samples/load-module-error/generateBundle/_config.js b/test/function/samples/load-module-error/generateBundle/_config.js index 27ca00e7e9d..7e17c2b92aa 100644 --- a/test/function/samples/load-module-error/generateBundle/_config.js +++ b/test/function/samples/load-module-error/generateBundle/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'generateBundle' } -}; +}); diff --git a/test/function/samples/load-module-error/load/_config.js b/test/function/samples/load-module-error/load/_config.js index db842763132..298a54b9bc7 100644 --- a/test/function/samples/load-module-error/load/_config.js +++ b/test/function/samples/load-module-error/load/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws when a module cannot be loaded', options: { plugins: [ @@ -26,4 +26,4 @@ module.exports = { plugin: 'test', watchFiles: [path.join(__dirname, 'main.js'), 'broken'] } -}; +}); diff --git a/test/function/samples/load-module-error/renderChunk/_config.js b/test/function/samples/load-module-error/renderChunk/_config.js index 3cf2fb6ad5c..dcc254529b6 100644 --- a/test/function/samples/load-module-error/renderChunk/_config.js +++ b/test/function/samples/load-module-error/renderChunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'renderChunk' } -}; +}); diff --git a/test/function/samples/load-module-error/renderStart/_config.js b/test/function/samples/load-module-error/renderStart/_config.js index 5c7f9551f4f..4756298ddb4 100644 --- a/test/function/samples/load-module-error/renderStart/_config.js +++ b/test/function/samples/load-module-error/renderStart/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'renderStart' } -}; +}); diff --git a/test/function/samples/load-module-error/resolveId/_config.js b/test/function/samples/load-module-error/resolveId/_config.js index 640b704e011..9b3390ca35c 100644 --- a/test/function/samples/load-module-error/resolveId/_config.js +++ b/test/function/samples/load-module-error/resolveId/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'resolveId' } -}; +}); diff --git a/test/function/samples/load-module-error/transform/_config.js b/test/function/samples/load-module-error/transform/_config.js index 378d7602c05..1c893155d14 100644 --- a/test/function/samples/load-module-error/transform/_config.js +++ b/test/function/samples/load-module-error/transform/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'plugin transform hooks can use `this.error({...}, char)` (#1140)', options: { plugins: [ @@ -30,4 +30,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/load-resolve-dependencies/_config.js b/test/function/samples/load-resolve-dependencies/_config.js index 941c4e6bdef..6542590fc3d 100644 --- a/test/function/samples/load-resolve-dependencies/_config.js +++ b/test/function/samples/load-resolve-dependencies/_config.js @@ -6,7 +6,7 @@ const ID_THIRD = path.join(__dirname, 'third.js'); const DYNAMIC_IMPORT_PROXY_PREFIX = '\0dynamic-import:'; const chunks = []; -module.exports = { +module.exports = defineTest({ description: 'allows to wait for dependency resolution in this.load to scan dependency trees', context: { chunks }, async exports(exports) { @@ -90,4 +90,4 @@ module.exports = { message: 'Circular dependency: second.js -> third.js -> second.js' } ] -}; +}); diff --git a/test/function/samples/load-returns-empty-string/_config.js b/test/function/samples/load-returns-empty-string/_config.js index 206f19d0f8e..bfd45a48d10 100644 --- a/test/function/samples/load-returns-empty-string/_config.js +++ b/test/function/samples/load-returns-empty-string/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'loaders are permitted to return the empty string', options: { plugins: [ @@ -18,4 +18,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/load-returns-string-or-null/_config.js b/test/function/samples/load-returns-string-or-null/_config.js index 5e09d3fbe6a..fb5a74390f4 100644 --- a/test/function/samples/load-returns-string-or-null/_config.js +++ b/test/function/samples/load-returns-string-or-null/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws error if load returns something wacky', options: { plugins: [ @@ -19,4 +19,4 @@ module.exports = { message: 'Error loading "main.js": plugin load hook should return a string, a { code, map } object, or nothing/null.' } -}; +}); diff --git a/test/function/samples/long-path-deopt/_config.js b/test/function/samples/long-path-deopt/_config.js index 37d8fd1f405..926f705cb02 100644 --- a/test/function/samples/long-path-deopt/_config.js +++ b/test/function/samples/long-path-deopt/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes getting return expression for long property paths' -}; +}); diff --git a/test/function/samples/manual-chunks-conflict/_config.js b/test/function/samples/manual-chunks-conflict/_config.js index 4773d7a0fad..b5e44eb8c1f 100644 --- a/test/function/samples/manual-chunks-conflict/_config.js +++ b/test/function/samples/manual-chunks-conflict/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Throws for conflicts between manual chunks', options: { input: ['main.js'], @@ -13,4 +13,4 @@ module.exports = { code: 'INVALID_CHUNK', message: 'Cannot assign "dep.js" to the "dep2" chunk as it is already in the "dep1" chunk.' } -}; +}); diff --git a/test/function/samples/manual-chunks-info/_config.js b/test/function/samples/manual-chunks-info/_config.js index 8bbf3c7a25a..6bcbf2c1c01 100644 --- a/test/function/samples/manual-chunks-info/_config.js +++ b/test/function/samples/manual-chunks-info/_config.js @@ -6,7 +6,7 @@ function getId(name) { return path.join(__dirname, `${name}.js`); } -module.exports = { +module.exports = defineTest({ description: 'provides additional chunk information to a manualChunks function', options: { external: 'external', @@ -316,4 +316,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/mark-namespace-members/_config.js b/test/function/samples/mark-namespace-members/_config.js index 455a6c6c9e5..9a1d833f06e 100644 --- a/test/function/samples/mark-namespace-members/_config.js +++ b/test/function/samples/mark-namespace-members/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'marks namespace members' -}; +}); diff --git a/test/function/samples/max-parallel-file-operations/default/_config.js b/test/function/samples/max-parallel-file-operations/default/_config.js index 8917cef5851..ac3a1805883 100644 --- a/test/function/samples/max-parallel-file-operations/default/_config.js +++ b/test/function/samples/max-parallel-file-operations/default/_config.js @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps not set', before() { fs.readFile = async (path, options) => { @@ -22,4 +22,4 @@ module.exports = { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 5, 'Wrong number of parallel file reads: ' + maxReads); } -}; +}); diff --git a/test/function/samples/max-parallel-file-operations/error/_config.js b/test/function/samples/max-parallel-file-operations/error/_config.js index 055c8228f75..ad0dba87566 100644 --- a/test/function/samples/max-parallel-file-operations/error/_config.js +++ b/test/function/samples/max-parallel-file-operations/error/_config.js @@ -4,7 +4,7 @@ const { loader } = require('../../../../utils.js'); const fsReadFile = fs.readFile; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps: fileRead error is forwarded', options: { input: 'main', @@ -28,4 +28,4 @@ module.exports = { message: `Could not load ${join(__dirname, 'dep.js')} (imported by main): broken`, watchFiles: [join(__dirname, 'dep.js'), 'main'] } -}; +}); diff --git a/test/function/samples/max-parallel-file-operations/infinity/_config.js b/test/function/samples/max-parallel-file-operations/infinity/_config.js index 05b62ffe20a..bbb75a6e53f 100644 --- a/test/function/samples/max-parallel-file-operations/infinity/_config.js +++ b/test/function/samples/max-parallel-file-operations/infinity/_config.js @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps set to infinity', options: { maxParallelFileOps: 0 @@ -25,4 +25,4 @@ module.exports = { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 5, 'Wrong number of parallel file reads: ' + maxReads); } -}; +}); diff --git a/test/function/samples/max-parallel-file-operations/set/_config.js b/test/function/samples/max-parallel-file-operations/set/_config.js index b17b4abc10c..0467b557e07 100644 --- a/test/function/samples/max-parallel-file-operations/set/_config.js +++ b/test/function/samples/max-parallel-file-operations/set/_config.js @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps set to 3', options: { maxParallelFileOps: 3 @@ -25,4 +25,4 @@ module.exports = { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 3, 'Wrong number of parallel file reads: ' + maxReads); } -}; +}); diff --git a/test/function/samples/max-parallel-file-operations/with-plugin/_config.js b/test/function/samples/max-parallel-file-operations/with-plugin/_config.js index 9d85fcfce8f..7384959a049 100644 --- a/test/function/samples/max-parallel-file-operations/with-plugin/_config.js +++ b/test/function/samples/max-parallel-file-operations/with-plugin/_config.js @@ -6,7 +6,7 @@ const fsReadFile = fs.readFile; let currentReads = 0; let maxReads = 0; -module.exports = { +module.exports = defineTest({ description: 'maxParallelFileOps with plugin', options: { maxParallelFileOps: 3, @@ -32,4 +32,4 @@ module.exports = { fs.readFile = fsReadFile; assert.strictEqual(maxReads, 3, 'Wrong number of parallel file reads: ' + maxReads); } -}; +}); diff --git a/test/function/samples/member-expression-assignment-in-function/_config.js b/test/function/samples/member-expression-assignment-in-function/_config.js index 35edb1ab4a5..efec2823c8c 100644 --- a/test/function/samples/member-expression-assignment-in-function/_config.js +++ b/test/function/samples/member-expression-assignment-in-function/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'detect side effect in member expression assignment when not top level', code(code) { assert.ok(code.includes('function set(key, value) { foo[key] = value; }'), code); assert.ok(code.includes('set("bar", 2);'), code); assert.ok(code.includes('set("qux", 3);'), code); } -}; +}); diff --git a/test/function/samples/merged-namespace-live-bindings/_config.js b/test/function/samples/merged-namespace-live-bindings/_config.js index 88fda1bf919..cb279471181 100644 --- a/test/function/samples/merged-namespace-live-bindings/_config.js +++ b/test/function/samples/merged-namespace-live-bindings/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'respects getters when accessing properties of an instance', context: { require(id) { @@ -19,4 +19,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/method-call-mutates-this/_config.js b/test/function/samples/method-call-mutates-this/_config.js index 66fe25b0716..2a19ae00979 100644 --- a/test/function/samples/method-call-mutates-this/_config.js +++ b/test/function/samples/method-call-mutates-this/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'method calls are assumed to mutate the owner' -}; +}); diff --git a/test/function/samples/method-call-side-effects/_config.js b/test/function/samples/method-call-side-effects/_config.js index 56b01c9e9e6..364be1ac609 100644 --- a/test/function/samples/method-call-side-effects/_config.js +++ b/test/function/samples/method-call-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'assumes methods may mutate objects passed in, and self' -}; +}); diff --git a/test/function/samples/missing-spaces-after-simplification/_config.js b/test/function/samples/missing-spaces-after-simplification/_config.js index 49540bde635..d7bd26822d5 100644 --- a/test/function/samples/missing-spaces-after-simplification/_config.js +++ b/test/function/samples/missing-spaces-after-simplification/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'handle situations where the simplification of an expression can lead to issues due to missing white-space', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/mixed-external-paths/_config.js b/test/function/samples/mixed-external-paths/_config.js index 813b9de3e9d..79cbf850c41 100644 --- a/test/function/samples/mixed-external-paths/_config.js +++ b/test/function/samples/mixed-external-paths/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows using the path option selectively', options: { external: ['dep-a', 'dep-b'], @@ -19,4 +19,4 @@ module.exports = { throw new Error(`Unexpected dependency ${id}`); } } -}; +}); diff --git a/test/function/samples/modify-assumed-global/_config.js b/test/function/samples/modify-assumed-global/_config.js index 4ea98a2cdd5..3bf2795cce5 100644 --- a/test/function/samples/modify-assumed-global/_config.js +++ b/test/function/samples/modify-assumed-global/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const Math = {}; -module.exports = { +module.exports = defineTest({ description: 'side-effects to assumed globals are included', context: { Math @@ -11,4 +11,4 @@ module.exports = { assert.equal(Math.square(3), 9); assert.equal(Math.cube(3), 27); } -}; +}); diff --git a/test/function/samples/modify-meta/_config.js b/test/function/samples/modify-meta/_config.js index 3b1a6320615..dda6989060b 100644 --- a/test/function/samples/modify-meta/_config.js +++ b/test/function/samples/modify-meta/_config.js @@ -4,7 +4,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); let initialMeta; -module.exports = { +module.exports = defineTest({ description: 'allows to freely modify moduleInfo.meta and maintain object identity', options: { plugins: [ @@ -63,4 +63,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/modify-object-via-this-a/_config.js b/test/function/samples/modify-object-via-this-a/_config.js index 0c4423de923..c32149fef49 100644 --- a/test/function/samples/modify-object-via-this-a/_config.js +++ b/test/function/samples/modify-object-via-this-a/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks object modification via "this"' -}; +}); diff --git a/test/function/samples/modify-object-via-this-b/_config.js b/test/function/samples/modify-object-via-this-b/_config.js index 0c4423de923..c32149fef49 100644 --- a/test/function/samples/modify-object-via-this-b/_config.js +++ b/test/function/samples/modify-object-via-this-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks object modification via "this"' -}; +}); diff --git a/test/function/samples/modify-object-via-this-c/_config.js b/test/function/samples/modify-object-via-this-c/_config.js index 0c4423de923..c32149fef49 100644 --- a/test/function/samples/modify-object-via-this-c/_config.js +++ b/test/function/samples/modify-object-via-this-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks object modification via "this"' -}; +}); diff --git a/test/function/samples/modify-object-via-this-d/_config.js b/test/function/samples/modify-object-via-this-d/_config.js index 0c4423de923..c32149fef49 100644 --- a/test/function/samples/modify-object-via-this-d/_config.js +++ b/test/function/samples/modify-object-via-this-d/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks object modification via "this"' -}; +}); diff --git a/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js b/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js index d5d93d31690..80f4db1bf3b 100644 --- a/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js +++ b/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles fully deoptimized objects', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-getter/getter-in-assignment/_config.js b/test/function/samples/modify-this-via-getter/getter-in-assignment/_config.js index 4f3496ac6bc..8fdcc8df131 100644 --- a/test/function/samples/modify-this-via-getter/getter-in-assignment/_config.js +++ b/test/function/samples/modify-this-via-getter/getter-in-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles known getters that are triggered via an assignment' -}; +}); diff --git a/test/function/samples/modify-this-via-getter/getters-on-this/_config.js b/test/function/samples/modify-this-via-getter/getters-on-this/_config.js index 6b29d1bcdfd..ed16aacef5a 100644 --- a/test/function/samples/modify-this-via-getter/getters-on-this/_config.js +++ b/test/function/samples/modify-this-via-getter/getters-on-this/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles calling getters on "this"' -}; +}); diff --git a/test/function/samples/modify-this-via-getter/known-getter/_config.js b/test/function/samples/modify-this-via-getter/known-getter/_config.js index b608017f8e2..0808865bde2 100644 --- a/test/function/samples/modify-this-via-getter/known-getter/_config.js +++ b/test/function/samples/modify-this-via-getter/known-getter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles known getters that modify "this"' -}; +}); diff --git a/test/function/samples/modify-this-via-getter/known-super-prop/_config.js b/test/function/samples/modify-this-via-getter/known-super-prop/_config.js index a5508ce20b8..79dfc448949 100644 --- a/test/function/samples/modify-this-via-getter/known-super-prop/_config.js +++ b/test/function/samples/modify-this-via-getter/known-super-prop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters that modify "this" on prototypes for known properties' -}; +}); diff --git a/test/function/samples/modify-this-via-getter/unknown-prop-getter/_config.js b/test/function/samples/modify-this-via-getter/unknown-prop-getter/_config.js index 44d6ebe0fc6..0c7b01133f1 100644 --- a/test/function/samples/modify-this-via-getter/unknown-prop-getter/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-prop-getter/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unknown getters that modify "this"', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js b/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js index f7ad11093ff..5ef55c92a2a 100644 --- a/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unknown getters that modify "this" for unknown property access', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js b/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js index 5b8bf4cebb8..bb4f3e89906 100644 --- a/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters that modify "this" for unknown property access', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js b/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js index aadb521b9c2..a29f383894e 100644 --- a/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters that modify "this" on prototypes for unknown properties', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js b/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js index d5d93d31690..80f4db1bf3b 100644 --- a/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js +++ b/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles fully deoptimized objects', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-setter/known-setter/_config.js b/test/function/samples/modify-this-via-setter/known-setter/_config.js index 449c895ba6d..be3a5b32853 100644 --- a/test/function/samples/modify-this-via-setter/known-setter/_config.js +++ b/test/function/samples/modify-this-via-setter/known-setter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles known setters that modify "this"' -}; +}); diff --git a/test/function/samples/modify-this-via-setter/known-super-prop/_config.js b/test/function/samples/modify-this-via-setter/known-super-prop/_config.js index 82c65bfeb09..76b842c2941 100644 --- a/test/function/samples/modify-this-via-setter/known-super-prop/_config.js +++ b/test/function/samples/modify-this-via-setter/known-super-prop/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles setters that modify "this" on prototypes for known properties' -}; +}); diff --git a/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js b/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js index ada935cacc5..ffb357c57d6 100644 --- a/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unknown setters that modify "this"', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js b/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js index e3522b87aa3..70a60fc3168 100644 --- a/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unknown setters that modify "this" for unknown property access', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js b/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js index cabfbba9c53..bbd4bf974ad 100644 --- a/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles setters that modify "this" on prototypes for unknown properties', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/module-level-directive/_config.js b/test/function/samples/module-level-directive/_config.js index bb8fd854756..27b8be297fe 100644 --- a/test/function/samples/module-level-directive/_config.js +++ b/test/function/samples/module-level-directive/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'module level directives should produce warnings', warnings: [ { @@ -22,4 +22,4 @@ module.exports = { 3: export default 1;` } ] -}; +}); diff --git a/test/function/samples/module-parsed-hook/_config.js b/test/function/samples/module-parsed-hook/_config.js index 72b0f1e0d4d..3987d551c94 100644 --- a/test/function/samples/module-parsed-hook/_config.js +++ b/test/function/samples/module-parsed-hook/_config.js @@ -6,7 +6,7 @@ const parsedModules = []; const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'calls the moduleParsedHook once a module is parsed', options: { plugins: { @@ -134,4 +134,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/module-parsed-imported-ids/_config.js b/test/function/samples/module-parsed-imported-ids/_config.js index 00722e42e23..ee051e50216 100644 --- a/test/function/samples/module-parsed-imported-ids/_config.js +++ b/test/function/samples/module-parsed-imported-ids/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'provides full importedIds and dynamicallyImportedIds in the moduleParsed hook', options: { plugins: [ @@ -28,4 +28,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/module-side-effect-reexport/_config.js b/test/function/samples/module-side-effect-reexport/_config.js index 7d057eec2bd..324ef02fe83 100644 --- a/test/function/samples/module-side-effect-reexport/_config.js +++ b/test/function/samples/module-side-effect-reexport/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'includes side effects of re-exporters unless they have moduleSideEffects: false', options: { plugins: [ @@ -10,4 +10,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/module-side-effects/array/_config.js b/test/function/samples/module-side-effects/array/_config.js index 2d0d94c6fc3..06eb5a435b5 100644 --- a/test/function/samples/module-side-effects/array/_config.js +++ b/test/function/samples/module-side-effects/array/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'supports setting module side effects via an array', context: { require(id) { @@ -53,4 +53,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/module-side-effects/external-false/_config.js b/test/function/samples/module-side-effects/external-false/_config.js index 57fbbf10d8a..0b3c82f5f33 100644 --- a/test/function/samples/module-side-effects/external-false/_config.js +++ b/test/function/samples/module-side-effects/external-false/_config.js @@ -4,7 +4,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'supports setting module side effects to false for external modules', context: { require(id) { @@ -54,4 +54,4 @@ module.exports = { url: 'https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency' } ] -}; +}); diff --git a/test/function/samples/module-side-effects/global-false/_config.js b/test/function/samples/module-side-effects/global-false/_config.js index 3e139d48e66..828d4ffe47a 100644 --- a/test/function/samples/module-side-effects/global-false/_config.js +++ b/test/function/samples/module-side-effects/global-false/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'supports setting module side effects to false for all modules', context: { require(id) { @@ -37,4 +37,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/module-side-effects/invalid-option/_config.js b/test/function/samples/module-side-effects/invalid-option/_config.js index 9509eafdb73..4e8cf447089 100644 --- a/test/function/samples/module-side-effects/invalid-option/_config.js +++ b/test/function/samples/module-side-effects/invalid-option/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns for invalid options', options: { treeshake: { @@ -11,4 +11,4 @@ module.exports = { 'Invalid value for option "treeshake.moduleSideEffects" - please use one of false, "no-external", a function or an array.', url: 'https://rollupjs.org/configuration-options/#treeshake-modulesideeffects' } -}; +}); diff --git a/test/function/samples/module-side-effects/load/_config.js b/test/function/samples/module-side-effects/load/_config.js index cb81b6ed80a..b31dec74d7e 100644 --- a/test/function/samples/module-side-effects/load/_config.js +++ b/test/function/samples/module-side-effects/load/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'handles setting moduleSideEffects in the load hook', context: { sideEffects @@ -41,4 +41,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/module-side-effects/reexport-from-external/_config.js b/test/function/samples/module-side-effects/reexport-from-external/_config.js index 7f5ae2cbea4..d04b7f3e2c8 100644 --- a/test/function/samples/module-side-effects/reexport-from-external/_config.js +++ b/test/function/samples/module-side-effects/reexport-from-external/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles reexporting external values when module side-effects are false', context: { require(id) { @@ -21,4 +21,4 @@ module.exports = { moduleSideEffects: false } } -}; +}); diff --git a/test/function/samples/module-side-effects/reexports/_config.js b/test/function/samples/module-side-effects/reexports/_config.js index de396cc1eb0..2fb509027fc 100644 --- a/test/function/samples/module-side-effects/reexports/_config.js +++ b/test/function/samples/module-side-effects/reexports/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'handles reexporting values when module side-effects are false', context: { sideEffects @@ -14,4 +14,4 @@ module.exports = { moduleSideEffects: false } } -}; +}); diff --git a/test/function/samples/module-side-effects/resolve-id-external/_config.js b/test/function/samples/module-side-effects/resolve-id-external/_config.js index d56f083fd40..2e0aa6c06a4 100644 --- a/test/function/samples/module-side-effects/resolve-id-external/_config.js +++ b/test/function/samples/module-side-effects/resolve-id-external/_config.js @@ -1,9 +1,12 @@ const assert = require('node:assert'); const path = require('node:path'); +/** + * @type {string[]} + */ const sideEffects = []; const { getObject } = require('../../../../utils'); -module.exports = { +module.exports = defineTest({ description: 'does not include modules without used exports if moduleSideEffect is false', context: { require(id) { @@ -82,4 +85,4 @@ module.exports = { assert.strictEqual(warning.code, 'UNUSED_EXTERNAL_IMPORT'); } } -}; +}); diff --git a/test/function/samples/module-side-effects/resolve-id/_config.js b/test/function/samples/module-side-effects/resolve-id/_config.js index fdd7927489f..7ad65ab72af 100644 --- a/test/function/samples/module-side-effects/resolve-id/_config.js +++ b/test/function/samples/module-side-effects/resolve-id/_config.js @@ -4,7 +4,7 @@ const { getObject } = require('../../../../utils'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'does not include modules without used exports if moduleSideEffect is false', context: { sideEffects @@ -86,4 +86,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/module-side-effects/transform/_config.js b/test/function/samples/module-side-effects/transform/_config.js index a6af08f31cf..03e489b4925 100644 --- a/test/function/samples/module-side-effects/transform/_config.js +++ b/test/function/samples/module-side-effects/transform/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const path = require('node:path'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'handles setting moduleSideEffects in the transform hook', context: { sideEffects @@ -69,4 +69,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/module-side-effects/writable/_config.js b/test/function/samples/module-side-effects/writable/_config.js index 1a21c1ee4a4..77d0982d914 100644 --- a/test/function/samples/module-side-effects/writable/_config.js +++ b/test/function/samples/module-side-effects/writable/_config.js @@ -3,7 +3,7 @@ const POLYFILL_ID = '\0polyfill'; const PROXY_SUFFIX = '?inject-polyfill-proxy'; -module.exports = { +module.exports = defineTest({ description: 'ModuleInfo.moduleSideEffects should be writable during build time', options: { treeshake: { moduleSideEffects: false }, @@ -66,4 +66,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/module-sort-order/_config.js b/test/function/samples/module-sort-order/_config.js index 9b7f002d0d3..9fbcae5201f 100644 --- a/test/function/samples/module-sort-order/_config.js +++ b/test/function/samples/module-sort-order/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'module sorter is not confused by top-level call expressions' -}; +}); diff --git a/test/function/samples/module-tree/_config.js b/test/function/samples/module-tree/_config.js index dc987119efa..8c978703ffe 100644 --- a/test/function/samples/module-tree/_config.js +++ b/test/function/samples/module-tree/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'bundle.modules includes dependencies (#903)', bundle(bundle) { const modules = bundle.cache.modules.map(module => ({ @@ -39,4 +39,4 @@ module.exports = { names: ['main'] } ] -}; +}); diff --git a/test/function/samples/name-conflict-object/_config.js b/test/function/samples/name-conflict-object/_config.js index 24501c04295..18f76ca1d44 100644 --- a/test/function/samples/name-conflict-object/_config.js +++ b/test/function/samples/name-conflict-object/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'avoids name conflicts with local variables named Object', options: { external: 'external', @@ -17,4 +17,4 @@ module.exports = { assert.strictEqual(exports.foo.foo, 'foo'); assert.strictEqual(exports.foo.default.foo, 'foo'); } -}; +}); diff --git a/test/function/samples/name-conflict-promise/_config.js b/test/function/samples/name-conflict-promise/_config.js index baa6dad3472..a6581386894 100644 --- a/test/function/samples/name-conflict-promise/_config.js +++ b/test/function/samples/name-conflict-promise/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'avoids name conflicts with local variables named Promise', async exports(exports) { assert.strictEqual(exports.Promise, 'bar'); assert.strictEqual((await exports.promised).Promise, 'foo'); } -}; +}); diff --git a/test/function/samples/name-conflict-symbol/_config.js b/test/function/samples/name-conflict-symbol/_config.js index 8f3ecadeff8..1cd7b638ffe 100644 --- a/test/function/samples/name-conflict-symbol/_config.js +++ b/test/function/samples/name-conflict-symbol/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'avoids name conflicts with local variables named Symbol', options: { output: { @@ -11,4 +11,4 @@ module.exports = { assert.strictEqual(exports.Symbol, null); assert.strictEqual(exports.toString(), '[object Module]'); } -}; +}); diff --git a/test/function/samples/named-external-method-in-prototype/_config.js b/test/function/samples/named-external-method-in-prototype/_config.js index bb26af2864c..0f8f68f5ef5 100644 --- a/test/function/samples/named-external-method-in-prototype/_config.js +++ b/test/function/samples/named-external-method-in-prototype/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'method of external named import used inside prototype method (#68)', context: { // override require here, making "foo" appear as a global module @@ -12,4 +12,4 @@ module.exports = { options: { external: ['bar'] } -}; +}); diff --git a/test/function/samples/namespace-keys-are-sorted/_config.js b/test/function/samples/namespace-keys-are-sorted/_config.js index 0e48cf4e368..8c49c57fb2c 100644 --- a/test/function/samples/namespace-keys-are-sorted/_config.js +++ b/test/function/samples/namespace-keys-are-sorted/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'supports sorted namespace keys' -}; +}); diff --git a/test/function/samples/namespace-literal-value/_config.js b/test/function/samples/namespace-literal-value/_config.js index 8ad52a0cd78..07297018242 100644 --- a/test/function/samples/namespace-literal-value/_config.js +++ b/test/function/samples/namespace-literal-value/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not simplify accessing unknown properties from namespaces', exports({ isNull }) { assert.strictEqual(isNull('a'), true); assert.strictEqual(isNull('b'), false); } -}; +}); diff --git a/test/function/samples/namespace-member-side-effects/assignment/_config.js b/test/function/samples/namespace-member-side-effects/assignment/_config.js index 21a61ce1cf2..e60754de781 100644 --- a/test/function/samples/namespace-member-side-effects/assignment/_config.js +++ b/test/function/samples/namespace-member-side-effects/assignment/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'checks side effects when reassigning namespace members', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/namespace-member-side-effects/call/_config.js b/test/function/samples/namespace-member-side-effects/call/_config.js index 379e790ec86..2c88f17e7e5 100644 --- a/test/function/samples/namespace-member-side-effects/call/_config.js +++ b/test/function/samples/namespace-member-side-effects/call/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'checks side effects when calling a namespace', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/namespace-member-side-effects/member-call/_config.js b/test/function/samples/namespace-member-side-effects/member-call/_config.js index 5bb38b65bd7..6898b7ef559 100644 --- a/test/function/samples/namespace-member-side-effects/member-call/_config.js +++ b/test/function/samples/namespace-member-side-effects/member-call/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'respects side effects when namespace members are called' -}; +}); diff --git a/test/function/samples/namespace-member-side-effects/missing-access/_config.js b/test/function/samples/namespace-member-side-effects/missing-access/_config.js index 918d8568f1e..0b3f7d78605 100644 --- a/test/function/samples/namespace-member-side-effects/missing-access/_config.js +++ b/test/function/samples/namespace-member-side-effects/missing-access/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'respects side effects when accessing missing namespace members', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/namespace-member-side-effects/unknown-access/_config.js b/test/function/samples/namespace-member-side-effects/unknown-access/_config.js index ca30e0cb585..60d9f90176d 100644 --- a/test/function/samples/namespace-member-side-effects/unknown-access/_config.js +++ b/test/function/samples/namespace-member-side-effects/unknown-access/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'respects side effects when accessing unknown namespace members', options: { external: ['external'], treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/namespace-missing-export/_config.js b/test/function/samples/namespace-missing-export/_config.js index 2fda1374d59..33e436e49fc 100644 --- a/test/function/samples/namespace-missing-export/_config.js +++ b/test/function/samples/namespace-missing-export/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_EMPTY = path.join(__dirname, 'empty.js'); -module.exports = { +module.exports = defineTest({ description: 'replaces missing namespace members with undefined and warns about them', warnings: [ { @@ -25,4 +25,4 @@ module.exports = { ^` } ] -}; +}); diff --git a/test/function/samples/namespace-override/_config.js b/test/function/samples/namespace-override/_config.js index e8fd15a1f05..16502433322 100644 --- a/test/function/samples/namespace-override/_config.js +++ b/test/function/samples/namespace-override/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not warn when overriding namespace reexports with explicit ones' -}; +}); diff --git a/test/function/samples/namespace-reassign-import-fails/_config.js b/test/function/samples/namespace-reassign-import-fails/_config.js index 0a94bdf085c..fccf0274364 100644 --- a/test/function/samples/namespace-reassign-import-fails/_config.js +++ b/test/function/samples/namespace-reassign-import-fails/_config.js @@ -4,7 +4,7 @@ const { assertIncludes } = require('../../../utils.js'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for reassignments to namespace exports', code(code) { assertIncludes(code, 'foo = 2'); @@ -67,6 +67,6 @@ module.exports = { runtimeError(error) { assert.strictEqual(error.message, 'Assignment to constant variable.'); } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/namespace-reassign-import-fails diff --git a/test/function/samples/namespace-tostring/dynamic-import-default-mode/_config.js b/test/function/samples/namespace-tostring/dynamic-import-default-mode/_config.js index 1eb89a23f4a..2f680fad574 100644 --- a/test/function/samples/namespace-tostring/dynamic-import-default-mode/_config.js +++ b/test/function/samples/namespace-tostring/dynamic-import-default-mode/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports of entry chunks with default export mode', options: { @@ -15,4 +15,4 @@ module.exports = { assert.strictEqual(Object.prototype.toString.call(foo), '[object Module]'); assert.strictEqual(foo.default, 42); } -}; +}); diff --git a/test/function/samples/namespace-tostring/dynamic-import/_config.js b/test/function/samples/namespace-tostring/dynamic-import/_config.js index 4aed81c65a9..5a31d438523 100644 --- a/test/function/samples/namespace-tostring/dynamic-import/_config.js +++ b/test/function/samples/namespace-tostring/dynamic-import/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to dynamic imports', options: { output: { @@ -18,4 +18,4 @@ module.exports = { assert.strictEqual(Object.prototype.toString.call(copied), '[object Object]'); assert.strictEqual(copied[Symbol.toStringTag], undefined); } -}; +}); diff --git a/test/function/samples/namespace-tostring/entry-default/_config.js b/test/function/samples/namespace-tostring/entry-default/_config.js index e4c1791fc8b..d01569bbdb2 100644 --- a/test/function/samples/namespace-tostring/entry-default/_config.js +++ b/test/function/samples/namespace-tostring/entry-default/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not add Symbol.toStringTag property to entry chunks with default export mode', options: { output: { @@ -13,4 +13,4 @@ module.exports = { assert.strictEqual(Object.prototype.toString.call(exports), '[object Object]'); assert.strictEqual(exports.foo, 42); } -}; +}); diff --git a/test/function/samples/namespace-tostring/entry-named/_config.js b/test/function/samples/namespace-tostring/entry-named/_config.js index 93a5a4c2072..f7b51b78b2b 100644 --- a/test/function/samples/namespace-tostring/entry-named/_config.js +++ b/test/function/samples/namespace-tostring/entry-named/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to entry chunks with named exports', options: { output: { @@ -18,4 +18,4 @@ module.exports = { assert.strictEqual(Object.prototype.toString.call(copied), '[object Object]'); assert.strictEqual(copied[Symbol.toStringTag], undefined); } -}; +}); diff --git a/test/function/samples/namespace-tostring/external-namespaces/_config.js b/test/function/samples/namespace-tostring/external-namespaces/_config.js index ea2e29dfe04..3006d93c60b 100644 --- a/test/function/samples/namespace-tostring/external-namespaces/_config.js +++ b/test/function/samples/namespace-tostring/external-namespaces/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to external namespaces', options: { external(id) { @@ -29,4 +29,4 @@ module.exports = { return { foo: 42 }; } } -}; +}); diff --git a/test/function/samples/namespace-tostring/inlined-namespace/_config.js b/test/function/samples/namespace-tostring/inlined-namespace/_config.js index 4e489178028..84f1a0b3d2c 100644 --- a/test/function/samples/namespace-tostring/inlined-namespace/_config.js +++ b/test/function/samples/namespace-tostring/inlined-namespace/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'adds Symbol.toStringTag property to inlined namespaces', options: { output: { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/function/samples/namespace-tostring/interop-property-descriptor/_config.js b/test/function/samples/namespace-tostring/interop-property-descriptor/_config.js index 0aa022a9925..37661d70c8f 100644 --- a/test/function/samples/namespace-tostring/interop-property-descriptor/_config.js +++ b/test/function/samples/namespace-tostring/interop-property-descriptor/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'generated interop namespaces should have correct Symbol.toStringTag', context: { require() { @@ -16,4 +16,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/namespace-tostring/property-descriptor/_config.js b/test/function/samples/namespace-tostring/property-descriptor/_config.js index fd8251ad12d..cd74750611a 100644 --- a/test/function/samples/namespace-tostring/property-descriptor/_config.js +++ b/test/function/samples/namespace-tostring/property-descriptor/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'namespace export should have @@toStringTag with correct property descriptors #4336', options: { output: { generatedCode: { symbols: true } } } -}; +}); diff --git a/test/function/samples/namespace-update-import-fails/_config.js b/test/function/samples/namespace-update-import-fails/_config.js index e03bf89bb28..d4c95497bb9 100644 --- a/test/function/samples/namespace-update-import-fails/_config.js +++ b/test/function/samples/namespace-update-import-fails/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const { assertIncludes } = require('../../../utils.js'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows updates to namespace exports', code(code) { assertIncludes(code, 'foo++'); @@ -29,6 +29,6 @@ module.exports = { runtimeError(error) { assert.strictEqual(error.message, 'Assignment to constant variable.'); } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/namespace-update-import-fails diff --git a/test/function/samples/namespaces-are-frozen/_config.js b/test/function/samples/namespaces-are-frozen/_config.js index 891965e91f6..cd3cfa710c5 100644 --- a/test/function/samples/namespaces-are-frozen/_config.js +++ b/test/function/samples/namespaces-are-frozen/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'namespaces should be non-extensible and its properties immutatable and non-configurable', @@ -19,7 +19,7 @@ module.exports = { mutate(ns); }); } -}; +}); function extend(object) { 'use strict'; diff --git a/test/function/samples/namespaces-have-null-prototype/_config.js b/test/function/samples/namespaces-have-null-prototype/_config.js index d64597e0b9f..bdcb27927b1 100644 --- a/test/function/samples/namespaces-have-null-prototype/_config.js +++ b/test/function/samples/namespaces-have-null-prototype/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'creates namespaces with null prototypes' -}; +}); diff --git a/test/function/samples/namespacing-collisions-2/_config.js b/test/function/samples/namespacing-collisions-2/_config.js index 6c17bcfc876..bc01f4f5e53 100644 --- a/test/function/samples/namespacing-collisions-2/_config.js +++ b/test/function/samples/namespacing-collisions-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly namespaces when using * exports, take two (#910)', exports(exports) { assert.deepEqual(exports, ['Material', 'MaterialAgain', 'Something', 'SomethingAgain']); } -}; +}); diff --git a/test/function/samples/namespacing-collisions/_config.js b/test/function/samples/namespacing-collisions/_config.js index cc6eeba6aa7..905caf5f41a 100644 --- a/test/function/samples/namespacing-collisions/_config.js +++ b/test/function/samples/namespacing-collisions/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly namespaces when using * exports (#910)', exports(exports) { assert.deepStrictEqual(exports, ['Material', 'Something']); } -}; +}); diff --git a/test/function/samples/namespacing-in-sub-functions/_config.js b/test/function/samples/namespacing-in-sub-functions/_config.js index 2c984d987bd..5f870676190 100644 --- a/test/function/samples/namespacing-in-sub-functions/_config.js +++ b/test/function/samples/namespacing-in-sub-functions/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly namespaces sub-functions (#910)', exports(exports) { assert.equal(exports, 'foobar'); } -}; +}); diff --git a/test/function/samples/nested-and-async-plugin/_config.js b/test/function/samples/nested-and-async-plugin/_config.js index 414bab3cf72..4fefef40c11 100644 --- a/test/function/samples/nested-and-async-plugin/_config.js +++ b/test/function/samples/nested-and-async-plugin/_config.js @@ -15,10 +15,10 @@ const pluginB = Promise.resolve({ } }); -module.exports = { +module.exports = defineTest({ description: 'works when nested plugin', options: { // eslint-disable-next-line no-sparse-arrays plugins: [[Promise.resolve(pluginA)], [undefined, Promise.resolve([null])], ,] } -}; +}); diff --git a/test/function/samples/nested-foreach/_config.js b/test/function/samples/nested-foreach/_config.js index 5ef1bc6afe3..53e8cf59b53 100644 --- a/test/function/samples/nested-foreach/_config.js +++ b/test/function/samples/nested-foreach/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'detects side-effects in nested .forEach calls (#3533)', exports: exports => assert.strictEqual(exports.result, 9) -}; +}); diff --git a/test/function/samples/nested-inlined-dynamic-import-1/_config.js b/test/function/samples/nested-inlined-dynamic-import-1/_config.js index 377d3c43e4b..57985c03fac 100644 --- a/test/function/samples/nested-inlined-dynamic-import-1/_config.js +++ b/test/function/samples/nested-inlined-dynamic-import-1/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables when nested dynamic imports are inlined via inlineDynamicImports', options: { @@ -9,4 +9,4 @@ module.exports = { exports(exports) { return exports().then(result => assert.strictEqual(result, 43)); } -}; +}); diff --git a/test/function/samples/nested-inlined-dynamic-import-2/_config.js b/test/function/samples/nested-inlined-dynamic-import-2/_config.js index 6b77e36a93f..afeaa07b397 100644 --- a/test/function/samples/nested-inlined-dynamic-import-2/_config.js +++ b/test/function/samples/nested-inlined-dynamic-import-2/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_LIB1 = path.join(__dirname, 'lib1.js'); const ID_LIB2 = path.join(__dirname, 'lib2.js'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables when nested dynamic imports are inlined', warnings: [ { @@ -15,4 +15,4 @@ module.exports = { exports(exports) { return exports().then(result => assert.strictEqual(result, 43)); } -}; +}); diff --git a/test/function/samples/nested-namespace-member-expression/_config.js b/test/function/samples/nested-namespace-member-expression/_config.js index df019ed1c45..1667bb77f9e 100644 --- a/test/function/samples/nested-namespace-member-expression/_config.js +++ b/test/function/samples/nested-namespace-member-expression/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles accessing members of namespaces correctly', exports(exports) { assert.strictEqual(exports, false); } -}; +}); diff --git a/test/function/samples/nested-property-call-performance/_config.js b/test/function/samples/nested-property-call-performance/_config.js index 31df4ed7615..bcef3ccdff8 100644 --- a/test/function/samples/nested-property-call-performance/_config.js +++ b/test/function/samples/nested-property-call-performance/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles nested property calls with acceptable performance' -}; +}); diff --git a/test/function/samples/new-target-meta/_config.js b/test/function/samples/new-target-meta/_config.js index 3f2fb6ea8fb..653ce117be9 100644 --- a/test/function/samples/new-target-meta/_config.js +++ b/test/function/samples/new-target-meta/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not change new.target usages' -}; +}); diff --git a/test/function/samples/newline-after-comment/_config.js b/test/function/samples/newline-after-comment/_config.js index 658abe5c263..0b4b8516b31 100644 --- a/test/function/samples/newline-after-comment/_config.js +++ b/test/function/samples/newline-after-comment/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'inserts newline after comment', exports(exports) { assert.equal(exports(), 42); } -}; +}); diff --git a/test/function/samples/no-external-live-bindings-compact/_config.js b/test/function/samples/no-external-live-bindings-compact/_config.js index 665849c4f47..47b8962979f 100644 --- a/test/function/samples/no-external-live-bindings-compact/_config.js +++ b/test/function/samples/no-external-live-bindings-compact/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Allows omitting the code that handles external live bindings', options: { external: () => true, @@ -35,4 +35,4 @@ module.exports = { }) ); } -}; +}); diff --git a/test/function/samples/no-external-live-bindings/_config.js b/test/function/samples/no-external-live-bindings/_config.js index 42d4a8a6bde..c64b44028f0 100644 --- a/test/function/samples/no-external-live-bindings/_config.js +++ b/test/function/samples/no-external-live-bindings/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Allows omitting the code that handles external live bindings', options: { external: () => true, @@ -34,4 +34,4 @@ module.exports = { }) ); } -}; +}); diff --git a/test/function/samples/no-imports/_config.js b/test/function/samples/no-imports/_config.js index be6c448555e..5a78cb28118 100644 --- a/test/function/samples/no-imports/_config.js +++ b/test/function/samples/no-imports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'creates a bundle from a module with no imports' -}; +}); diff --git a/test/function/samples/no-relative-external/_config.js b/test/function/samples/no-relative-external/_config.js index cff5507aa2c..37a9d861e3c 100644 --- a/test/function/samples/no-relative-external/_config.js +++ b/test/function/samples/no-relative-external/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'missing relative imports are an error, not a warning', error: { code: 'UNRESOLVED_IMPORT', @@ -10,4 +10,4 @@ module.exports = { watchFiles: [ID_MAIN], message: 'Could not resolve "./missing.js" from "main.js"' } -}; +}); diff --git a/test/function/samples/non-extension-dot/_config.js b/test/function/samples/non-extension-dot/_config.js index 3f29d797da9..3095f7fe3d6 100644 --- a/test/function/samples/non-extension-dot/_config.js +++ b/test/function/samples/non-extension-dot/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'adds .js to module paths with non-extension dots in them' -}; +}); diff --git a/test/function/samples/non-function-hook-async/_config.js b/test/function/samples/non-function-hook-async/_config.js index 800df0aaa90..fb9aabc78ef 100644 --- a/test/function/samples/non-function-hook-async/_config.js +++ b/test/function/samples/non-function-hook-async/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when providing a value for an async function hook', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { 'Error running plugin hook "resolveId" for plugin "at position 1", expected a function hook or an object with a "handler" function.', plugin: 'at position 1' } -}; +}); diff --git a/test/function/samples/non-function-hook-sync/_config.js b/test/function/samples/non-function-hook-sync/_config.js index 78f9af86212..f592d0883e0 100644 --- a/test/function/samples/non-function-hook-sync/_config.js +++ b/test/function/samples/non-function-hook-sync/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when providing a value for a sync function hook', options: { plugins: { @@ -12,4 +12,4 @@ module.exports = { 'Error running plugin hook "outputOptions" for plugin "at position 1", expected a function hook or an object with a "handler" function.', plugin: 'at position 1' } -}; +}); diff --git a/test/function/samples/non-js-extensions/_config.js b/test/function/samples/non-js-extensions/_config.js index b83a8751be0..bfa68d294af 100644 --- a/test/function/samples/non-js-extensions/_config.js +++ b/test/function/samples/non-js-extensions/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'non .js extensions are preserved', options: { plugins: [ @@ -13,4 +13,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/object-deep-access-effect/_config.js b/test/function/samples/object-deep-access-effect/_config.js index 458e437cea9..bc6d80ea127 100644 --- a/test/function/samples/object-deep-access-effect/_config.js +++ b/test/function/samples/object-deep-access-effect/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when an nested property of an unknown object property is accessed', context: { require() { @@ -8,4 +8,4 @@ module.exports = { options: { external: ['external'] } -}; +}); diff --git a/test/function/samples/object-destructuring-renaming/_config.js b/test/function/samples/object-destructuring-renaming/_config.js index c5baa0f7f26..c43e833e21b 100644 --- a/test/function/samples/object-destructuring-renaming/_config.js +++ b/test/function/samples/object-destructuring-renaming/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'renaming destructured object properties should request the correct property (#527)', exports(exports) { assert.equal(exports.env, process.env); } -}; +}); diff --git a/test/function/samples/object-dynamic-properties/_config.js b/test/function/samples/object-dynamic-properties/_config.js index 1bcd2fa3611..a54d8060d49 100644 --- a/test/function/samples/object-dynamic-properties/_config.js +++ b/test/function/samples/object-dynamic-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'dynamic object assignments should be imported' -}; +}); diff --git a/test/function/samples/object-expression-shadowed-properties/_config.js b/test/function/samples/object-expression-shadowed-properties/_config.js index 96c70b08662..b07e9093bde 100644 --- a/test/function/samples/object-expression-shadowed-properties/_config.js +++ b/test/function/samples/object-expression-shadowed-properties/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'do not remove calls to object expression methods that may have side-effects when properties may be shadowed', context: { unknownA: 'a', unknownB: 'b' } -}; +}); diff --git a/test/function/samples/object-properties/_config.js b/test/function/samples/object-properties/_config.js index 46d096af44a..cd8ec59de21 100644 --- a/test/function/samples/object-properties/_config.js +++ b/test/function/samples/object-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes object properties in definitions' -}; +}); diff --git a/test/function/samples/object-prototype-properties/_config.js b/test/function/samples/object-prototype-properties/_config.js index 258727cc3bb..4c4c48b8a31 100644 --- a/test/function/samples/object-prototype-properties/_config.js +++ b/test/function/samples/object-prototype-properties/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles names conflicting with Object.prototype properties' -}; +}); diff --git a/test/function/samples/object-spread-side-effect/_config.js b/test/function/samples/object-spread-side-effect/_config.js index bf01828fab0..16841b87bc1 100644 --- a/test/function/samples/object-spread-side-effect/_config.js +++ b/test/function/samples/object-spread-side-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'triggers getter side effects when spreading objects' -}; +}); diff --git a/test/function/samples/optional-catch-binding/_config.js b/test/function/samples/optional-catch-binding/_config.js index 2c4566b70f5..5f8cc6162a1 100644 --- a/test/function/samples/optional-catch-binding/_config.js +++ b/test/function/samples/optional-catch-binding/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows optional catch binding with appropriate acorn settings', exports(exports) { assert.equal(exports.foo, true); } -}; +}); diff --git a/test/function/samples/optional-chaining-side-effect/_config.js b/test/function/samples/optional-chaining-side-effect/_config.js index 99be03b8def..24d7316b6bb 100644 --- a/test/function/samples/optional-chaining-side-effect/_config.js +++ b/test/function/samples/optional-chaining-side-effect/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles side effects in optional chaining (#4806)', exports({ get, set }) { set(['test']); assert.strictEqual(get('test'), 't'); } -}; +}); diff --git a/test/function/samples/options-async-hook/_config.js b/test/function/samples/options-async-hook/_config.js index 78bb869f19f..382cb0bac23 100644 --- a/test/function/samples/options-async-hook/_config.js +++ b/test/function/samples/options-async-hook/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { promises: fs } = require('node:fs'); -module.exports = { +module.exports = defineTest({ description: 'resolves promises between sequential options hooks', options: { input: 'super-unused', @@ -28,4 +28,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/options-hook/_config.js b/test/function/samples/options-hook/_config.js index 60ac9ec0e00..42f6cc2f13d 100644 --- a/test/function/samples/options-hook/_config.js +++ b/test/function/samples/options-hook/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows to read and modify options in the options hook', options: { input: 'unused', @@ -51,4 +51,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/options-in-renderstart/_config.js b/test/function/samples/options-in-renderstart/_config.js index 3d7049e2b16..5ffe74bfaaf 100644 --- a/test/function/samples/options-in-renderstart/_config.js +++ b/test/function/samples/options-in-renderstart/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const checkedOptions = []; -module.exports = { +module.exports = defineTest({ description: 'makes input and output options available in renderStart', options: { context: 'global', @@ -30,4 +30,4 @@ module.exports = { 'global' ]); } -}; +}); diff --git a/test/function/samples/output-options-hook/_config.js b/test/function/samples/output-options-hook/_config.js index d4083e94e07..b4ff287f121 100644 --- a/test/function/samples/output-options-hook/_config.js +++ b/test/function/samples/output-options-hook/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows to read and modify options in the options hook', exports(exports) { assert.deepStrictEqual(exports, { @@ -76,4 +76,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/override-external-namespace/_config.js b/test/function/samples/override-external-namespace/_config.js index a3116ed463a..0ce2f804a5a 100644 --- a/test/function/samples/override-external-namespace/_config.js +++ b/test/function/samples/override-external-namespace/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows overriding imports of external namespace reexports', options: { external: 'path' @@ -13,4 +13,4 @@ module.exports = { exports.reassign(); assert.strictEqual(exports.resolve, 'defined'); } -}; +}); diff --git a/test/function/samples/override-static-external-namespace/_config.js b/test/function/samples/override-static-external-namespace/_config.js index 320f89f1e5e..44409f65263 100644 --- a/test/function/samples/override-static-external-namespace/_config.js +++ b/test/function/samples/override-static-external-namespace/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'allows overriding imports of external namespace reexports without external live-bindings', options: { @@ -17,4 +17,4 @@ module.exports = { exports.reassign(); assert.strictEqual(exports.resolve, 'defined'); } -}; +}); diff --git a/test/function/samples/parameter-defaults/arrays/_config.js b/test/function/samples/parameter-defaults/arrays/_config.js index 22ea9b87836..12e61487e58 100644 --- a/test/function/samples/parameter-defaults/arrays/_config.js +++ b/test/function/samples/parameter-defaults/arrays/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults for array elements' -}; +}); diff --git a/test/function/samples/parameter-defaults/class-fields/_config.js b/test/function/samples/parameter-defaults/class-fields/_config.js index 88efb89a967..8d2e22acba1 100644 --- a/test/function/samples/parameter-defaults/class-fields/_config.js +++ b/test/function/samples/parameter-defaults/class-fields/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults for class fields' -}; +}); diff --git a/test/function/samples/parameter-defaults/exported/_config.js b/test/function/samples/parameter-defaults/exported/_config.js index a58bbadeced..63514ca6530 100644 --- a/test/function/samples/parameter-defaults/exported/_config.js +++ b/test/function/samples/parameter-defaults/exported/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'includes default parameters for exported functions', exports({ funDecl, funExp, arrow }) { assert.strictEqual(funDecl(), 'defaultValue', 'function declaration'); assert.strictEqual(funExp(), 'defaultValue', 'function expression'); assert.strictEqual(arrow(), 'defaultValue', 'arrow function'); } -}; +}); diff --git a/test/function/samples/parameter-defaults/function-as-default/_config.js b/test/function/samples/parameter-defaults/function-as-default/_config.js index 5a1f0628785..6c3745d9e93 100644 --- a/test/function/samples/parameter-defaults/function-as-default/_config.js +++ b/test/function/samples/parameter-defaults/function-as-default/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes functions supplied as default values' -}; +}); diff --git a/test/function/samples/parameter-defaults/function-return/_config.js b/test/function/samples/parameter-defaults/function-return/_config.js index d9edae38255..d21db6c718e 100644 --- a/test/function/samples/parameter-defaults/function-return/_config.js +++ b/test/function/samples/parameter-defaults/function-return/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks parameter defaults for returned functions' -}; +}); diff --git a/test/function/samples/parameter-defaults/logical-expressions/_config.js b/test/function/samples/parameter-defaults/logical-expressions/_config.js index 69d69853719..99b64bd5eb2 100644 --- a/test/function/samples/parameter-defaults/logical-expressions/_config.js +++ b/test/function/samples/parameter-defaults/logical-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes default parameters in logical expressios' -}; +}); diff --git a/test/function/samples/parameter-defaults/module-side-effects/_config.js b/test/function/samples/parameter-defaults/module-side-effects/_config.js index 39e073d8c7d..66497faaa0b 100644 --- a/test/function/samples/parameter-defaults/module-side-effects/_config.js +++ b/test/function/samples/parameter-defaults/module-side-effects/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'does not tree-shake necessary parameter defaults when modulesSideEffects are disabled', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/function/samples/parameter-defaults/objects/_config.js b/test/function/samples/parameter-defaults/objects/_config.js index d0715d225bc..72f3b276774 100644 --- a/test/function/samples/parameter-defaults/objects/_config.js +++ b/test/function/samples/parameter-defaults/objects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults for methods in objects' -}; +}); diff --git a/test/function/samples/parameter-defaults/return-expressions/_config.js b/test/function/samples/parameter-defaults/return-expressions/_config.js index 3f3dcca5c3b..fe72312b818 100644 --- a/test/function/samples/parameter-defaults/return-expressions/_config.js +++ b/test/function/samples/parameter-defaults/return-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults for returned expressions' -}; +}); diff --git a/test/function/samples/parameter-defaults/super-classes/_config.js b/test/function/samples/parameter-defaults/super-classes/_config.js index 290793fd4de..e1df2f59e12 100644 --- a/test/function/samples/parameter-defaults/super-classes/_config.js +++ b/test/function/samples/parameter-defaults/super-classes/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults for super classes' -}; +}); diff --git a/test/function/samples/parameter-defaults/tagged-templates/_config.js b/test/function/samples/parameter-defaults/tagged-templates/_config.js index 6e2f4a704b6..200eeb118e2 100644 --- a/test/function/samples/parameter-defaults/tagged-templates/_config.js +++ b/test/function/samples/parameter-defaults/tagged-templates/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'includes necessary default parameters for tagged template literals' -}; +}); diff --git a/test/function/samples/parameter-defaults/try-catch/_config.js b/test/function/samples/parameter-defaults/try-catch/_config.js index 6bc80c6b7e9..7236445903a 100644 --- a/test/function/samples/parameter-defaults/try-catch/_config.js +++ b/test/function/samples/parameter-defaults/try-catch/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'keeps parameter defaults when called from try-statement' -}; +}); diff --git a/test/function/samples/parameter-side-effects/_config.js b/test/function/samples/parameter-side-effects/_config.js index a2379c5f5c8..c9f1ce0fecf 100644 --- a/test/function/samples/parameter-side-effects/_config.js +++ b/test/function/samples/parameter-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'retains calls with parameter side effects' -}; +}); diff --git a/test/function/samples/parenthesised-default-export/_config.js b/test/function/samples/parenthesised-default-export/_config.js index 65de328c187..18f4cfef73e 100644 --- a/test/function/samples/parenthesised-default-export/_config.js +++ b/test/function/samples/parenthesised-default-export/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows default exports to be enclosed in parentheses' -}; +}); diff --git a/test/function/samples/pass-namespace-to-function/_config.js b/test/function/samples/pass-namespace-to-function/_config.js index d93fddb6e6b..6995cca2961 100644 --- a/test/function/samples/pass-namespace-to-function/_config.js +++ b/test/function/samples/pass-namespace-to-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows a namespace to be passed to a function' -}; +}); diff --git a/test/function/samples/paths-are-case-sensitive/_config.js b/test/function/samples/paths-are-case-sensitive/_config.js index fffd9454364..f6943a314c4 100644 --- a/test/function/samples/paths-are-case-sensitive/_config.js +++ b/test/function/samples/paths-are-case-sensitive/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'insists on correct casing for imports', error: { code: 'UNRESOLVED_IMPORT', @@ -10,4 +10,4 @@ module.exports = { watchFiles: [ID_MAIN], message: 'Could not resolve "./foo.js" from "main.js"' } -}; +}); diff --git a/test/function/samples/per-output-plugins-warn-hooks/_config.js b/test/function/samples/per-output-plugins-warn-hooks/_config.js index 446269bb422..7cbd090f18c 100644 --- a/test/function/samples/per-output-plugins-warn-hooks/_config.js +++ b/test/function/samples/per-output-plugins-warn-hooks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns when input hooks are used in output plugins', options: { output: { @@ -74,4 +74,4 @@ module.exports = { 'The "buildStart" hook used by the output plugin at output position 2 is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.' } ] -}; +}); diff --git a/test/function/samples/perf-adds-plugin-context-to-plugins/_config.js b/test/function/samples/perf-adds-plugin-context-to-plugins/_config.js index 92b0d0fddb7..677d299eae7 100644 --- a/test/function/samples/perf-adds-plugin-context-to-plugins/_config.js +++ b/test/function/samples/perf-adds-plugin-context-to-plugins/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Adds plugin context to plugins with perf=true', options: { perf: true, @@ -24,4 +24,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/perf-supports-object-hooks/_config.js b/test/function/samples/perf-supports-object-hooks/_config.js index 84e0155413e..47523617555 100644 --- a/test/function/samples/perf-supports-object-hooks/_config.js +++ b/test/function/samples/perf-supports-object-hooks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Supports object hooks with perf=true', options: { perf: true, @@ -13,4 +13,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/plugin-cache/anonymous-delete/_config.js b/test/function/samples/plugin-cache/anonymous-delete/_config.js index 8d9a9ef6e1a..ce7dbf23340 100644 --- a/test/function/samples/plugin-cache/anonymous-delete/_config.js +++ b/test/function/samples/plugin-cache/anonymous-delete/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for anonymous plugins deleting from the cache', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'ANONYMOUS_PLUGIN_CACHE' } -}; +}); diff --git a/test/function/samples/plugin-cache/anonymous-get/_config.js b/test/function/samples/plugin-cache/anonymous-get/_config.js index 9a25655aa12..8dbacf0d3a2 100644 --- a/test/function/samples/plugin-cache/anonymous-get/_config.js +++ b/test/function/samples/plugin-cache/anonymous-get/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for anonymous plugins reading the cache', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'ANONYMOUS_PLUGIN_CACHE' } -}; +}); diff --git a/test/function/samples/plugin-cache/anonymous-has/_config.js b/test/function/samples/plugin-cache/anonymous-has/_config.js index f6d37f0485e..ef142eda86e 100644 --- a/test/function/samples/plugin-cache/anonymous-has/_config.js +++ b/test/function/samples/plugin-cache/anonymous-has/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for anonymous plugins checking the cache', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'ANONYMOUS_PLUGIN_CACHE' } -}; +}); diff --git a/test/function/samples/plugin-cache/anonymous-set/_config.js b/test/function/samples/plugin-cache/anonymous-set/_config.js index c12e533586c..5349a523437 100644 --- a/test/function/samples/plugin-cache/anonymous-set/_config.js +++ b/test/function/samples/plugin-cache/anonymous-set/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for anonymous plugins adding to the cache', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { plugin: 'at position 1', pluginCode: 'ANONYMOUS_PLUGIN_CACHE' } -}; +}); diff --git a/test/function/samples/plugin-cache/duplicate-names-no-cache/_config.js b/test/function/samples/plugin-cache/duplicate-names-no-cache/_config.js index 780240d100b..eb95b812345 100644 --- a/test/function/samples/plugin-cache/duplicate-names-no-cache/_config.js +++ b/test/function/samples/plugin-cache/duplicate-names-no-cache/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'allows plugins to have the same name if they do not access the cache', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/plugin-cache/duplicate-names/_config.js b/test/function/samples/plugin-cache/duplicate-names/_config.js index bf9f5a7af39..3a12be306c3 100644 --- a/test/function/samples/plugin-cache/duplicate-names/_config.js +++ b/test/function/samples/plugin-cache/duplicate-names/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws if two plugins with the same name and no cache key access the cache', options: { plugins: [ @@ -24,4 +24,4 @@ module.exports = { plugin: 'test-plugin', pluginCode: 'DUPLICATE_PLUGIN_NAME' } -}; +}); diff --git a/test/function/samples/plugin-error-loc-instead-pos/_config.js b/test/function/samples/plugin-error-loc-instead-pos/_config.js index a1f33e5ae6d..8619397ece3 100644 --- a/test/function/samples/plugin-error-loc-instead-pos/_config.js +++ b/test/function/samples/plugin-error-loc-instead-pos/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: '`this.error(...)` accepts { line, column } object as second parameter (#1265)', options: { plugins: [ @@ -29,4 +29,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/plugin-error-module-parsed/_config.js b/test/function/samples/plugin-error-module-parsed/_config.js index 81f0f542ec6..53a0e53fd8d 100644 --- a/test/function/samples/plugin-error-module-parsed/_config.js +++ b/test/function/samples/plugin-error-module-parsed/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'errors in moduleParsed abort the build', options: { plugins: [ @@ -19,4 +19,4 @@ module.exports = { plugin: 'testPlugin', watchFiles: [path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/plugin-error-only-first-render-chunk/_config.js b/test/function/samples/plugin-error-only-first-render-chunk/_config.js index 00579cfa684..0e328c029c0 100644 --- a/test/function/samples/plugin-error-only-first-render-chunk/_config.js +++ b/test/function/samples/plugin-error-only-first-render-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws error only with first plugin renderChunk', options: { plugins: [ @@ -22,4 +22,4 @@ module.exports = { hook: 'renderChunk', message: `Something happened 1` } -}; +}); diff --git a/test/function/samples/plugin-error-only-first-transform/_config.js b/test/function/samples/plugin-error-only-first-transform/_config.js index 64a343ff699..f36043808d1 100644 --- a/test/function/samples/plugin-error-only-first-transform/_config.js +++ b/test/function/samples/plugin-error-only-first-transform/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'throws error only with first plugin transform', options: { plugins: [ @@ -26,4 +26,4 @@ module.exports = { id: path.join(__dirname, 'main.js'), watchFiles: [path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/plugin-error-should-transform/_config.js b/test/function/samples/plugin-error-should-transform/_config.js index 69372cfd53a..a7417a9b78c 100644 --- a/test/function/samples/plugin-error-should-transform/_config.js +++ b/test/function/samples/plugin-error-should-transform/_config.js @@ -4,7 +4,7 @@ const acorn = require('acorn'); const code = 'export default 42;\n'; const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'errors in shouldTransformCachedModule abort the build', options: { cache: { @@ -41,4 +41,4 @@ module.exports = { plugin: 'test', watchFiles: [ID_MAIN] } -}; +}); diff --git a/test/function/samples/plugin-error/buildEnd/_config.js b/test/function/samples/plugin-error/buildEnd/_config.js index 0f3c27d4143..327db966a4a 100644 --- a/test/function/samples/plugin-error/buildEnd/_config.js +++ b/test/function/samples/plugin-error/buildEnd/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'buildEnd' } -}; +}); diff --git a/test/function/samples/plugin-error/buildStart/_config.js b/test/function/samples/plugin-error/buildStart/_config.js index 47657147100..6ea085f42fc 100644 --- a/test/function/samples/plugin-error/buildStart/_config.js +++ b/test/function/samples/plugin-error/buildStart/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'buildStart' } -}; +}); diff --git a/test/function/samples/plugin-error/generateBundle/_config.js b/test/function/samples/plugin-error/generateBundle/_config.js index 27ca00e7e9d..7e17c2b92aa 100644 --- a/test/function/samples/plugin-error/generateBundle/_config.js +++ b/test/function/samples/plugin-error/generateBundle/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'generateBundle' } -}; +}); diff --git a/test/function/samples/plugin-error/load/_config.js b/test/function/samples/plugin-error/load/_config.js index 6f6ed0b8a1a..270ef537b52 100644 --- a/test/function/samples/plugin-error/load/_config.js +++ b/test/function/samples/plugin-error/load/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -19,4 +19,4 @@ module.exports = { hook: 'load', watchFiles: [path.join(__dirname, 'main.js')] } -}; +}); diff --git a/test/function/samples/plugin-error/renderChunk/_config.js b/test/function/samples/plugin-error/renderChunk/_config.js index 3cf2fb6ad5c..dcc254529b6 100644 --- a/test/function/samples/plugin-error/renderChunk/_config.js +++ b/test/function/samples/plugin-error/renderChunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'renderChunk' } -}; +}); diff --git a/test/function/samples/plugin-error/renderStart/_config.js b/test/function/samples/plugin-error/renderStart/_config.js index 5c7f9551f4f..4756298ddb4 100644 --- a/test/function/samples/plugin-error/renderStart/_config.js +++ b/test/function/samples/plugin-error/renderStart/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'renderStart' } -}; +}); diff --git a/test/function/samples/plugin-error/resolveId/_config.js b/test/function/samples/plugin-error/resolveId/_config.js index 640b704e011..9b3390ca35c 100644 --- a/test/function/samples/plugin-error/resolveId/_config.js +++ b/test/function/samples/plugin-error/resolveId/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'buildStart hooks can use this.error', options: { plugins: [ @@ -16,4 +16,4 @@ module.exports = { message: 'nope', hook: 'resolveId' } -}; +}); diff --git a/test/function/samples/plugin-error/transform/_config.js b/test/function/samples/plugin-error/transform/_config.js index 378d7602c05..1c893155d14 100644 --- a/test/function/samples/plugin-error/transform/_config.js +++ b/test/function/samples/plugin-error/transform/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'plugin transform hooks can use `this.error({...}, char)` (#1140)', options: { plugins: [ @@ -30,4 +30,4 @@ module.exports = { ^ ` } -}; +}); diff --git a/test/function/samples/plugin-module-information-early-access/_config.js b/test/function/samples/plugin-module-information-early-access/_config.js index 334f7941f0b..16e1e96e0cc 100644 --- a/test/function/samples/plugin-module-information-early-access/_config.js +++ b/test/function/samples/plugin-module-information-early-access/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'handles accessing module information via plugins early in a graceful way', options: { external: ['path'], @@ -16,4 +16,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/plugin-module-information-no-cache/_config.js b/test/function/samples/plugin-module-information-no-cache/_config.js index 70ed68986c3..3ea09c6a823 100644 --- a/test/function/samples/plugin-module-information-no-cache/_config.js +++ b/test/function/samples/plugin-module-information-no-cache/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'handles accessing module information via plugins with cache disabled', options: { cache: false, @@ -62,4 +62,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/plugin-module-information/_config.js b/test/function/samples/plugin-module-information/_config.js index 907d4343b97..9890061d0fd 100644 --- a/test/function/samples/plugin-module-information/_config.js +++ b/test/function/samples/plugin-module-information/_config.js @@ -9,7 +9,7 @@ const ID_PATH = 'path'; let rendered = false; -module.exports = { +module.exports = defineTest({ description: 'provides module information on the plugin context', options: { external: ['path'], @@ -451,4 +451,4 @@ module.exports = { bundle() { assert.ok(rendered); } -}; +}); diff --git a/test/function/samples/plugin-parse-ast-receives-comments/_config.js b/test/function/samples/plugin-parse-ast-receives-comments/_config.js index 8339f2fb1e1..2b25e45184e 100644 --- a/test/function/samples/plugin-parse-ast-receives-comments/_config.js +++ b/test/function/samples/plugin-parse-ast-receives-comments/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const comments = []; -module.exports = { +module.exports = defineTest({ description: 'plugin parse ast receives comments', options: { plugins: [ @@ -21,4 +21,4 @@ module.exports = { after() { assert.ok(comments.length > 0); } -}; +}); diff --git a/test/function/samples/plugin-parse-ast-remove-sourcemapping/_config.js b/test/function/samples/plugin-parse-ast-remove-sourcemapping/_config.js index b1d441bd5ae..a9f1387ca80 100644 --- a/test/function/samples/plugin-parse-ast-remove-sourcemapping/_config.js +++ b/test/function/samples/plugin-parse-ast-remove-sourcemapping/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'remove source mapping comment even if code is parsed by PluginContext.parse method', options: { plugins: [ @@ -15,4 +15,4 @@ module.exports = { code(code) { assert.ok(code.search(/sourceMappingURL/) === -1); } -}; +}); diff --git a/test/function/samples/plugin-parse/_config.js b/test/function/samples/plugin-parse/_config.js index 051c389f087..b3e98c64e1e 100644 --- a/test/function/samples/plugin-parse/_config.js +++ b/test/function/samples/plugin-parse/_config.js @@ -1,6 +1,6 @@ const MagicString = require('magic-string'); -module.exports = { +module.exports = defineTest({ description: 'plugin transform hooks can use `this.parse(code, options)`', options: { plugins: [ @@ -14,7 +14,7 @@ module.exports = { } ] } -}; +}); function enforceTheAnswer(ast, magicString) { for (const node of ast.body) { diff --git a/test/function/samples/plugin-warn-loc-instead-pos/_config.js b/test/function/samples/plugin-warn-loc-instead-pos/_config.js index 6815e2055e2..1fe4904b40c 100644 --- a/test/function/samples/plugin-warn-loc-instead-pos/_config.js +++ b/test/function/samples/plugin-warn-loc-instead-pos/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: '`this.warn(...)` accepts { line, column } object as second parameter (#1265)', options: { plugins: [ @@ -31,4 +31,4 @@ module.exports = { ` } ] -}; +}); diff --git a/test/function/samples/plugin-warn/_config.js b/test/function/samples/plugin-warn/_config.js index 27e708a5a5a..32c110eadc7 100644 --- a/test/function/samples/plugin-warn/_config.js +++ b/test/function/samples/plugin-warn/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'plugin transform hooks can use `this.warn({...}, char)` (#1140)', options: { plugins: [ @@ -41,4 +41,4 @@ module.exports = { ` } ] -}; +}); diff --git a/test/function/samples/plugins-can-manipulate-options/_config.js b/test/function/samples/plugins-can-manipulate-options/_config.js index 23ad9ec78b0..90fa3d26b1f 100644 --- a/test/function/samples/plugins-can-manipulate-options/_config.js +++ b/test/function/samples/plugins-can-manipulate-options/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'plugins can manipulate the options object', options: { plugins: [ @@ -15,4 +15,4 @@ module.exports = { exports(answer) { assert.equal(answer, 42); } -}; +}); diff --git a/test/function/samples/preload-after-build/_config.js b/test/function/samples/preload-after-build/_config.js index 11faa824341..408fd1998e5 100644 --- a/test/function/samples/preload-after-build/_config.js +++ b/test/function/samples/preload-after-build/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'supports this.load() in buildEnd and renderStart', options: { plugins: [ @@ -20,4 +20,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/preload-cyclic-module/_config.js b/test/function/samples/preload-cyclic-module/_config.js index b647a8dca59..9d666accef4 100644 --- a/test/function/samples/preload-cyclic-module/_config.js +++ b/test/function/samples/preload-cyclic-module/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_PROXY = path.join(__dirname, 'main.js?proxy'); -module.exports = { +module.exports = defineTest({ description: 'handles pre-loading a cyclic module in the resolveId hook', warnings: [ { @@ -37,4 +37,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/preload-loading-module/_config.js b/test/function/samples/preload-loading-module/_config.js index 8891fd910aa..8779dfafa26 100644 --- a/test/function/samples/preload-loading-module/_config.js +++ b/test/function/samples/preload-loading-module/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); let preloadedCode; -module.exports = { +module.exports = defineTest({ description: 'waits for pre-loaded modules that are currently loading', options: { plugins: [ @@ -17,4 +17,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/preload-module/_config.js b/test/function/samples/preload-module/_config.js index 1be7b15cdb9..9cc42cc09b2 100644 --- a/test/function/samples/preload-module/_config.js +++ b/test/function/samples/preload-module/_config.js @@ -8,7 +8,7 @@ const loadedModules = []; const transformedModules = []; const parsedModules = []; -module.exports = { +module.exports = defineTest({ description: 'allows pre-loading modules via this.load', options: { plugins: [ @@ -105,4 +105,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/preserve-for-of-iterable/_config.js b/test/function/samples/preserve-for-of-iterable/_config.js index d2105b0c09a..d9b466ae710 100644 --- a/test/function/samples/preserve-for-of-iterable/_config.js +++ b/test/function/samples/preserve-for-of-iterable/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves for...of loops' -}; +}); diff --git a/test/function/samples/preserve-modules-circular-order/_config.js b/test/function/samples/preserve-modules-circular-order/_config.js index a5b879af247..39b23282274 100644 --- a/test/function/samples/preserve-modules-circular-order/_config.js +++ b/test/function/samples/preserve-modules-circular-order/_config.js @@ -5,7 +5,7 @@ const ID_DATA = path.join(__dirname, 'data.js'); const ID_TAG = path.join(__dirname, 'tag.js'); const executionOrder = []; -module.exports = { +module.exports = defineTest({ description: 'preserves execution order for circular dependencies when preserving modules', options: { output: { preserveModules: true } @@ -38,4 +38,4 @@ module.exports = { message: 'Circular dependency: tag.js -> index.js -> tag.js' } ] -}; +}); diff --git a/test/function/samples/preserve-modules-default-mode-namespace/_config.js b/test/function/samples/preserve-modules-default-mode-namespace/_config.js index bac148bbb2d..3a1661a514c 100644 --- a/test/function/samples/preserve-modules-default-mode-namespace/_config.js +++ b/test/function/samples/preserve-modules-default-mode-namespace/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'import namespace from chunks with default export mode when preserving modules', options: { input: ['main', 'lib'], @@ -11,4 +11,4 @@ module.exports = { exports(exports) { assert.deepStrictEqual(exports, { lib: { __proto__: null, default: 'foo' } }); } -}; +}); diff --git a/test/function/samples/preserve-modules/inline-dynamic-imports/_config.js b/test/function/samples/preserve-modules/inline-dynamic-imports/_config.js index 602b68b8840..a23f486275e 100644 --- a/test/function/samples/preserve-modules/inline-dynamic-imports/_config.js +++ b/test/function/samples/preserve-modules/inline-dynamic-imports/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Inlining dynamic imports is not supported when preserving modules', options: { input: ['main.js'], @@ -13,4 +13,4 @@ module.exports = { 'Invalid value for option "output.inlineDynamicImports" - this option is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#output-inlinedynamicimports' } -}; +}); diff --git a/test/function/samples/preserve-modules/invalid-default-export-mode/_config.js b/test/function/samples/preserve-modules/invalid-default-export-mode/_config.js index 5e3d7bb35c9..105e59a7c53 100644 --- a/test/function/samples/preserve-modules/invalid-default-export-mode/_config.js +++ b/test/function/samples/preserve-modules/invalid-default-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using default export mode with named exports', options: { input: ['main.js'], @@ -13,4 +13,4 @@ module.exports = { '"default" was specified for "output.exports", but entry module "lib.js" has the following exports: "value"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/preserve-modules/invalid-no-preserve-entry-signatures/_config.js b/test/function/samples/preserve-modules/invalid-no-preserve-entry-signatures/_config.js index c992c00ef3b..2b32dc41517 100644 --- a/test/function/samples/preserve-modules/invalid-no-preserve-entry-signatures/_config.js +++ b/test/function/samples/preserve-modules/invalid-no-preserve-entry-signatures/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when setting preserveEntrySignatures to false', options: { input: ['main.js'], @@ -11,4 +11,4 @@ module.exports = { 'Invalid value for option "preserveEntrySignatures" - setting this option to false is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#preserveentrysignatures' } -}; +}); diff --git a/test/function/samples/preserve-modules/invalid-none-export-mode/_config.js b/test/function/samples/preserve-modules/invalid-none-export-mode/_config.js index 59ad7a17c87..2f887691bc7 100644 --- a/test/function/samples/preserve-modules/invalid-none-export-mode/_config.js +++ b/test/function/samples/preserve-modules/invalid-none-export-mode/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws when using none export mode with named exports', options: { input: ['main.js'], @@ -13,4 +13,4 @@ module.exports = { '"none" was specified for "output.exports", but entry module "lib.js" has the following exports: "value"', url: 'https://rollupjs.org/configuration-options/#output-exports' } -}; +}); diff --git a/test/function/samples/preserve-modules/manual-chunks/_config.js b/test/function/samples/preserve-modules/manual-chunks/_config.js index cae5edd2cda..9bfdc36703d 100644 --- a/test/function/samples/preserve-modules/manual-chunks/_config.js +++ b/test/function/samples/preserve-modules/manual-chunks/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'Assigning manual chunks fails when preserving modules', options: { input: ['main.js'], @@ -15,4 +15,4 @@ module.exports = { 'Invalid value for option "output.manualChunks" - this option is not supported for "output.preserveModules".', url: 'https://rollupjs.org/configuration-options/#output-manualchunks' } -}; +}); diff --git a/test/function/samples/preserve-modules/mixed-exports/_config.js b/test/function/samples/preserve-modules/mixed-exports/_config.js index b2acf6ec5bc..1b09118f0bf 100644 --- a/test/function/samples/preserve-modules/mixed-exports/_config.js +++ b/test/function/samples/preserve-modules/mixed-exports/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_LIB1 = path.join(__dirname, 'lib1.js'); -module.exports = { +module.exports = defineTest({ description: 'warns for mixed exports in all chunks when preserving modules', options: { input: ['main.js'], @@ -24,4 +24,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-exports' } ] -}; +}); diff --git a/test/function/samples/preserve-modules/virtual-modules-conflict/_config.js b/test/function/samples/preserve-modules/virtual-modules-conflict/_config.js index 847a2fd9e62..1ed78a68107 100644 --- a/test/function/samples/preserve-modules/virtual-modules-conflict/_config.js +++ b/test/function/samples/preserve-modules/virtual-modules-conflict/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { plugins: [ @@ -27,4 +27,4 @@ module.exports = { ) ); } -}; +}); diff --git a/test/function/samples/preserve-modules/virtual-modules/_config.js b/test/function/samples/preserve-modules/virtual-modules/_config.js index 435c86e7cc9..b5ea264179c 100644 --- a/test/function/samples/preserve-modules/virtual-modules/_config.js +++ b/test/function/samples/preserve-modules/virtual-modules/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Generates actual files for virtual modules when preserving modules', options: { plugins: [ @@ -27,4 +27,4 @@ module.exports = { ) ); } -}; +}); diff --git a/test/function/samples/preserve-symlink/_config.js b/test/function/samples/preserve-symlink/_config.js index fa45ed5f2e8..cdc08ad12dd 100644 --- a/test/function/samples/preserve-symlink/_config.js +++ b/test/function/samples/preserve-symlink/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ skip: process.platform === 'win32', description: 'follows symlinks', options: { preserveSymlinks: true } -}; +}); diff --git a/test/function/samples/preserves-catch-argument/_config.js b/test/function/samples/preserves-catch-argument/_config.js index 3ce74663a22..f3e02e49af6 100644 --- a/test/function/samples/preserves-catch-argument/_config.js +++ b/test/function/samples/preserves-catch-argument/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'does not replace argument to catch block (#1462)', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/preserves-default-exports-used-locally/_config.js b/test/function/samples/preserves-default-exports-used-locally/_config.js index 98c090b8cb2..6a5ad4fc865 100644 --- a/test/function/samples/preserves-default-exports-used-locally/_config.js +++ b/test/function/samples/preserves-default-exports-used-locally/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves default exports that are only used locally (#984)' -}; +}); diff --git a/test/function/samples/preserves-function-expression-names/_config.js b/test/function/samples/preserves-function-expression-names/_config.js index a0c61816916..4a43c05ce18 100644 --- a/test/function/samples/preserves-function-expression-names/_config.js +++ b/test/function/samples/preserves-function-expression-names/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not rewrite function expression names incorrectly (#1083)', options: { external: ['path'] @@ -9,4 +9,4 @@ module.exports = { assert.ok(!/path/.test(exports.x.name)); assert.equal(exports.y, 'somefile.txt'); } -}; +}); diff --git a/test/function/samples/preserves-var-declarations-in-dead-branches/_config.js b/test/function/samples/preserves-var-declarations-in-dead-branches/_config.js index e0f687ef8fe..6ee480a836c 100644 --- a/test/function/samples/preserves-var-declarations-in-dead-branches/_config.js +++ b/test/function/samples/preserves-var-declarations-in-dead-branches/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves var declarations in dead branches (#977)' -}; +}); diff --git a/test/function/samples/prevent-asi-with-line-comments/_config.js b/test/function/samples/prevent-asi-with-line-comments/_config.js index d711fe77c68..eb22ceada03 100644 --- a/test/function/samples/prevent-asi-with-line-comments/_config.js +++ b/test/function/samples/prevent-asi-with-line-comments/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'prevent semicolon insertion for return statements when there are line comments', exports(exports) { assert.strictEqual(exports(), 1); } -}; +}); diff --git a/test/function/samples/prevent-context-resolve-loop/_config.js b/test/function/samples/prevent-context-resolve-loop/_config.js index 4dd4b7f024f..50259501cb7 100644 --- a/test/function/samples/prevent-context-resolve-loop/_config.js +++ b/test/function/samples/prevent-context-resolve-loop/_config.js @@ -8,7 +8,7 @@ const ID_OTHER_4 = path.join(__dirname, 'other4.js'); const thirdPluginCalls = new Set(); -module.exports = { +module.exports = defineTest({ description: 'prevents infinite loops when several plugins are calling this.resolve in resolveId', options: { plugins: [ @@ -59,4 +59,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/prevent-tree-shaking-asi/_config.js b/test/function/samples/prevent-tree-shaking-asi/_config.js index c0ce988a450..7431deafbd1 100644 --- a/test/function/samples/prevent-tree-shaking-asi/_config.js +++ b/test/function/samples/prevent-tree-shaking-asi/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'prevent automatic semicolon insertion from changing behaviour when tree-shaking', options: { treeshake: { tryCatchDeoptimization: false } } -}; +}); diff --git a/test/function/samples/property-keys-not-renamed/_config.js b/test/function/samples/property-keys-not-renamed/_config.js index d4e1f829b49..bb53d7ef257 100644 --- a/test/function/samples/property-keys-not-renamed/_config.js +++ b/test/function/samples/property-keys-not-renamed/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not rename property keys' -}; +}); diff --git a/test/function/samples/propertyReadSideEffects-always/_config.js b/test/function/samples/propertyReadSideEffects-always/_config.js index 8fc38463bc0..09a7f87920f 100644 --- a/test/function/samples/propertyReadSideEffects-always/_config.js +++ b/test/function/samples/propertyReadSideEffects-always/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'verify property accesses are retained for getters with side effects', options: { treeshake: { propertyReadSideEffects: 'always' } } -}; +}); diff --git a/test/function/samples/protect-cjs-globals/_config.js b/test/function/samples/protect-cjs-globals/_config.js index 26fd141de27..e9a4157b03f 100644 --- a/test/function/samples/protect-cjs-globals/_config.js +++ b/test/function/samples/protect-cjs-globals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'prevent conflicts with cjs module globals' -}; +}); diff --git a/test/function/samples/proto-accessors/_config.js b/test/function/samples/proto-accessors/_config.js index cdbdcecf206..795ccf6aa52 100644 --- a/test/function/samples/proto-accessors/_config.js +++ b/test/function/samples/proto-accessors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles getters and setters on __proto__ properties' -}; +}); diff --git a/test/function/samples/re-export-default-import/_config.js b/test/function/samples/re-export-default-import/_config.js index 287c37f6c9b..412ac13e7bd 100644 --- a/test/function/samples/re-export-default-import/_config.js +++ b/test/function/samples/re-export-default-import/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a default import' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/re-export-default-import diff --git a/test/function/samples/re-export-namespace-import/_config.js b/test/function/samples/re-export-namespace-import/_config.js index f13ec5d8c74..36cdfe295ad 100644 --- a/test/function/samples/re-export-namespace-import/_config.js +++ b/test/function/samples/re-export-namespace-import/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 're-exports a namespace import' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/re-export-namespace-import diff --git a/test/function/samples/reassign-array-literal-elements/_config.js b/test/function/samples/reassign-array-literal-elements/_config.js index cba1867556a..a0e0cc67550 100644 --- a/test/function/samples/reassign-array-literal-elements/_config.js +++ b/test/function/samples/reassign-array-literal-elements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure reassignments of array elements are tracked' -}; +}); diff --git a/test/function/samples/reassign-computed-prototype/_config.js b/test/function/samples/reassign-computed-prototype/_config.js index 2af8b68f9aa..768bd663e99 100644 --- a/test/function/samples/reassign-computed-prototype/_config.js +++ b/test/function/samples/reassign-computed-prototype/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'reassign function prototype via computed property access', context: { proto: 'prototype' } -}; +}); diff --git a/test/function/samples/reassign-constructor-parameter-property/_config.js b/test/function/samples/reassign-constructor-parameter-property/_config.js index c02ad7871b3..5dd1b893f6c 100644 --- a/test/function/samples/reassign-constructor-parameter-property/_config.js +++ b/test/function/samples/reassign-constructor-parameter-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments of properties of constructor parameters' -}; +}); diff --git a/test/function/samples/reassign-double-declarations/_config.js b/test/function/samples/reassign-double-declarations/_config.js index c2fc7556f9c..8aa977c0079 100644 --- a/test/function/samples/reassign-double-declarations/_config.js +++ b/test/function/samples/reassign-double-declarations/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure reassignments of double declared variables and their initializers are tracked' -}; +}); diff --git a/test/function/samples/reassign-empty-objects/_config.js b/test/function/samples/reassign-empty-objects/_config.js index 89f1e63f714..230ac9fb891 100644 --- a/test/function/samples/reassign-empty-objects/_config.js +++ b/test/function/samples/reassign-empty-objects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments of empty objects (#2306)' -}; +}); diff --git a/test/function/samples/reassign-for-loop-declarations/_config.js b/test/function/samples/reassign-for-loop-declarations/_config.js index ffab3a88067..f5afcf4ee06 100644 --- a/test/function/samples/reassign-for-loop-declarations/_config.js +++ b/test/function/samples/reassign-for-loop-declarations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'reassign for-loop declarations' -}; +}); diff --git a/test/function/samples/reassign-import-fails/_config.js b/test/function/samples/reassign-import-fails/_config.js index 59a7bc9a2b6..71ca9a3ee3f 100644 --- a/test/function/samples/reassign-import-fails/_config.js +++ b/test/function/samples/reassign-import-fails/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows assignments to imported bindings', error: { code: 'ILLEGAL_REASSIGNMENT', @@ -21,6 +21,6 @@ module.exports = { watchFiles: [ID_FOO, ID_MAIN], message: 'Illegal reassignment of import "x" in "main.js".' } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/reassign-import-fails diff --git a/test/function/samples/reassign-import-not-at-top-level-fails/_config.js b/test/function/samples/reassign-import-not-at-top-level-fails/_config.js index b4b6df55aa6..d26f7c87fc5 100644 --- a/test/function/samples/reassign-import-not-at-top-level-fails/_config.js +++ b/test/function/samples/reassign-import-not-at-top-level-fails/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows assignments to imported bindings not at the top level', error: { code: 'ILLEGAL_REASSIGNMENT', @@ -22,6 +22,6 @@ module.exports = { watchFiles: [ID_FOO, ID_MAIN], message: 'Illegal reassignment of import "x" in "main.js".' } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/reassign-import-fails diff --git a/test/function/samples/reassign-namespace/_config.js b/test/function/samples/reassign-namespace/_config.js index 8bff57992fe..8466a6c756c 100644 --- a/test/function/samples/reassign-namespace/_config.js +++ b/test/function/samples/reassign-namespace/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'members of namespaces are reassigned when the namespace is passed to a function' -}; +}); diff --git a/test/function/samples/reassign-object-literal-1/_config.js b/test/function/samples/reassign-object-literal-1/_config.js index 12977186e04..49bf74fcc5c 100644 --- a/test/function/samples/reassign-object-literal-1/_config.js +++ b/test/function/samples/reassign-object-literal-1/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments through object literals' -}; +}); diff --git a/test/function/samples/reassign-object-literal-2/_config.js b/test/function/samples/reassign-object-literal-2/_config.js index 12977186e04..49bf74fcc5c 100644 --- a/test/function/samples/reassign-object-literal-2/_config.js +++ b/test/function/samples/reassign-object-literal-2/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments through object literals' -}; +}); diff --git a/test/function/samples/reassign-parameter-property/_config.js b/test/function/samples/reassign-parameter-property/_config.js index 8d50d4d1fa6..f78a29bf0cc 100644 --- a/test/function/samples/reassign-parameter-property/_config.js +++ b/test/function/samples/reassign-parameter-property/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments of properties of function parameters' -}; +}); diff --git a/test/function/samples/reassign-parameter/_config.js b/test/function/samples/reassign-parameter/_config.js index 1701a6f8311..2b73aa449ac 100644 --- a/test/function/samples/reassign-parameter/_config.js +++ b/test/function/samples/reassign-parameter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'parameters can be reassigned/updated' -}; +}); diff --git a/test/function/samples/reassign-pattern-defaults/_config.js b/test/function/samples/reassign-pattern-defaults/_config.js index cc6fce1a3e1..46ee6049e09 100644 --- a/test/function/samples/reassign-pattern-defaults/_config.js +++ b/test/function/samples/reassign-pattern-defaults/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure reassignments of pattern defaults are tracked' -}; +}); diff --git a/test/function/samples/reassign-return-expression/_config.js b/test/function/samples/reassign-return-expression/_config.js index d9b72ad5e99..14cf0f453fa 100644 --- a/test/function/samples/reassign-return-expression/_config.js +++ b/test/function/samples/reassign-return-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments of single function return expressions' -}; +}); diff --git a/test/function/samples/reassign-return-expressions/_config.js b/test/function/samples/reassign-return-expressions/_config.js index 9b5f1416559..401837c2056 100644 --- a/test/function/samples/reassign-return-expressions/_config.js +++ b/test/function/samples/reassign-return-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'track reassignments of multiple function return expressions' -}; +}); diff --git a/test/function/samples/reassigned-return-expression/_config.js b/test/function/samples/reassigned-return-expression/_config.js index 5223fccf634..96e9bc7acbf 100644 --- a/test/function/samples/reassigned-return-expression/_config.js +++ b/test/function/samples/reassigned-return-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not bind return expressions before assignments are bound (#3382)' -}; +}); diff --git a/test/function/samples/recursive-parameter-assignments/_config.js b/test/function/samples/recursive-parameter-assignments/_config.js index 80c1cc8f62d..152845f3dd7 100644 --- a/test/function/samples/recursive-parameter-assignments/_config.js +++ b/test/function/samples/recursive-parameter-assignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'Avoid maximum call stack error with recursive parameter assignments (#1710).' -}; +}); diff --git a/test/function/samples/recursive-reexports/_config.js b/test/function/samples/recursive-reexports/_config.js index 2ddc66a3bd9..1fbde929b5e 100644 --- a/test/function/samples/recursive-reexports/_config.js +++ b/test/function/samples/recursive-reexports/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_OTHER = path.join(__dirname, 'other.js'); -module.exports = { +module.exports = defineTest({ description: 'handles recursive namespace reexports', exports(exports) { assert.deepStrictEqual(exports, { main: 'main', other: 'other' }); @@ -15,4 +15,4 @@ module.exports = { message: 'Circular dependency: main.js -> other.js -> main.js' } ] -}; +}); diff --git a/test/function/samples/redeclare-parameter/_config.js b/test/function/samples/redeclare-parameter/_config.js index e3d2ff620b0..7209c38dd9c 100644 --- a/test/function/samples/redeclare-parameter/_config.js +++ b/test/function/samples/redeclare-parameter/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'associates redeclared parameters (#2451)' -}; +}); diff --git a/test/function/samples/reexport-from-synthetic/_config.js b/test/function/samples/reexport-from-synthetic/_config.js index 7a0aa62df7a..a3a2728975b 100644 --- a/test/function/samples/reexport-from-synthetic/_config.js +++ b/test/function/samples/reexport-from-synthetic/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles reexporting a synthetic namespace from a non-synthetic module', options: { plugins: [ @@ -9,4 +9,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/reexport-missing-error/_config.js b/test/function/samples/reexport-missing-error/_config.js index 2a2724ff2d0..923cf1477ca 100644 --- a/test/function/samples/reexport-missing-error/_config.js +++ b/test/function/samples/reexport-missing-error/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_EMPTY = path.join(__dirname, 'empty.js'); -module.exports = { +module.exports = defineTest({ description: 'reexporting a missing identifier should print an error', error: { binding: 'foo', @@ -22,4 +22,4 @@ module.exports = { watchFiles: [ID_EMPTY, ID_MAIN], message: '"foo" is not exported by "empty.js", imported by "main.js".' } -}; +}); diff --git a/test/function/samples/reexport-ns/_config.js b/test/function/samples/reexport-ns/_config.js index 91a45186179..251ca56d875 100644 --- a/test/function/samples/reexport-ns/_config.js +++ b/test/function/samples/reexport-ns/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'external namespace reexport', options: { external: ['external'], @@ -13,4 +13,4 @@ module.exports = { assert.strictEqual(exports[Symbol.toStringTag], 'Module'); assert.strictEqual(exports.maths.external, true); } -}; +}); diff --git a/test/function/samples/reexports-from-external/_config.js b/test/function/samples/reexports-from-external/_config.js index c7e67ff1165..a614d7550ff 100644 --- a/test/function/samples/reexports-from-external/_config.js +++ b/test/function/samples/reexports-from-external/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 're-exports * from external module (#791)', options: { external: ['external'] @@ -19,4 +19,4 @@ module.exports = { assert.equal(exports.foo, 1); assert.equal(exports.bar, 2); } -}; +}); diff --git a/test/function/samples/relative-external-include-once-nested/_config.js b/test/function/samples/relative-external-include-once-nested/_config.js index 8e6f664f297..7826d561b45 100644 --- a/test/function/samples/relative-external-include-once-nested/_config.js +++ b/test/function/samples/relative-external-include-once-nested/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes a relative external module only once (nested version)', options: { external: path.join(__dirname, './first/foo.js') @@ -15,4 +15,4 @@ module.exports = { exports(exports) { assert.equal(exports, 3); } -}; +}); diff --git a/test/function/samples/relative-external-include-once-two-external/_config.js b/test/function/samples/relative-external-include-once-two-external/_config.js index 37b3a4b6168..357ee534cc4 100644 --- a/test/function/samples/relative-external-include-once-two-external/_config.js +++ b/test/function/samples/relative-external-include-once-two-external/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const { join } = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes a relative external module only once (two external deps)', options: { external: [join(__dirname, './foo.js'), join(__dirname, './first/foo.js')] @@ -15,4 +15,4 @@ module.exports = { exports(exports) { assert.ok(exports === 'ab' || exports === 'ba', 'two different modules should be required'); } -}; +}); diff --git a/test/function/samples/relative-external-include-once-up/_config.js b/test/function/samples/relative-external-include-once-up/_config.js index 427402db0d1..8c9b1adc025 100644 --- a/test/function/samples/relative-external-include-once-up/_config.js +++ b/test/function/samples/relative-external-include-once-up/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes a relative external module only once (from upper directory too)', options: { input: path.join(__dirname, 'first', 'main.js'), @@ -16,4 +16,4 @@ module.exports = { exports(exports) { assert.equal(exports, 3); } -}; +}); diff --git a/test/function/samples/relative-external-include-once/_config.js b/test/function/samples/relative-external-include-once/_config.js index cd581119e47..2650715af66 100644 --- a/test/function/samples/relative-external-include-once/_config.js +++ b/test/function/samples/relative-external-include-once/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'includes a relative external module only once', options: { external: path.join(__dirname, './foo.js') @@ -15,4 +15,4 @@ module.exports = { exports(exports) { assert.equal(exports, 3); } -}; +}); diff --git a/test/function/samples/relative-outside-external/_config.js b/test/function/samples/relative-outside-external/_config.js index 4c59441887f..eb14033e0a2 100644 --- a/test/function/samples/relative-outside-external/_config.js +++ b/test/function/samples/relative-outside-external/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const cwd = process.cwd; -module.exports = { +module.exports = defineTest({ description: 'correctly resolves relative external imports from outside directories', options: { external() { @@ -20,4 +20,4 @@ module.exports = { process.cwd = cwd; assert.strictEqual(exports.value, '../../../test.js'); } -}; +}); diff --git a/test/function/samples/removes-empty-exported-vars/_config.js b/test/function/samples/removes-empty-exported-vars/_config.js index 3b464a58d23..231e6509a45 100644 --- a/test/function/samples/removes-empty-exported-vars/_config.js +++ b/test/function/samples/removes-empty-exported-vars/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'removes empty exported var declarations', exports(exports) { assert.equal(exports.foo, 42); } -}; +}); diff --git a/test/function/samples/rename-conditional-expression-children/_config.js b/test/function/samples/rename-conditional-expression-children/_config.js index 7c052c5cd17..81fe5e52797 100644 --- a/test/function/samples/rename-conditional-expression-children/_config.js +++ b/test/function/samples/rename-conditional-expression-children/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly renders children of ConditionalExpressions' -}; +}); diff --git a/test/function/samples/rename-default-export/_config.js b/test/function/samples/rename-default-export/_config.js index eefafac65b2..102b9875260 100644 --- a/test/function/samples/rename-default-export/_config.js +++ b/test/function/samples/rename-default-export/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'avoids SyntaxError with default token (#33)', exports(exports) { assert.equal(exports.foo, 42); assert.equal(exports.bar, 42); } -}; +}); diff --git a/test/function/samples/renamed-arguments/_config.js b/test/function/samples/renamed-arguments/_config.js index bb5714c61f3..dd3abbc8bf9 100644 --- a/test/function/samples/renamed-arguments/_config.js +++ b/test/function/samples/renamed-arguments/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'function arguments are renamed as appropriate (#32)', exports(exports) { const object = {}; assert.strictEqual(exports.foo(), 42); assert.strictEqual(exports.bar(object), object); } -}; +}); diff --git a/test/function/samples/render-chunk-async/_config.js b/test/function/samples/render-chunk-async/_config.js index 7fb0f09887c..a64a861caf3 100644 --- a/test/function/samples/render-chunk-async/_config.js +++ b/test/function/samples/render-chunk-async/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'bundle transformers can be asynchronous', options: { plugins: [ @@ -19,4 +19,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/resolve-id-object/_config.js b/test/function/samples/resolve-id-object/_config.js index 97bc04d7816..0b7d1226105 100644 --- a/test/function/samples/resolve-id-object/_config.js +++ b/test/function/samples/resolve-id-object/_config.js @@ -1,6 +1,6 @@ const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'allows resolving an id with an object', options: { plugins: { @@ -28,4 +28,4 @@ module.exports = { throw new Error(`Unexpected external id ${id}.`); } } -}; +}); diff --git a/test/function/samples/resolve-relative-external-id/_config.js b/test/function/samples/resolve-relative-external-id/_config.js index f0534f90aad..c56c4053730 100644 --- a/test/function/samples/resolve-relative-external-id/_config.js +++ b/test/function/samples/resolve-relative-external-id/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'resolves relative external ids', options: { external: [path.join(__dirname, 'external.js'), path.join(__dirname, 'nested', 'external.js')], @@ -31,4 +31,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/resolve-unordered-assignments-2/_config.js b/test/function/samples/resolve-unordered-assignments-2/_config.js index 8de42b92b54..d429eda511b 100644 --- a/test/function/samples/resolve-unordered-assignments-2/_config.js +++ b/test/function/samples/resolve-unordered-assignments-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Assignments should be correctly bound independent of their order', exports(exports) { assert.equal(exports.baz, 'present'); } -}; +}); diff --git a/test/function/samples/resolve-unordered-assignments/_config.js b/test/function/samples/resolve-unordered-assignments/_config.js index 8de42b92b54..d429eda511b 100644 --- a/test/function/samples/resolve-unordered-assignments/_config.js +++ b/test/function/samples/resolve-unordered-assignments/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Assignments should be correctly bound independent of their order', exports(exports) { assert.equal(exports.baz, 'present'); } -}; +}); diff --git a/test/function/samples/resolveid-is-entry/_config.js b/test/function/samples/resolveid-is-entry/_config.js index 30bdca4bb41..ac7436ef12d 100644 --- a/test/function/samples/resolveid-is-entry/_config.js +++ b/test/function/samples/resolveid-is-entry/_config.js @@ -3,7 +3,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'sends correct isEntry information to resolveId hooks', options: { plugins: [ @@ -80,4 +80,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/resolves-namespace-default/_config.js b/test/function/samples/resolves-namespace-default/_config.js index 20360805f9c..0303e9eb5a9 100644 --- a/test/function/samples/resolves-namespace-default/_config.js +++ b/test/function/samples/resolves-namespace-default/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: "namespace's 'default' properties should be available", exports(exports) { assert.equal(exports, 42); } -}; +}); diff --git a/test/function/samples/respect-default-export-reexporter-side-effects/_config.js b/test/function/samples/respect-default-export-reexporter-side-effects/_config.js index 7ddf180ef45..23ce63b913f 100644 --- a/test/function/samples/respect-default-export-reexporter-side-effects/_config.js +++ b/test/function/samples/respect-default-export-reexporter-side-effects/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'respect side-effects in reexporting modules even if moduleSideEffects are off', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/function/samples/respect-reexporter-side-effects/_config.js b/test/function/samples/respect-reexporter-side-effects/_config.js index 7ddf180ef45..23ce63b913f 100644 --- a/test/function/samples/respect-reexporter-side-effects/_config.js +++ b/test/function/samples/respect-reexporter-side-effects/_config.js @@ -1,8 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'respect side-effects in reexporting modules even if moduleSideEffects are off', options: { treeshake: { moduleSideEffects: false } } -}; +}); diff --git a/test/function/samples/respect-synthetic-export-reexporter-side-effects/_config.js b/test/function/samples/respect-synthetic-export-reexporter-side-effects/_config.js index 0afd5749ba1..12962903ccf 100644 --- a/test/function/samples/respect-synthetic-export-reexporter-side-effects/_config.js +++ b/test/function/samples/respect-synthetic-export-reexporter-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'respect side-effects in reexporting modules even if moduleSideEffects are off', options: { treeshake: { @@ -12,4 +12,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/retain-unknown-prototype-access/_config.js b/test/function/samples/retain-unknown-prototype-access/_config.js index 576db2d0c73..089cb025233 100644 --- a/test/function/samples/retain-unknown-prototype-access/_config.js +++ b/test/function/samples/retain-unknown-prototype-access/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treats unknown builtin prototype properties as unknown' -}; +}); diff --git a/test/function/samples/retains-sort-order-b/_config.js b/test/function/samples/retains-sort-order-b/_config.js index 60e5e637185..9a27285e3b8 100644 --- a/test/function/samples/retains-sort-order-b/_config.js +++ b/test/function/samples/retains-sort-order-b/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'sorts statements according to their original order within modules, part 2', exports(exports) { assert.equal(exports.answer, 42); } -}; +}); diff --git a/test/function/samples/retains-sort-order/_config.js b/test/function/samples/retains-sort-order/_config.js index b9f3560eea1..34c4d65e12c 100644 --- a/test/function/samples/retains-sort-order/_config.js +++ b/test/function/samples/retains-sort-order/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'sorts statements according to their original order within modules', exports(exports) { assert.equal(exports, 'GREAT SUCCESS'); } -}; +}); diff --git a/test/function/samples/return-expression-depending-on-conditional/_config.js b/test/function/samples/return-expression-depending-on-conditional/_config.js index 5148fc5f493..a09f7f1414a 100644 --- a/test/function/samples/return-expression-depending-on-conditional/_config.js +++ b/test/function/samples/return-expression-depending-on-conditional/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks return expressions that depend on conditional expressions that are deoptimized at some point' -}; +}); diff --git a/test/function/samples/returned-array-mutation/_config.js b/test/function/samples/returned-array-mutation/_config.js index 612a42d2e21..7aedc8b8dad 100644 --- a/test/function/samples/returned-array-mutation/_config.js +++ b/test/function/samples/returned-array-mutation/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks array mutations' -}; +}); diff --git a/test/function/samples/reuse-resolve-meta/_config.js b/test/function/samples/reuse-resolve-meta/_config.js index 9e34916d7de..18abd3c77d6 100644 --- a/test/function/samples/reuse-resolve-meta/_config.js +++ b/test/function/samples/reuse-resolve-meta/_config.js @@ -4,7 +4,7 @@ const meta = { plugin: { initial: true } }; const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'does not modify meta objects passed in resolveId', options: { plugins: [ @@ -26,4 +26,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/rewrite-member-expressions/_config.js b/test/function/samples/rewrite-member-expressions/_config.js index ec5c85601ae..77b6b8b22e6 100644 --- a/test/function/samples/rewrite-member-expressions/_config.js +++ b/test/function/samples/rewrite-member-expressions/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'rewrites identifiers at the head of member expressions' -}; +}); diff --git a/test/function/samples/sequence-expression/_config.js b/test/function/samples/sequence-expression/_config.js index fbf4519aace..e23f4ebf348 100644 --- a/test/function/samples/sequence-expression/_config.js +++ b/test/function/samples/sequence-expression/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'do not change context of callable in sequence expressions' -}; +}); diff --git a/test/function/samples/sequence-expressions-template-tag/_config.js b/test/function/samples/sequence-expressions-template-tag/_config.js index 6af722b1760..848adc8d6a6 100644 --- a/test/function/samples/sequence-expressions-template-tag/_config.js +++ b/test/function/samples/sequence-expressions-template-tag/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'uses corrrect "this" for tagged template expressions in simplified sequences' -}; +}); diff --git a/test/function/samples/shadowed-external-export/_config.js b/test/function/samples/shadowed-external-export/_config.js index fc9405b32f1..8a33feb5e79 100644 --- a/test/function/samples/shadowed-external-export/_config.js +++ b/test/function/samples/shadowed-external-export/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'external modules are not shadowed', options: { external: ['path'] } -}; +}); diff --git a/test/function/samples/shadowed-namespace-b/_config.js b/test/function/samples/shadowed-namespace-b/_config.js index fba6d0d98e0..902a8a9f973 100644 --- a/test/function/samples/shadowed-namespace-b/_config.js +++ b/test/function/samples/shadowed-namespace-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'namespaces are not shadowed (b)' -}; +}); diff --git a/test/function/samples/shadowed-namespace/_config.js b/test/function/samples/shadowed-namespace/_config.js index f0d7f7a4155..e8e90c5ee51 100644 --- a/test/function/samples/shadowed-namespace/_config.js +++ b/test/function/samples/shadowed-namespace/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'namespaces are not shadowed' -}; +}); diff --git a/test/function/samples/shadowed-variables/_config.js b/test/function/samples/shadowed-variables/_config.js index d2455d30459..dffb5dd4307 100644 --- a/test/function/samples/shadowed-variables/_config.js +++ b/test/function/samples/shadowed-variables/_config.js @@ -1,5 +1,5 @@ -module.exports = { +module.exports = defineTest({ description: 'renames shadowed variables correctly' -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/named-function-expression diff --git a/test/function/samples/shims-missing-exports/_config.js b/test/function/samples/shims-missing-exports/_config.js index 270b5bb401c..e824bb64e9e 100644 --- a/test/function/samples/shims-missing-exports/_config.js +++ b/test/function/samples/shims-missing-exports/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_DEP1 = path.join(__dirname, 'dep1.js'); -module.exports = { +module.exports = defineTest({ description: 'shims missing exports', options: { shimMissingExports: true @@ -14,4 +14,4 @@ module.exports = { message: 'Missing export "missing" has been shimmed in module "dep1.js".' } ] -}; +}); diff --git a/test/function/samples/side-effect-free-module-function/_config.js b/test/function/samples/side-effect-free-module-function/_config.js index 7338de6c86e..827d480db05 100644 --- a/test/function/samples/side-effect-free-module-function/_config.js +++ b/test/function/samples/side-effect-free-module-function/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly include functions with side effects from side-effect-free modules (#3942)', options: { @@ -8,4 +8,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/side-effects-only-default-exports/_config.js b/test/function/samples/side-effects-only-default-exports/_config.js index 39cde975727..1aba737cc45 100644 --- a/test/function/samples/side-effects-only-default-exports/_config.js +++ b/test/function/samples/side-effects-only-default-exports/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const mutated = {}; -module.exports = { +module.exports = defineTest({ description: 'Wraps inlined default exports which are rendered for side-effects only', options: { external: ['external'] @@ -15,4 +15,4 @@ module.exports = { assert.ok(mutated.extremelyMutated); assert.ok(mutated.utterlyMutated); } -}; +}); diff --git a/test/function/samples/simplified-nested-if/_config.js b/test/function/samples/simplified-nested-if/_config.js index 6e442a83103..0697a089652 100644 --- a/test/function/samples/simplified-nested-if/_config.js +++ b/test/function/samples/simplified-nested-if/_config.js @@ -1,7 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'do not catch else branches from parent if statements when simplifiying if-statements', context: { unknown: true } -}; +}); diff --git a/test/function/samples/simplify-arrow-expression-with-object/_config.js b/test/function/samples/simplify-arrow-expression-with-object/_config.js index bbd7247c0d0..7f9cf90e15b 100644 --- a/test/function/samples/simplify-arrow-expression-with-object/_config.js +++ b/test/function/samples/simplify-arrow-expression-with-object/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correctly simplifies arrow expressions where the right hand side becomes an object', exports(exports) { assert.deepStrictEqual(exports.conditional(), { x: 42, y: 43 }); assert.deepStrictEqual(exports.logical(), { x: 42, y: 43 }); } -}; +}); diff --git a/test/function/samples/simplify-class-expression-assignment/_config.js b/test/function/samples/simplify-class-expression-assignment/_config.js index 2e3c44bdbac..49d2640eb71 100644 --- a/test/function/samples/simplify-class-expression-assignment/_config.js +++ b/test/function/samples/simplify-class-expression-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'wraps class expressions in call expressions in simplified assignments' -}; +}); diff --git a/test/function/samples/simplify-function-expression-assignment/_config.js b/test/function/samples/simplify-function-expression-assignment/_config.js index 173965d0199..6fd7a94a2d6 100644 --- a/test/function/samples/simplify-function-expression-assignment/_config.js +++ b/test/function/samples/simplify-function-expression-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'wraps function expressions in call expressions in simplified assignments' -}; +}); diff --git a/test/function/samples/simplify-object-expression-assignment/_config.js b/test/function/samples/simplify-object-expression-assignment/_config.js index f8c4f0cf135..b3b2c7db699 100644 --- a/test/function/samples/simplify-object-expression-assignment/_config.js +++ b/test/function/samples/simplify-object-expression-assignment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'wraps object expressions in call expressions in simplified assignments' -}; +}); diff --git a/test/function/samples/simplify-sequence-expressions/_config.js b/test/function/samples/simplify-sequence-expressions/_config.js index cb5578b64ab..bf5617a0fc5 100644 --- a/test/function/samples/simplify-sequence-expressions/_config.js +++ b/test/function/samples/simplify-sequence-expressions/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly simplify sequence expressions if the new leading element would require parentheses' -}; +}); diff --git a/test/function/samples/simplify-with-destructuring/_config.js b/test/function/samples/simplify-with-destructuring/_config.js index d5bbacc776d..0e2de5021cd 100644 --- a/test/function/samples/simplify-with-destructuring/_config.js +++ b/test/function/samples/simplify-with-destructuring/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handle destructuring assignments in simplified sequence expressions' -}; +}); diff --git a/test/function/samples/simplify-with-function-iife/_config.js b/test/function/samples/simplify-with-function-iife/_config.js index 56aecda2893..74b67dced6b 100644 --- a/test/function/samples/simplify-with-function-iife/_config.js +++ b/test/function/samples/simplify-with-function-iife/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly uses parentheses when a simplification would put a function IIFE first' -}; +}); diff --git a/test/function/samples/sourcemap-base-url-invalid/_config.js b/test/function/samples/sourcemap-base-url-invalid/_config.js index f141e56812e..d39d3d8afcf 100644 --- a/test/function/samples/sourcemap-base-url-invalid/_config.js +++ b/test/function/samples/sourcemap-base-url-invalid/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for invalid sourcemapBaseUrl', options: { output: { @@ -11,4 +11,4 @@ module.exports = { 'Invalid value for option "output.sourcemapBaseUrl" - must be a valid URL, received "example.com".', url: 'https://rollupjs.org/configuration-options/#output-sourcemapbaseurl' } -}; +}); diff --git a/test/function/samples/sourcemap-inline-generatebundle/_config.js b/test/function/samples/sourcemap-inline-generatebundle/_config.js index bbb66031beb..53e9814887e 100644 --- a/test/function/samples/sourcemap-inline-generatebundle/_config.js +++ b/test/function/samples/sourcemap-inline-generatebundle/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'includes inline sourcemap comments in generateBundle hook', options: { plugins: [ @@ -23,4 +23,4 @@ module.exports = main; ], output: { sourcemap: 'inline' } } -}; +}); diff --git a/test/function/samples/sourcemap-true-generatebundle/_config.js b/test/function/samples/sourcemap-true-generatebundle/_config.js index 5d79ab4f58d..f9abc1bfe4f 100644 --- a/test/function/samples/sourcemap-true-generatebundle/_config.js +++ b/test/function/samples/sourcemap-true-generatebundle/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'emits sourcemaps before generateBundle hook', options: { plugins: [ @@ -31,4 +31,4 @@ module.exports = main; ], output: { sourcemap: true } } -}; +}); diff --git a/test/function/samples/sourcemapping-url-comment/_config.js b/test/function/samples/sourcemapping-url-comment/_config.js index 97c94a2bba3..c1b01a65196 100644 --- a/test/function/samples/sourcemapping-url-comment/_config.js +++ b/test/function/samples/sourcemapping-url-comment/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'only removes valid sourcemapping URL comments (#1132)' -}; +}); diff --git a/test/function/samples/sourcemapping-url-multiline/_config.js b/test/function/samples/sourcemapping-url-multiline/_config.js index 466ea613259..c258c88d9da 100644 --- a/test/function/samples/sourcemapping-url-multiline/_config.js +++ b/test/function/samples/sourcemapping-url-multiline/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not mistakenly recognise sourceMappingURL comment with newline' -}; +}); diff --git a/test/function/samples/spread-arguments-unused/_config.js b/test/function/samples/spread-arguments-unused/_config.js index 4ad21b60eac..d67255bcda8 100644 --- a/test/function/samples/spread-arguments-unused/_config.js +++ b/test/function/samples/spread-arguments-unused/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles using the spread operator to add arguments when the first argument is unused (#3652)' -}; +}); diff --git a/test/function/samples/statement-order/_config.js b/test/function/samples/statement-order/_config.js index ed5bd16619b..c46b7824f67 100644 --- a/test/function/samples/statement-order/_config.js +++ b/test/function/samples/statement-order/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'correct statement order is preserved even in weird edge cases', context: { getAnswer(object) { @@ -10,4 +10,4 @@ module.exports = { exports(exports) { assert.equal(exports, 'right'); } -}; +}); diff --git a/test/function/samples/switch-break/_config.js b/test/function/samples/switch-break/_config.js index 9e60c85325e..006e24586ff 100644 --- a/test/function/samples/switch-break/_config.js +++ b/test/function/samples/switch-break/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'if switch does not always throw an error, retain the following break' -}; +}); diff --git a/test/function/samples/switch-cases-are-deconflicted/_config.js b/test/function/samples/switch-cases-are-deconflicted/_config.js index 34c51a4f835..a1dc6f47510 100644 --- a/test/function/samples/switch-cases-are-deconflicted/_config.js +++ b/test/function/samples/switch-cases-are-deconflicted/_config.js @@ -1,9 +1,9 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'deconflicts variables in switch cases (#1970)', exports(exports) { assert.equal(exports.fn1('1'), 'correct'); assert.equal(exports.fn2('2'), 'correct'); } -}; +}); diff --git a/test/function/samples/switch-statement-nested-continue/_config.js b/test/function/samples/switch-statement-nested-continue/_config.js index 3c0f55f0cc5..095bef32b8e 100644 --- a/test/function/samples/switch-statement-nested-continue/_config.js +++ b/test/function/samples/switch-statement-nested-continue/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treats continue different from break in switch statements' -}; +}); diff --git a/test/function/samples/switch-statement-out-of-order-default/_config.js b/test/function/samples/switch-statement-out-of-order-default/_config.js index 1b6f9d32087..313d2d98f85 100644 --- a/test/function/samples/switch-statement-out-of-order-default/_config.js +++ b/test/function/samples/switch-statement-out-of-order-default/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles side-effects in non-ordered defaults of switch statements' -}; +}); diff --git a/test/function/samples/switch-statements-removed-default/_config.js b/test/function/samples/switch-statements-removed-default/_config.js index 2c58f54526d..221a57d8fc6 100644 --- a/test/function/samples/switch-statements-removed-default/_config.js +++ b/test/function/samples/switch-statements-removed-default/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not remove code after a switch statement that should be retained' -}; +}); diff --git a/test/function/samples/symlink/_config.js b/test/function/samples/symlink/_config.js index 561b738fc2d..39859d6f152 100644 --- a/test/function/samples/symlink/_config.js +++ b/test/function/samples/symlink/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ skip: process.platform === 'win32', description: 'follows symlinks' -}; +}); diff --git a/test/function/samples/synthetic-named-exports-fallback-es2015/_config.js b/test/function/samples/synthetic-named-exports-fallback-es2015/_config.js index a01fdce2095..87daf9e88b3 100644 --- a/test/function/samples/synthetic-named-exports-fallback-es2015/_config.js +++ b/test/function/samples/synthetic-named-exports-fallback-es2015/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds a fallback in case synthetic named exports are falsy', options: { output: { generatedCode: 'es2015' }, @@ -10,4 +10,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/synthetic-named-exports-fallback/_config.js b/test/function/samples/synthetic-named-exports-fallback/_config.js index 36eb5aa7f87..86d20347037 100644 --- a/test/function/samples/synthetic-named-exports-fallback/_config.js +++ b/test/function/samples/synthetic-named-exports-fallback/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'adds a fallback in case synthetic named exports are falsy', options: { plugins: [ @@ -9,4 +9,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js b/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js index e74521bc895..b56e4b7d7dd 100644 --- a/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js +++ b/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'handles circular synthetic exports', options: { plugins: [ @@ -21,4 +21,4 @@ module.exports = { message: 'Module "main.js" that is marked with `syntheticNamedExports: "__synthetic"` needs an explicit export named "__synthetic" that does not reexport an unresolved named export of the same module.' } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js b/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js index 567171e2695..bd2d738fb2c 100644 --- a/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js +++ b/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_DEP1 = path.join(__dirname, 'dep1.js'); const ID_DEP2 = path.join(__dirname, 'dep2.js'); -module.exports = { +module.exports = defineTest({ description: 'handles circular synthetic exports', warnings: [ { @@ -11,4 +11,4 @@ module.exports = { message: 'Circular dependency: dep1.js -> dep2.js -> dep1.js' } ] -}; +}); diff --git a/test/function/samples/synthetic-named-exports/dynamic-import/_config.js b/test/function/samples/synthetic-named-exports/dynamic-import/_config.js index 9c715b7df7a..aa0d92e4f08 100644 --- a/test/function/samples/synthetic-named-exports/dynamic-import/_config.js +++ b/test/function/samples/synthetic-named-exports/dynamic-import/_config.js @@ -1,10 +1,11 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports dynamically importing a module with synthetic named exports', options: { plugins: [ { + name: 'test-plugin', transform(code, id) { if (id.endsWith('dep.js')) { return { code, syntheticNamedExports: true }; @@ -25,4 +26,4 @@ module.exports = { assert.strictEqual(namespace.baz, undefined); assert.deepStrictEqual(namespace.default, { foo: 'foo' }); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/entry/_config.js b/test/function/samples/synthetic-named-exports/entry/_config.js index 4ade590e8c4..ec3c1902b84 100644 --- a/test/function/samples/synthetic-named-exports/entry/_config.js +++ b/test/function/samples/synthetic-named-exports/entry/_config.js @@ -1,10 +1,11 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not expose the synthetic namespace if an entry point uses a string value', options: { plugins: [ { + name: 'test-plugin', transform(code) { return { code, syntheticNamedExports: '__synthetic' }; } @@ -16,4 +17,4 @@ module.exports = { exists: 'exists' }); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/external-synthetic-exports/_config.js b/test/function/samples/synthetic-named-exports/external-synthetic-exports/_config.js index 81b0089ad86..45cb93b3b32 100644 --- a/test/function/samples/synthetic-named-exports/external-synthetic-exports/_config.js +++ b/test/function/samples/synthetic-named-exports/external-synthetic-exports/_config.js @@ -1,8 +1,9 @@ -module.exports = { +module.exports = defineTest({ description: 'external modules can not have syntheticNamedExports', options: { plugins: [ { + name: 'test-plugin', resolveId(id) { if (id === 'dep') { return { @@ -27,4 +28,4 @@ module.exports = { return 1; } } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/namespace-object/_config.js b/test/function/samples/synthetic-named-exports/namespace-object/_config.js index bd8757e1c09..ef46e67daf9 100644 --- a/test/function/samples/synthetic-named-exports/namespace-object/_config.js +++ b/test/function/samples/synthetic-named-exports/namespace-object/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not include named synthetic namespaces in namespace objects', options: { plugins: [ @@ -26,4 +26,4 @@ module.exports = { } }); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/namespace-overrides/_config.js b/test/function/samples/synthetic-named-exports/namespace-overrides/_config.js index 7e7973d34d4..7cdbc765e3b 100644 --- a/test/function/samples/synthetic-named-exports/namespace-overrides/_config.js +++ b/test/function/samples/synthetic-named-exports/namespace-overrides/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports re-exported synthetic exports in namespace objects with correct export precedence', options: { @@ -41,4 +41,4 @@ module.exports = { } }); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/non-default-export/_config.js b/test/function/samples/synthetic-named-exports/non-default-export/_config.js index c2e9e237112..2221ec3c63b 100644 --- a/test/function/samples/synthetic-named-exports/non-default-export/_config.js +++ b/test/function/samples/synthetic-named-exports/non-default-export/_config.js @@ -1,10 +1,11 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'supports providing a named export to generate synthetic exports', options: { plugins: [ { + name: 'test-plugin', transform(code, id) { if (id.endsWith('dep.js')) { return { code, syntheticNamedExports: '__synthetic' }; @@ -26,4 +27,4 @@ module.exports = { synthetic: 'synthetic' }); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/preserve-modules/_config.js b/test/function/samples/synthetic-named-exports/preserve-modules/_config.js index 43cef7c4d8b..c08c3094e3b 100644 --- a/test/function/samples/synthetic-named-exports/preserve-modules/_config.js +++ b/test/function/samples/synthetic-named-exports/preserve-modules/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles a dynamic import with synthetic named exports in preserveModules mode', options: { output: { @@ -21,4 +21,4 @@ module.exports = { const { foo } = await exports.promise; assert.strictEqual(foo, 'bar'); } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/synthetic-exports-need-default/_config.js b/test/function/samples/synthetic-named-exports/synthetic-exports-need-default/_config.js index c8e97b9a45f..53cea010ae5 100644 --- a/test/function/samples/synthetic-named-exports/synthetic-exports-need-default/_config.js +++ b/test/function/samples/synthetic-named-exports/synthetic-exports-need-default/_config.js @@ -2,11 +2,12 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'synthetic named exports modules need a default export', options: { plugins: [ { + name: 'test-plugin', transform() { return { syntheticNamedExports: true }; } @@ -20,4 +21,4 @@ module.exports = { message: 'Module "dep.js" that is marked with `syntheticNamedExports: true` needs a default export that does not reexport an unresolved named export of the same module.' } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/synthetic-exports-need-fallback-export/_config.js b/test/function/samples/synthetic-named-exports/synthetic-exports-need-fallback-export/_config.js index 824ca9d6549..f1ee50d90cf 100644 --- a/test/function/samples/synthetic-named-exports/synthetic-exports-need-fallback-export/_config.js +++ b/test/function/samples/synthetic-named-exports/synthetic-exports-need-fallback-export/_config.js @@ -2,11 +2,12 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_DEP = path.join(__dirname, 'dep.js'); -module.exports = { +module.exports = defineTest({ description: 'synthetic named exports modules need their fallback export', options: { plugins: [ { + name: 'test-plugin', transform(code, id) { if (id.endsWith('dep.js')) { return { code, syntheticNamedExports: '__synthetic' }; @@ -22,4 +23,4 @@ module.exports = { message: 'Module "dep.js" that is marked with `syntheticNamedExports: "__synthetic"` needs an explicit export named "__synthetic" that does not reexport an unresolved named export of the same module.' } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js b/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js index d23377b2df2..3bbcc0207d3 100644 --- a/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js +++ b/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js @@ -1,10 +1,11 @@ -module.exports = { +module.exports = defineTest({ description: 'makes sure default exports of synthetic named exports are snapshots', options: { plugins: { + name: 'test-plugin', transform() { return { syntheticNamedExports: '__synthetic' }; } } } -}; +}); diff --git a/test/function/samples/synthetic-named-exports/synthetic-named-export-entry/_config.js b/test/function/samples/synthetic-named-exports/synthetic-named-export-entry/_config.js index 8c96a84613a..be9caf628e0 100644 --- a/test/function/samples/synthetic-named-exports/synthetic-named-export-entry/_config.js +++ b/test/function/samples/synthetic-named-exports/synthetic-named-export-entry/_config.js @@ -5,11 +5,12 @@ const ID_OVERRIDE = path.join(__dirname, 'override.js'); const ID_NOOVERRIDE = path.join(__dirname, 'noOverride.js'); const ID_HIDDENNAMESPACE = path.join(__dirname, 'hiddenNamespace.js'); -module.exports = { +module.exports = defineTest({ description: 'does not expose synthetic named exports on entry points', options: { plugins: [ { + name: 'test-plugin1', transform(code, id) { switch (id) { case ID_MAIN: { @@ -40,4 +41,4 @@ module.exports = { synthOverride: 'overridden' }); } -}; +}); diff --git a/test/function/samples/tagged-template-deoptimize/_config.js b/test/function/samples/tagged-template-deoptimize/_config.js index 2f550cae185..04d62a8910b 100644 --- a/test/function/samples/tagged-template-deoptimize/_config.js +++ b/test/function/samples/tagged-template-deoptimize/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly deoptimizes tagged template expressions' -}; +}); diff --git a/test/function/samples/this-not-namespace/_config.js b/test/function/samples/this-not-namespace/_config.js index f2aa437a24d..d1a051a5b12 100644 --- a/test/function/samples/this-not-namespace/_config.js +++ b/test/function/samples/this-not-namespace/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'does not treat this.foo as a possible namespace (#1258)', exports: exports => { assert.equal(typeof exports.Foo, 'function'); } -}; +}); diff --git a/test/function/samples/this-side-effect/_config.js b/test/function/samples/this-side-effect/_config.js index 8288a1f6c00..0d3de334024 100644 --- a/test/function/samples/this-side-effect/_config.js +++ b/test/function/samples/this-side-effect/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'detects side effects when mutating "this" in a constructor' -}; +}); diff --git a/test/function/samples/throws-not-found-module/_config.js b/test/function/samples/throws-not-found-module/_config.js index 2f6f1fd25a2..c442e34140c 100644 --- a/test/function/samples/throws-not-found-module/_config.js +++ b/test/function/samples/throws-not-found-module/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'throws error if module is not found', error: { code: 'UNRESOLVED_IMPORT', @@ -10,4 +10,4 @@ module.exports = { watchFiles: [ID_MAIN], message: 'Could not resolve "./mod" from "main.js"' } -}; +}); diff --git a/test/function/samples/top-level-arrow-function/_config.js b/test/function/samples/top-level-arrow-function/_config.js index 95d2df90e5a..6ed02c4dea0 100644 --- a/test/function/samples/top-level-arrow-function/_config.js +++ b/test/function/samples/top-level-arrow-function/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles naked return value from top-level arrow function expression (#403)' -}; +}); diff --git a/test/function/samples/top-level-block/_config.js b/test/function/samples/top-level-block/_config.js index 1cc39dbebd1..913fa57bdf9 100644 --- a/test/function/samples/top-level-block/_config.js +++ b/test/function/samples/top-level-block/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'allows top-level block' -}; +}); diff --git a/test/function/samples/top-level-side-effect-on-imported/_config.js b/test/function/samples/top-level-side-effect-on-imported/_config.js index f07d5803f16..a9997046d93 100644 --- a/test/function/samples/top-level-side-effect-on-imported/_config.js +++ b/test/function/samples/top-level-side-effect-on-imported/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'top level function calls are preserved' -}; +}); diff --git a/test/function/samples/top-level-side-effects-are-preserved/_config.js b/test/function/samples/top-level-side-effects-are-preserved/_config.js index 7201d855e32..63c7061ff20 100644 --- a/test/function/samples/top-level-side-effects-are-preserved/_config.js +++ b/test/function/samples/top-level-side-effects-are-preserved/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'top level side effects are preserved' -}; +}); diff --git a/test/function/samples/trace-inclusion-of-virtual-literals/_config.js b/test/function/samples/trace-inclusion-of-virtual-literals/_config.js index a9c896b523b..baa4d3807ee 100644 --- a/test/function/samples/trace-inclusion-of-virtual-literals/_config.js +++ b/test/function/samples/trace-inclusion-of-virtual-literals/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks the "included" state of virtual literals with regard to mutating oparations' -}; +}); diff --git a/test/function/samples/track-async-arrow-function-return-value/_config.js b/test/function/samples/track-async-arrow-function-return-value/_config.js index 477121a5bee..303b80bbc43 100644 --- a/test/function/samples/track-async-arrow-function-return-value/_config.js +++ b/test/function/samples/track-async-arrow-function-return-value/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'tracks object mutations of async arrow function return values', async exports(exports) { assert.strictEqual(exports.toggled, false); await exports.test(); assert.strictEqual(exports.toggled, true); } -}; +}); diff --git a/test/function/samples/track-async-function-return-value/_config.js b/test/function/samples/track-async-function-return-value/_config.js index af8b08ff12f..75aebf0c704 100644 --- a/test/function/samples/track-async-function-return-value/_config.js +++ b/test/function/samples/track-async-function-return-value/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'tracks object mutations of async function return values', async exports(exports) { assert.strictEqual(exports.toggled, false); await exports.test(); assert.strictEqual(exports.toggled, true); } -}; +}); diff --git a/test/function/samples/track-awaited-object/_config.js b/test/function/samples/track-awaited-object/_config.js index f78fd6dc4ad..fc462923571 100644 --- a/test/function/samples/track-awaited-object/_config.js +++ b/test/function/samples/track-awaited-object/_config.js @@ -1,10 +1,10 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'tracks object mutations through await', async exports(exports) { assert.strictEqual(exports.toggled, false); await exports.test(); assert.strictEqual(exports.toggled, true); } -}; +}); diff --git a/test/function/samples/track-conditional-expression-return-reassignments/_config.js b/test/function/samples/track-conditional-expression-return-reassignments/_config.js index 4a727bbfbf5..036e8b6b772 100644 --- a/test/function/samples/track-conditional-expression-return-reassignments/_config.js +++ b/test/function/samples/track-conditional-expression-return-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of return expressions of conditional expressions' -}; +}); diff --git a/test/function/samples/track-logical-expression-return-reassignments/_config.js b/test/function/samples/track-logical-expression-return-reassignments/_config.js index 621b12db34e..92f3e39b0f0 100644 --- a/test/function/samples/track-logical-expression-return-reassignments/_config.js +++ b/test/function/samples/track-logical-expression-return-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of return expressions of logical expressions' -}; +}); diff --git a/test/function/samples/track-multiple-return-expression-reassignments/_config.js b/test/function/samples/track-multiple-return-expression-reassignments/_config.js index cf6ff7bef33..70a05fb0674 100644 --- a/test/function/samples/track-multiple-return-expression-reassignments/_config.js +++ b/test/function/samples/track-multiple-return-expression-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of return expressions of multiple return expressions' -}; +}); diff --git a/test/function/samples/track-parameter-return-reassignments/_config.js b/test/function/samples/track-parameter-return-reassignments/_config.js index 991743fb8ab..6fdccd79bd5 100644 --- a/test/function/samples/track-parameter-return-reassignments/_config.js +++ b/test/function/samples/track-parameter-return-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of return expressions of parameters' -}; +}); diff --git a/test/function/samples/track-reassigned-object-expression-return-reassignments/_config.js b/test/function/samples/track-reassigned-object-expression-return-reassignments/_config.js index 9012c4c069e..9e763dd3baa 100644 --- a/test/function/samples/track-reassigned-object-expression-return-reassignments/_config.js +++ b/test/function/samples/track-reassigned-object-expression-return-reassignments/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks reassignments of return expressions of members of reassigned object expressions' -}; +}); diff --git a/test/function/samples/track-reassignments/_config.js b/test/function/samples/track-reassignments/_config.js index 5776de3fe6f..b850e4b941c 100644 --- a/test/function/samples/track-reassignments/_config.js +++ b/test/function/samples/track-reassignments/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'properly track reassignments (#4468)' -}; +}); diff --git a/test/function/samples/tracks-alias-mutations-b/_config.js b/test/function/samples/tracks-alias-mutations-b/_config.js index a06a799c7e0..222a665c1ed 100644 --- a/test/function/samples/tracks-alias-mutations-b/_config.js +++ b/test/function/samples/tracks-alias-mutations-b/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const foo = {}; -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of aliased objects', context: { foo @@ -10,4 +10,4 @@ module.exports = { exports() { assert.equal(foo.x, 42); } -}; +}); diff --git a/test/function/samples/tracks-alias-mutations/_config.js b/test/function/samples/tracks-alias-mutations/_config.js index f2faaad0e87..e20a9461154 100644 --- a/test/function/samples/tracks-alias-mutations/_config.js +++ b/test/function/samples/tracks-alias-mutations/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'tracks mutations of aliased objects' -}; +}); diff --git a/test/function/samples/transform-empty-string/_config.js b/test/function/samples/transform-empty-string/_config.js index 72a586be0c9..77af2600526 100644 --- a/test/function/samples/transform-empty-string/_config.js +++ b/test/function/samples/transform-empty-string/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const sideEffects = []; -module.exports = { +module.exports = defineTest({ description: 'allows transformers to transform code to an empty string', context: { sideEffects }, exports() { @@ -18,4 +18,4 @@ module.exports = { } } } -}; +}); diff --git a/test/function/samples/transform-without-code-warn-ast/_config.js b/test/function/samples/transform-without-code-warn-ast/_config.js index ef751ca124e..891825a0ef8 100644 --- a/test/function/samples/transform-without-code-warn-ast/_config.js +++ b/test/function/samples/transform-without-code-warn-ast/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns when returning a map but no code from a transform hook', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { 'The plugin "test-plugin" returned a "map" or "ast" without returning a "code". This will be ignored.' } ] -}; +}); diff --git a/test/function/samples/transform-without-code-warn-map/_config.js b/test/function/samples/transform-without-code-warn-map/_config.js index c8e3689ab50..26221ba80c9 100644 --- a/test/function/samples/transform-without-code-warn-map/_config.js +++ b/test/function/samples/transform-without-code-warn-map/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns when returning a map but no code from a transform hook', options: { plugins: { @@ -15,4 +15,4 @@ module.exports = { 'The plugin "test-plugin" returned a "map" or "ast" without returning a "code". This will be ignored.' } ] -}; +}); diff --git a/test/function/samples/transform-without-code/_config.js b/test/function/samples/transform-without-code/_config.js index fc9dfd70e17..7f145702a4e 100644 --- a/test/function/samples/transform-without-code/_config.js +++ b/test/function/samples/transform-without-code/_config.js @@ -3,7 +3,7 @@ const { readFileSync } = require('node:fs'); const path = require('node:path'); const { SourceMapConsumer } = require('source-map'); -module.exports = { +module.exports = defineTest({ description: 'allows using the transform hook for annotations only without returning a code property and breaking sourcemaps', options: { @@ -38,4 +38,4 @@ module.exports = { sourcemap: true } } -}; +}); diff --git a/test/sourcemaps/samples/transform-without-sourcemap-render-chunk/_config.js b/test/function/samples/transform-without-sourcemap-render-chunk/_config.js similarity index 91% rename from test/sourcemaps/samples/transform-without-sourcemap-render-chunk/_config.js rename to test/function/samples/transform-without-sourcemap-render-chunk/_config.js index ce9b3ccb1e9..46076d52430 100644 --- a/test/sourcemaps/samples/transform-without-sourcemap-render-chunk/_config.js +++ b/test/function/samples/transform-without-sourcemap-render-chunk/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves sourcemap chains when transforming', options: { plugins: [ @@ -17,7 +17,8 @@ module.exports = { return { code, map: null }; } } - ] + ], + output: { sourcemap: true } }, warnings: [ { @@ -27,4 +28,4 @@ module.exports = { url: `https://rollupjs.org/troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect` } ] -}; +}); diff --git a/test/function/samples/transform-without-sourcemap-render-chunk/main.js b/test/function/samples/transform-without-sourcemap-render-chunk/main.js new file mode 100644 index 00000000000..69305ae375a --- /dev/null +++ b/test/function/samples/transform-without-sourcemap-render-chunk/main.js @@ -0,0 +1 @@ +assert.strictEqual(42, 42); diff --git a/test/function/samples/transformer-async/_config.js b/test/function/samples/transformer-async/_config.js index 1457ed86330..79fe2dba9a5 100644 --- a/test/function/samples/transformer-async/_config.js +++ b/test/function/samples/transformer-async/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'transformers can be asynchronous', options: { plugins: [ @@ -19,4 +19,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/transformer-multiple/_config.js b/test/function/samples/transformer-multiple/_config.js index 3e5d98ed043..86824951a32 100644 --- a/test/function/samples/transformer-multiple/_config.js +++ b/test/function/samples/transformer-multiple/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'accepts multiple transformer functions', options: { plugins: [ @@ -20,4 +20,4 @@ module.exports = { exports(exports) { assert.equal(exports.magicNumber, 6); } -}; +}); diff --git a/test/function/samples/transformer-single/_config.js b/test/function/samples/transformer-single/_config.js index 1037ac1d409..77f1f555bcb 100644 --- a/test/function/samples/transformer-single/_config.js +++ b/test/function/samples/transformer-single/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'accepts a single transformer function', options: { plugins: [ @@ -14,4 +14,4 @@ module.exports = { exports(exports) { assert.equal(exports.magicNumber, 3); } -}; +}); diff --git a/test/function/samples/transparent-dynamic-inlining/_config.js b/test/function/samples/transparent-dynamic-inlining/_config.js index 8a0844b3a65..4eea7a9c499 100644 --- a/test/function/samples/transparent-dynamic-inlining/_config.js +++ b/test/function/samples/transparent-dynamic-inlining/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'Dynamic import inlining when resolution id is a module in the bundle', code(code) { assert.ok(!code.includes('import(')); @@ -9,4 +9,4 @@ module.exports = { exports(exports) { assert.deepEqual(exports, { y: 42 }); } -}; +}); diff --git a/test/function/samples/tree-shake-object-expression-assignment/_config.js b/test/function/samples/tree-shake-object-expression-assignment/_config.js index 04340104ccd..de5da93825e 100644 --- a/test/function/samples/tree-shake-object-expression-assignment/_config.js +++ b/test/function/samples/tree-shake-object-expression-assignment/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'renders valid code when the target of an object expression with side-effects is tree-shaken' -}; +}); diff --git a/test/function/samples/tree-shake-variable-declarations-2/_config.js b/test/function/samples/tree-shake-variable-declarations-2/_config.js index 14da162cca0..7adfe470fd8 100644 --- a/test/function/samples/tree-shake-variable-declarations-2/_config.js +++ b/test/function/samples/tree-shake-variable-declarations-2/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'remove unused variables from declarations (#1831)', code(code) { assert.ok(code.search(/var a = 'test'/) >= 0); } -}; +}); diff --git a/test/function/samples/tree-shake-variable-declarations/_config.js b/test/function/samples/tree-shake-variable-declarations/_config.js index 0cfa1bb96ad..8f4662e0a9e 100644 --- a/test/function/samples/tree-shake-variable-declarations/_config.js +++ b/test/function/samples/tree-shake-variable-declarations/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'remove unused variables from declarations (#1937)', exports(exports) { assert.deepEqual(exports(), [0.07]); } -}; +}); diff --git a/test/function/samples/trim-conditional-branches-in-exports/_config.js b/test/function/samples/trim-conditional-branches-in-exports/_config.js index c084f7edd1b..7926ff0237b 100644 --- a/test/function/samples/trim-conditional-branches-in-exports/_config.js +++ b/test/function/samples/trim-conditional-branches-in-exports/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'trims conditional branches with a renamed default export' -}; +}); diff --git a/test/function/samples/try-catch-scoping/_config.js b/test/function/samples/try-catch-scoping/_config.js index 9518d7d678c..99ef3b8beff 100644 --- a/test/function/samples/try-catch-scoping/_config.js +++ b/test/function/samples/try-catch-scoping/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'error parameter in catch clause is correctly scoped' -}; +}); diff --git a/test/function/samples/unknown-for-loop-variables/_config.js b/test/function/samples/unknown-for-loop-variables/_config.js index 3cdd03fec38..f4a546bfde1 100644 --- a/test/function/samples/unknown-for-loop-variables/_config.js +++ b/test/function/samples/unknown-for-loop-variables/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'treat for-in and for-of loop variables as unknown' -}; +}); diff --git a/test/function/samples/unknown-generated-code-preset/_config.js b/test/function/samples/unknown-generated-code-preset/_config.js index 7f6009c536c..b98cd3519b7 100644 --- a/test/function/samples/unknown-generated-code-preset/_config.js +++ b/test/function/samples/unknown-generated-code-preset/_config.js @@ -1,8 +1,11 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for unknown presets for the generatedCode option', options: { output: { - generatedCode: { preset: 'some-string' } + generatedCode: { + // @ts-expect-error expected error + preset: 'some-string' + } } }, generateError: { @@ -11,4 +14,4 @@ module.exports = { 'Invalid value "some-string" for option "output.generatedCode.preset" - valid values are "es2015" and "es5".', url: 'https://rollupjs.org/configuration-options/#output-generatedcode' } -}; +}); diff --git a/test/function/samples/unknown-generated-code-value/_config.js b/test/function/samples/unknown-generated-code-value/_config.js index 375a6b9055f..c010eb4ce3f 100644 --- a/test/function/samples/unknown-generated-code-value/_config.js +++ b/test/function/samples/unknown-generated-code-value/_config.js @@ -1,7 +1,8 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for unknown string values for the generatedCode option', options: { output: { + // @ts-expect-error expected error generatedCode: 'some-string' } }, @@ -11,4 +12,4 @@ module.exports = { 'Invalid value "some-string" for option "output.generatedCode" - valid values are "es2015" and "es5". You can also supply an object for more fine-grained control.', url: 'https://rollupjs.org/configuration-options/#output-generatedcode' } -}; +}); diff --git a/test/function/samples/unknown-global-side-effects/_config.js b/test/function/samples/unknown-global-side-effects/_config.js index a69fbb8a562..ca4a3c691d0 100644 --- a/test/function/samples/unknown-global-side-effects/_config.js +++ b/test/function/samples/unknown-global-side-effects/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not omit side-effects from unknown globals', exports(exports) { let error; @@ -11,4 +11,4 @@ module.exports = { throw new TypeError('Expected a ReferenceError to be thrown.'); } } -}; +}); diff --git a/test/function/samples/unknown-statement/_config.js b/test/function/samples/unknown-statement/_config.js index b52eca19457..56e69822f70 100644 --- a/test/function/samples/unknown-statement/_config.js +++ b/test/function/samples/unknown-statement/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'handles unknown statements' -}; +}); diff --git a/test/function/samples/unknown-treeshake-preset/_config.js b/test/function/samples/unknown-treeshake-preset/_config.js index 59ef474c558..09a96076a26 100644 --- a/test/function/samples/unknown-treeshake-preset/_config.js +++ b/test/function/samples/unknown-treeshake-preset/_config.js @@ -1,7 +1,10 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for unknown presets for the treeshake option', options: { - treeshake: { preset: 'some-string' } + treeshake: { + // @ts-expect-error expected error + preset: 'some-string' + } }, error: { code: 'INVALID_OPTION', @@ -9,4 +12,4 @@ module.exports = { 'Invalid value "some-string" for option "treeshake.preset" - valid values are "recommended", "safest" and "smallest".', url: 'https://rollupjs.org/configuration-options/#treeshake' } -}; +}); diff --git a/test/function/samples/unknown-treeshake-value/_config.js b/test/function/samples/unknown-treeshake-value/_config.js index 0311f02d01b..9d640033169 100644 --- a/test/function/samples/unknown-treeshake-value/_config.js +++ b/test/function/samples/unknown-treeshake-value/_config.js @@ -1,6 +1,7 @@ -module.exports = { +module.exports = defineTest({ description: 'throws for unknown string values for the treeshake option', options: { + // @ts-expect-error expected error treeshake: 'some-string' }, error: { @@ -9,4 +10,4 @@ module.exports = { 'Invalid value "some-string" for option "treeshake" - valid values are false, true, "recommended", "safest" and "smallest". You can also supply an object for more fine-grained control.', url: 'https://rollupjs.org/configuration-options/#treeshake' } -}; +}); diff --git a/test/function/samples/unused-constructor-argument-fallback/_config.js b/test/function/samples/unused-constructor-argument-fallback/_config.js index 648b74ac149..77c5bf24832 100644 --- a/test/function/samples/unused-constructor-argument-fallback/_config.js +++ b/test/function/samples/unused-constructor-argument-fallback/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'handles unused logical expressions as constructor arguments (#4517)', exports({ create }) { assert.strictEqual(create().foo, 'foo'); } -}; +}); diff --git a/test/function/samples/unused-do-while-loop-declaration/_config.js b/test/function/samples/unused-do-while-loop-declaration/_config.js index 9b51c20745a..d221993e4e6 100644 --- a/test/function/samples/unused-do-while-loop-declaration/_config.js +++ b/test/function/samples/unused-do-while-loop-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in do-while loop bodies' -}; +}); diff --git a/test/function/samples/unused-for-in-loop-declaration/_config.js b/test/function/samples/unused-for-in-loop-declaration/_config.js index 9da0091ef68..670ca9c8ced 100644 --- a/test/function/samples/unused-for-in-loop-declaration/_config.js +++ b/test/function/samples/unused-for-in-loop-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in for-in loop bodies' -}; +}); diff --git a/test/function/samples/unused-for-loop-body-declaration/_config.js b/test/function/samples/unused-for-loop-body-declaration/_config.js index 5912da84ed0..2ca4c8f6d26 100644 --- a/test/function/samples/unused-for-loop-body-declaration/_config.js +++ b/test/function/samples/unused-for-loop-body-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in for loop bodies' -}; +}); diff --git a/test/function/samples/unused-for-loop-init-declaration/_config.js b/test/function/samples/unused-for-loop-init-declaration/_config.js index ed47aec6333..665b538b93c 100644 --- a/test/function/samples/unused-for-loop-init-declaration/_config.js +++ b/test/function/samples/unused-for-loop-init-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in for loops' -}; +}); diff --git a/test/function/samples/unused-for-of-loop-declaration/_config.js b/test/function/samples/unused-for-of-loop-declaration/_config.js index 4741e2c4ceb..5da899464d0 100644 --- a/test/function/samples/unused-for-of-loop-declaration/_config.js +++ b/test/function/samples/unused-for-of-loop-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in for-of loop bodies' -}; +}); diff --git a/test/function/samples/unused-if-statement-declaration/_config.js b/test/function/samples/unused-if-statement-declaration/_config.js index ed47aec6333..665b538b93c 100644 --- a/test/function/samples/unused-if-statement-declaration/_config.js +++ b/test/function/samples/unused-if-statement-declaration/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in for loops' -}; +}); diff --git a/test/function/samples/unused-import/_config.js b/test/function/samples/unused-import/_config.js index 912298b0036..50cae83e3b7 100644 --- a/test/function/samples/unused-import/_config.js +++ b/test/function/samples/unused-import/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'warns on unused imports ([#595])', options: { external: ['external'] @@ -21,4 +21,4 @@ module.exports = { names: ['notused', 'neverused'] } ] -}; +}); diff --git a/test/function/samples/unused-parameter-side-effects/_config.js b/test/function/samples/unused-parameter-side-effects/_config.js index f8c2ead51f4..672bc09c157 100644 --- a/test/function/samples/unused-parameter-side-effects/_config.js +++ b/test/function/samples/unused-parameter-side-effects/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not tree-shake arguments where the corresponding parameters have side-effects' -}; +}); diff --git a/test/function/samples/unused-parenthesed-assignment/_config.js b/test/function/samples/unused-parenthesed-assignment/_config.js index 24d8c766197..5e091f91b57 100644 --- a/test/function/samples/unused-parenthesed-assignment/_config.js +++ b/test/function/samples/unused-parenthesed-assignment/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'correctly simplifies assignments with right-hand-sides in parentheses (#3924)', context: { someObject: { isTrue: true } } -}; +}); diff --git a/test/function/samples/unused-var-a/_config.js b/test/function/samples/unused-var-a/_config.js index 05a2b74ac31..b97c8ce85d5 100644 --- a/test/function/samples/unused-var-a/_config.js +++ b/test/function/samples/unused-var-a/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'omits unused var declaration (a)' -}; +}); diff --git a/test/function/samples/unused-var-b/_config.js b/test/function/samples/unused-var-b/_config.js index 174d9fec4d5..73c5dbd5334 100644 --- a/test/function/samples/unused-var-b/_config.js +++ b/test/function/samples/unused-var-b/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'omits unused var declaration (b)' -}; +}); diff --git a/test/function/samples/unused-var-c/_config.js b/test/function/samples/unused-var-c/_config.js index e40d968afae..9f013bf0c66 100644 --- a/test/function/samples/unused-var-c/_config.js +++ b/test/function/samples/unused-var-c/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'omits unused var declaration (c)' -}; +}); diff --git a/test/function/samples/unused-var-d/_config.js b/test/function/samples/unused-var-d/_config.js index 78379d68b47..0595b4968ce 100644 --- a/test/function/samples/unused-var-d/_config.js +++ b/test/function/samples/unused-var-d/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'omits unused var declaration (d)' -}; +}); diff --git a/test/function/samples/unused-while-loop-declaration/_config.js b/test/function/samples/unused-while-loop-declaration/_config.js index 4f236593d35..430de1bbcd0 100644 --- a/test/function/samples/unused-while-loop-declaration/_config.js +++ b/test/function/samples/unused-while-loop-declaration/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'does not partially tree-shake unused declarations with side-effects in while loop bodies' -}; +}); diff --git a/test/function/samples/update-expression-accessors/_config.js b/test/function/samples/update-expression-accessors/_config.js index f271e4ae349..2532457a2c9 100644 --- a/test/function/samples/update-expression-accessors/_config.js +++ b/test/function/samples/update-expression-accessors/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'deoptimizes "this" for accessors triggered by update expressions' -}; +}); diff --git a/test/function/samples/update-expression-of-import-fails/_config.js b/test/function/samples/update-expression-of-import-fails/_config.js index e478600076d..c4a525ab4b6 100644 --- a/test/function/samples/update-expression-of-import-fails/_config.js +++ b/test/function/samples/update-expression-of-import-fails/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'disallows updates to imported bindings', error: { code: 'ILLEGAL_REASSIGNMENT', @@ -21,6 +21,6 @@ module.exports = { watchFiles: [ID_FOO, ID_MAIN], message: 'Illegal reassignment of import "a" in "main.js".' } -}; +}); // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/update-expression-of-import-fails diff --git a/test/function/samples/use-class-name-in-static-block/_config.js b/test/function/samples/use-class-name-in-static-block/_config.js index 53bc76e249c..e68adda2729 100644 --- a/test/function/samples/use-class-name-in-static-block/_config.js +++ b/test/function/samples/use-class-name-in-static-block/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'use the original class name instead of renderName in class body', minNodeVersion: 16 -}; +}); diff --git a/test/function/samples/use-var-before-decl/_config.js b/test/function/samples/use-var-before-decl/_config.js index c39aa3c5730..554a6aa1bf7 100644 --- a/test/function/samples/use-var-before-decl/_config.js +++ b/test/function/samples/use-var-before-decl/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'exercise `var` variables before their declarations' -}; +}); diff --git a/test/function/samples/uses-supplied-ast/_config.js b/test/function/samples/uses-supplied-ast/_config.js index eff176ea03b..367086d7362 100644 --- a/test/function/samples/uses-supplied-ast/_config.js +++ b/test/function/samples/uses-supplied-ast/_config.js @@ -20,7 +20,7 @@ const modules = { }; modules.foo.ast._ignoredProp = {}; -module.exports = { +module.exports = defineTest({ description: 'uses supplied AST', options: { plugins: [ @@ -39,4 +39,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/validate-output/_config.js b/test/function/samples/validate-output/_config.js index 1dff84eda97..2f98812e438 100644 --- a/test/function/samples/validate-output/_config.js +++ b/test/function/samples/validate-output/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles validate failure', options: { onwarn(warning) { @@ -23,4 +23,4 @@ module.exports = { line: 5 } } -}; +}); diff --git a/test/function/samples/validate-resolved-by-logic/_config.js b/test/function/samples/validate-resolved-by-logic/_config.js index e2cc4dbcda8..aadce4f4b54 100644 --- a/test/function/samples/validate-resolved-by-logic/_config.js +++ b/test/function/samples/validate-resolved-by-logic/_config.js @@ -6,7 +6,7 @@ const BAR_IMPORTED_PATH = './bar.js'; const OTHER_IMPORTED_PATH = './other.js'; const MAIN_PATH = resolve(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'validate resolvedBy logic', options: { plugins: [ @@ -48,4 +48,4 @@ module.exports = { } ] } -}; +}); diff --git a/test/function/samples/vars-in-for-loop-head/_config.js b/test/function/samples/vars-in-for-loop-head/_config.js index 166d6eea4e8..6bad2bceb75 100644 --- a/test/function/samples/vars-in-for-loop-head/_config.js +++ b/test/function/samples/vars-in-for-loop-head/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not break apart vars in for loop head' -}; +}); diff --git a/test/function/samples/vars-not-removed-in-if-block/_config.js b/test/function/samples/vars-not-removed-in-if-block/_config.js index c34bcea62e6..8b718ec0d37 100644 --- a/test/function/samples/vars-not-removed-in-if-block/_config.js +++ b/test/function/samples/vars-not-removed-in-if-block/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'preserves var declarations in if blocks (#1113)' -}; +}); diff --git a/test/function/samples/vars-not-removed/_config.js b/test/function/samples/vars-not-removed/_config.js index b3daeeff16a..b590402b3d9 100644 --- a/test/function/samples/vars-not-removed/_config.js +++ b/test/function/samples/vars-not-removed/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'does not erroneously remove var/let/const keywords (#390)' -}; +}); diff --git a/test/function/samples/vars-with-init-in-dead-branch/_config.js b/test/function/samples/vars-with-init-in-dead-branch/_config.js index f0b620aaeb2..7e50dc219d2 100644 --- a/test/function/samples/vars-with-init-in-dead-branch/_config.js +++ b/test/function/samples/vars-with-init-in-dead-branch/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'handles vars with init in dead branch (#1198)', warnings: [ { @@ -7,4 +7,4 @@ module.exports = { names: ['main'] } ] -}; +}); diff --git a/test/function/samples/warn-missing-iife-name/_config.js b/test/function/samples/warn-missing-iife-name/_config.js index b6a212a74a0..c7b0d38ab8b 100644 --- a/test/function/samples/warn-missing-iife-name/_config.js +++ b/test/function/samples/warn-missing-iife-name/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns if no name is provided for an IIFE bundle', options: { output: { format: 'iife' } }, warnings: [ @@ -9,4 +9,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-name' } ] -}; +}); diff --git a/test/function/samples/warn-on-auto-named-default-exports/_config.js b/test/function/samples/warn-on-auto-named-default-exports/_config.js index a8a0b564a01..5858663b822 100644 --- a/test/function/samples/warn-on-auto-named-default-exports/_config.js +++ b/test/function/samples/warn-on-auto-named-default-exports/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'warns if default and named exports are used in auto mode', warnings: [ { @@ -12,4 +12,4 @@ module.exports = { url: 'https://rollupjs.org/configuration-options/#output-exports' } ] -}; +}); diff --git a/test/function/samples/warn-on-empty-bundle/_config.js b/test/function/samples/warn-on-empty-bundle/_config.js index b4416af6431..1edccde24ed 100644 --- a/test/function/samples/warn-on-empty-bundle/_config.js +++ b/test/function/samples/warn-on-empty-bundle/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns if empty bundle is generated (#444)', warnings: [ { @@ -7,4 +7,4 @@ module.exports = { names: ['main'] } ] -}; +}); diff --git a/test/function/samples/warn-on-eval/_config.js b/test/function/samples/warn-on-eval/_config.js index 892336bae44..e6b40ffb9f8 100644 --- a/test/function/samples/warn-on-eval/_config.js +++ b/test/function/samples/warn-on-eval/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'warns about use of eval', warnings: [ { @@ -21,4 +21,4 @@ module.exports = { ^` } ] -}; +}); diff --git a/test/function/samples/warn-on-namespace-conflict/_config.js b/test/function/samples/warn-on-namespace-conflict/_config.js index ff69ef2b844..c45d904e5aa 100644 --- a/test/function/samples/warn-on-namespace-conflict/_config.js +++ b/test/function/samples/warn-on-namespace-conflict/_config.js @@ -3,7 +3,7 @@ const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); const ID_BAR = path.join(__dirname, 'bar.js'); -module.exports = { +module.exports = defineTest({ description: 'warns on duplicate export * from', warnings: [ { @@ -15,4 +15,4 @@ module.exports = { reexporter: ID_MAIN } ] -}; +}); diff --git a/test/function/samples/warn-on-top-level-this/_config.js b/test/function/samples/warn-on-top-level-this/_config.js index 8b4aec93fb7..96c0ac20b27 100644 --- a/test/function/samples/warn-on-top-level-this/_config.js +++ b/test/function/samples/warn-on-top-level-this/_config.js @@ -1,7 +1,7 @@ const path = require('node:path'); const { assertIncludes } = require('../../../utils.js'); -module.exports = { +module.exports = defineTest({ description: 'warns on top-level this (#770)', warnings: [ { @@ -27,4 +27,4 @@ module.exports = { assertIncludes(error.message, 'Cannot set propert'); assertIncludes(error.message, "'foo'"); } -}; +}); diff --git a/test/function/samples/warn-on-unused-missing-imports/_config.js b/test/function/samples/warn-on-unused-missing-imports/_config.js index f93e8accc5a..89e459c4860 100644 --- a/test/function/samples/warn-on-unused-missing-imports/_config.js +++ b/test/function/samples/warn-on-unused-missing-imports/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const ID_MAIN = path.join(__dirname, 'main.js'); const ID_FOO = path.join(__dirname, 'foo.js'); -module.exports = { +module.exports = defineTest({ description: 'warns on missing (but unused) imports', warnings: [ { @@ -25,4 +25,4 @@ module.exports = { 3: assert.equal( a, 42 );` } ] -}; +}); diff --git a/test/function/samples/warning-incorrect-sourcemap-location/_config.js b/test/function/samples/warning-incorrect-sourcemap-location/_config.js index 3dba1354083..fde30b21181 100644 --- a/test/function/samples/warning-incorrect-sourcemap-location/_config.js +++ b/test/function/samples/warning-incorrect-sourcemap-location/_config.js @@ -2,7 +2,7 @@ const { join } = require('node:path'); const ID_MAIN = join(__dirname, 'main.js'); const ID_CONSTANTS = join(__dirname, 'constants.js'); -module.exports = { +module.exports = defineTest({ description: 'does not fail if a warning has an incorrect location due to missing sourcemaps', options: { plugins: [ @@ -31,4 +31,4 @@ module.exports = { url: 'https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module' } ] -}; +}); diff --git a/test/function/samples/warning-low-resolution-location/_config.js b/test/function/samples/warning-low-resolution-location/_config.js index 232ec5ea80e..3c6fc0f4c2a 100644 --- a/test/function/samples/warning-low-resolution-location/_config.js +++ b/test/function/samples/warning-low-resolution-location/_config.js @@ -2,7 +2,7 @@ const path = require('node:path'); const { encode } = require('@jridgewell/sourcemap-codec'); const ID_MAIN = path.join(__dirname, 'main.js'); -module.exports = { +module.exports = defineTest({ description: 'handles when a low resolution sourcemap is used to report an error', options: { plugins: { @@ -34,4 +34,4 @@ module.exports = { url: 'https://rollupjs.org/troubleshooting/#error-this-is-undefined' } ] -}; +}); diff --git a/test/function/samples/warnings-to-string/_config.js b/test/function/samples/warnings-to-string/_config.js index b397e1c5b2f..afc8c0dd9bd 100644 --- a/test/function/samples/warnings-to-string/_config.js +++ b/test/function/samples/warnings-to-string/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'provides a string conversion for warnings', options: { plugins: { @@ -16,4 +16,4 @@ module.exports = { 'Generated an empty chunk: "main".' ]); } -}; +}); diff --git a/test/function/samples/warns-for-invalid-options/_config.js b/test/function/samples/warns-for-invalid-options/_config.js index d4bdcdbefb7..79c69c0ff31 100644 --- a/test/function/samples/warns-for-invalid-options/_config.js +++ b/test/function/samples/warns-for-invalid-options/_config.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = defineTest({ description: 'warns for invalid options', options: { myInvalidInputOption: true, @@ -20,4 +20,4 @@ module.exports = { require('../../../misc/optionList').output } ] -}; +}); diff --git a/test/function/samples/watch-option/_config.js b/test/function/samples/watch-option/_config.js index 6c0b780f634..6b76a77ff71 100644 --- a/test/function/samples/watch-option/_config.js +++ b/test/function/samples/watch-option/_config.js @@ -1,6 +1,6 @@ -module.exports = { +module.exports = defineTest({ description: 'expects watch option', options: { watch: {} } -}; +}); diff --git a/test/function/samples/wraps-object-expressions-as-statements/_config.js b/test/function/samples/wraps-object-expressions-as-statements/_config.js index 0e64ab19194..f3d5c6d7626 100644 --- a/test/function/samples/wraps-object-expressions-as-statements/_config.js +++ b/test/function/samples/wraps-object-expressions-as-statements/_config.js @@ -1,3 +1,3 @@ -module.exports = { +module.exports = defineTest({ description: 'wraps object expressions that have become statements' -}; +}); diff --git a/test/function/samples/wraps-simplified-expressions/_config.js b/test/function/samples/wraps-simplified-expressions/_config.js index 8ba4fe8910b..481ea4f3841 100644 --- a/test/function/samples/wraps-simplified-expressions/_config.js +++ b/test/function/samples/wraps-simplified-expressions/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'wraps simplified expressions that have become callees if necessary', warnings: warnings => { for (const warning of warnings) assert.equal(warning.code, 'EVAL'); } -}; +}); diff --git a/test/function/tsconfig.json b/test/function/tsconfig.json new file mode 100644 index 00000000000..4a26f3ee84c --- /dev/null +++ b/test/function/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./index.js", + "./define.d.ts" + ] +} diff --git a/test/hooks/index.js b/test/hooks/index.js index 3ad4fa44503..7c8a4107fea 100644 --- a/test/hooks/index.js +++ b/test/hooks/index.js @@ -1,6 +1,9 @@ const assert = require('node:assert'); const path = require('node:path'); const { outputFile, readdir, remove } = require('fs-extra'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ const rollup = require('../../dist/rollup.js'); const { loader, wait } = require('../utils.js'); diff --git a/test/incremental/index.js b/test/incremental/index.js index c10d7840b7d..304b73e4873 100644 --- a/test/incremental/index.js +++ b/test/incremental/index.js @@ -1,5 +1,8 @@ const assert = require('node:assert'); const acorn = require('acorn'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ const rollup = require('../../dist/rollup'); const { executeBundle, getObject } = require('../utils.js'); diff --git a/test/leak/index.js b/test/leak/index.js index 094a647f93d..ab15dd12a76 100644 --- a/test/leak/index.js +++ b/test/leak/index.js @@ -1,5 +1,8 @@ const path = require('node:path'); const weak = require('weak-napi'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ const rollup = require('../..'); const { wait } = require('../utils'); diff --git a/test/sourcemaps/define.d.ts b/test/sourcemaps/define.d.ts new file mode 100644 index 00000000000..6de80b661ef --- /dev/null +++ b/test/sourcemaps/define.d.ts @@ -0,0 +1,5 @@ +import type { TestConfigSourcemap } from '../types'; + +declare global { + function defineTest(config: TestConfigSourcemap): TestConfigSourcemap; +} diff --git a/test/sourcemaps/getLocation.js b/test/sourcemaps/getLocation.js index fdd10f98c14..496d14d43ea 100644 --- a/test/sourcemaps/getLocation.js +++ b/test/sourcemaps/getLocation.js @@ -1,3 +1,8 @@ +/** + * @param {string} source + * @param {string | number} search + * @returns {{ line: number, column: number } | undefined} + */ module.exports = function getLocation(source, search) { var lines = source.split('\n'); var length_ = lines.length; diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js index f1a0c15fad4..b4e64aed83d 100644 --- a/test/sourcemaps/index.js +++ b/test/sourcemaps/index.js @@ -1,5 +1,10 @@ const path = require('node:path'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ +// @ts-expect-error not included in types const rollup = require('../../dist/rollup'); +// @ts-expect-error not included in types const { compareWarnings, runTestSuiteWithSamples } = require('../utils.js'); const FORMATS = ['amd', 'cjs', 'system', 'es', 'iife', 'umd']; @@ -7,11 +12,14 @@ const FORMATS = ['amd', 'cjs', 'system', 'es', 'iife', 'umd']; runTestSuiteWithSamples( 'sourcemaps', path.resolve(__dirname, 'samples'), - (directory, configuration) => { - (configuration.skip ? describe.skip : configuration.solo ? describe.only : describe)( - path.basename(directory) + ': ' + configuration.description, + /** + * @param {import('../types').TestConfigSourcemap} config + */ + (directory, config) => { + (config.skip ? describe.skip : config.solo ? describe.only : describe)( + path.basename(directory) + ': ' + config.description, () => { - for (const format of configuration.formats || FORMATS) { + for (const format of config.formats || FORMATS) { it('generates ' + format, async () => { process.chdir(directory); const warnings = []; @@ -19,25 +27,25 @@ runTestSuiteWithSamples( input: directory + '/main.js', onwarn: warning => warnings.push(warning), strictDeprecations: true, - ...configuration.options + ...config.options }; const outputOptions = { exports: 'auto', file: directory + '/_actual/bundle.' + format + '.js', format, sourcemap: true, - ...(configuration.options || {}).output + ...(config.options || {}).output }; let bundle = await rollup.rollup(inputOptions); - await generateAndTestBundle(bundle, outputOptions, configuration, format, warnings); + await generateAndTestBundle(bundle, outputOptions, config, format, warnings); // cache rebuild does not reemit warnings. - if (configuration.warnings) { + if (config.warnings) { return; } // test cache noop rebuild bundle = await rollup.rollup({ cache: bundle, ...inputOptions }); - await generateAndTestBundle(bundle, outputOptions, configuration, format, warnings); + await generateAndTestBundle(bundle, outputOptions, config, format, warnings); }); } } @@ -45,17 +53,14 @@ runTestSuiteWithSamples( } ); -async function generateAndTestBundle(bundle, outputOptions, configuration, format, warnings) { - await bundle.write(outputOptions); - if (configuration.warnings) { - compareWarnings(warnings, configuration.warnings); +async function generateAndTestBundle(bundle, outputOptions, config, format, warnings) { + if (config.warnings) { + compareWarnings(warnings, config.warnings); } else if (warnings.length > 0) { throw new Error(`Unexpected warnings`); } - if (configuration.test) { - const { - output: [{ code, map, fileName }] - } = await bundle.generate(outputOptions); - await configuration.test(code, map, { fileName, format }); - } + const { + output: [{ code, map, fileName }] + } = await bundle.write(outputOptions); + await config.test(code, map, { fileName, format }); } diff --git a/test/sourcemaps/samples/basic-support/_config.js b/test/sourcemaps/samples/basic-support/_config.js index 4ff9884cf06..5ef590e13d4 100644 --- a/test/sourcemaps/samples/basic-support/_config.js +++ b/test/sourcemaps/samples/basic-support/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'basic sourcemap support', async test(code, map) { assert.equal(map.version, 3); @@ -36,4 +36,4 @@ module.exports = { assert.equal(originalLoc.column, 1); assert.equal(originalLoc.source, '../bar.js'); } -}; +}); diff --git a/test/sourcemaps/samples/combined-sourcemap-with-loader/_config.js b/test/sourcemaps/samples/combined-sourcemap-with-loader/_config.js index 641450b80de..3c3d641a8e0 100644 --- a/test/sourcemaps/samples/combined-sourcemap-with-loader/_config.js +++ b/test/sourcemaps/samples/combined-sourcemap-with-loader/_config.js @@ -1,15 +1,16 @@ const assert = require('node:assert'); const { readFileSync } = require('node:fs'); const buble = require('buble'); -const MagicString = require('magic-string'); +const MagicString = require('magic-string').default; const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'get combined sourcemap in transforming with loader', options: { plugins: [ { + name: 'test-plugin1', load(id) { const code = readFileSync(id, 'utf8'); const out = buble.transform(code, { @@ -22,6 +23,7 @@ module.exports = { } }, { + name: 'test-plugin2', async transform(code, id) { const sourcemap = this.getCombinedSourcemap(); const smc = await new SourceMapConsumer(sourcemap); @@ -46,6 +48,7 @@ module.exports = { } }, { + name: 'test-plugin3', async transform(code, id) { const sourcemap = this.getCombinedSourcemap(); const smc = await new SourceMapConsumer(sourcemap); @@ -76,7 +79,7 @@ module.exports = { testFoo(code, smc); testMain(code, smc); } -}; +}); function testFoo(code, smc) { const generatedLoc = getLocation(code, code.indexOf(42)); diff --git a/test/sourcemaps/samples/combined-sourcemap/_config.js b/test/sourcemaps/samples/combined-sourcemap/_config.js index 5c65693d705..63ee2ec85b8 100644 --- a/test/sourcemaps/samples/combined-sourcemap/_config.js +++ b/test/sourcemaps/samples/combined-sourcemap/_config.js @@ -1,13 +1,14 @@ const assert = require('node:assert'); -const MagicString = require('magic-string'); +const MagicString = require('magic-string').default; const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'get combined sourcemap in transforming', options: { plugins: [ { + name: 'test-plugin1', async transform(code, id) { const sourcemap = this.getCombinedSourcemap(); const smc = await new SourceMapConsumer(sourcemap); @@ -32,6 +33,7 @@ module.exports = { } }, { + name: 'test-plugin2', async transform(code, id) { const sourcemap = this.getCombinedSourcemap(); const smc = await new SourceMapConsumer(sourcemap); @@ -62,7 +64,7 @@ module.exports = { testFoo(code, smc); testMain(code, smc); } -}; +}); function testFoo(code, smc) { const generatedLoc = getLocation(code, code.indexOf(42)); diff --git a/test/sourcemaps/samples/excludes-plugin-helpers/_config.js b/test/sourcemaps/samples/excludes-plugin-helpers/_config.js index 0dece505534..822dfa47b9c 100644 --- a/test/sourcemaps/samples/excludes-plugin-helpers/_config.js +++ b/test/sourcemaps/samples/excludes-plugin-helpers/_config.js @@ -4,7 +4,7 @@ const path = require('node:path'); const HELPER = '\0helper'; -module.exports = { +module.exports = defineTest({ description: 'excludes plugin helpers from sources', options: { output: { @@ -12,6 +12,8 @@ module.exports = { }, plugins: [ { + name: 'test-plugin', + resolveId(id) { if (id === HELPER) return id; }, @@ -29,4 +31,4 @@ module.exports = { assert.equal(map.sourcesContent.length, 1); assert.ok(/main/.test(map.sources[0])); } -}; +}); diff --git a/test/sourcemaps/samples/existing-external-sourcemaps-combined/_config.js b/test/sourcemaps/samples/existing-external-sourcemaps-combined/_config.js index d1fafbaa76f..41b38bedd31 100644 --- a/test/sourcemaps/samples/existing-external-sourcemaps-combined/_config.js +++ b/test/sourcemaps/samples/existing-external-sourcemaps-combined/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'removes sourcemap comments', async test(code) { assert.ok(!code.includes('sourceMappingURL=main.js.map')); } -}; +}); diff --git a/test/sourcemaps/samples/existing-inline-sourcemaps-combined/_config.js b/test/sourcemaps/samples/existing-inline-sourcemaps-combined/_config.js index cf74a52dfbf..c2cdc0ad9a9 100644 --- a/test/sourcemaps/samples/existing-inline-sourcemaps-combined/_config.js +++ b/test/sourcemaps/samples/existing-inline-sourcemaps-combined/_config.js @@ -1,8 +1,8 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'removes existing inline sourcemaps', async test(code) { assert.ok(!code.includes('sourceMappingURL=data')); } -}; +}); diff --git a/test/sourcemaps/samples/ignore-list-default/_config.js b/test/sourcemaps/samples/ignore-list-default/_config.js index 08df2ee1427..2df5184401a 100644 --- a/test/sourcemaps/samples/ignore-list-default/_config.js +++ b/test/sourcemaps/samples/ignore-list-default/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'defaults to adding files within node_modules to the ignore list', options: { output: { @@ -14,4 +14,4 @@ module.exports = { assert.deepEqual(map.sources, ['lib.js', 'main.js']); assert.deepEqual(map.x_google_ignoreList, [0]); } -}; +}); diff --git a/test/sourcemaps/samples/ignore-list-false/_config.js b/test/sourcemaps/samples/ignore-list-false/_config.js index 2e2ba1a411c..ed87dc8b580 100644 --- a/test/sourcemaps/samples/ignore-list-false/_config.js +++ b/test/sourcemaps/samples/ignore-list-false/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'accepts false for `sourcemapIgnoreList` to disable the default ignore-listing of node_modules', options: { @@ -16,4 +16,4 @@ module.exports = { assert.deepEqual(map.sources, ['lib.js', 'main.js']); assert.strictEqual(map.x_google_ignoreList, undefined); } -}; +}); diff --git a/test/sourcemaps/samples/ignore-list-source-files/_config.js b/test/sourcemaps/samples/ignore-list-source-files/_config.js index 9f583194663..b2382971176 100644 --- a/test/sourcemaps/samples/ignore-list-source-files/_config.js +++ b/test/sourcemaps/samples/ignore-list-source-files/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'populates ignore list', options: { output: { @@ -15,4 +15,4 @@ module.exports = { assert.deepEqual(map.sources, ['lib1.js', 'lib2.js', 'main.js']); assert.deepEqual(map.x_google_ignoreList, [0, 1]); } -}; +}); diff --git a/test/sourcemaps/samples/ignore-list-sourcemap-path/_config.js b/test/sourcemaps/samples/ignore-list-sourcemap-path/_config.js index a707dfd5c87..d30ad74cdce 100644 --- a/test/sourcemaps/samples/ignore-list-sourcemap-path/_config.js +++ b/test/sourcemaps/samples/ignore-list-sourcemap-path/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'correctly passes source map path', options: { output: { @@ -18,4 +18,4 @@ module.exports = { assert.deepEqual(map.sources, ['main.js']); assert.deepEqual(map.x_google_ignoreList, [0]); } -}; +}); diff --git a/test/sourcemaps/samples/loaders/_config.js b/test/sourcemaps/samples/loaders/_config.js index 7ef4e46f14f..d8ed77c4b57 100644 --- a/test/sourcemaps/samples/loaders/_config.js +++ b/test/sourcemaps/samples/loaders/_config.js @@ -4,7 +4,7 @@ const buble = require('buble'); const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'preserves sourcemap chains when transforming', options: { plugins: [ @@ -62,4 +62,4 @@ module.exports = { assert.equal(originalLoc.line, 4); assert.equal(originalLoc.column, 19); } -}; +}); diff --git a/test/sourcemaps/samples/names-transformed-render-chunk/_config.js b/test/sourcemaps/samples/names-transformed-render-chunk/_config.js index 875a7ba55a6..01583823ee7 100644 --- a/test/sourcemaps/samples/names-transformed-render-chunk/_config.js +++ b/test/sourcemaps/samples/names-transformed-render-chunk/_config.js @@ -4,7 +4,7 @@ const { SourceMapConsumer } = require('source-map'); const terser = require('terser'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'names are recovered if transforms are used', options: { plugins: [ @@ -59,4 +59,4 @@ module.exports = { name: 'mangleMe' }); } -}; +}); diff --git a/test/sourcemaps/samples/names/_config.js b/test/sourcemaps/samples/names/_config.js index f81631b0354..977a30de9bc 100644 --- a/test/sourcemaps/samples/names/_config.js +++ b/test/sourcemaps/samples/names/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'names are recovered (https://github.com/rollup/rollup/issues/101)', options: { output: { @@ -26,4 +26,4 @@ module.exports = { original = smc.originalPositionFor(generatedLoc); assert.equal(original.name, 'Foo'); } -}; +}); diff --git a/test/sourcemaps/samples/reified-namespace/_config.js b/test/sourcemaps/samples/reified-namespace/_config.js index 533aa5a1c73..8f6349898b4 100644 --- a/test/sourcemaps/samples/reified-namespace/_config.js +++ b/test/sourcemaps/samples/reified-namespace/_config.js @@ -4,7 +4,7 @@ const path = require('node:path'); const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'generates correct sourcemap with reified namespace (#668)', async test(code, map) { const smc = await new SourceMapConsumer(map); @@ -19,4 +19,4 @@ module.exports = { assert.equal(actual.column, expected.column); assert.equal(actual.source, '../main.js'); } -}; +}); diff --git a/test/sourcemaps/samples/relative-paths/_config.js b/test/sourcemaps/samples/relative-paths/_config.js index f9aea3e1567..b8113a8eaf8 100644 --- a/test/sourcemaps/samples/relative-paths/_config.js +++ b/test/sourcemaps/samples/relative-paths/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'source paths are relative with relative dest (#344)', options: { output: { @@ -12,4 +12,4 @@ module.exports = { test(code, map) { assert.deepEqual(map.sources, ['../main.js']); } -}; +}); diff --git a/test/sourcemaps/samples/render-chunk-babili/_config.js b/test/sourcemaps/samples/render-chunk-babili/_config.js index 8e10d52022a..85202f9d179 100644 --- a/test/sourcemaps/samples/render-chunk-babili/_config.js +++ b/test/sourcemaps/samples/render-chunk-babili/_config.js @@ -3,11 +3,12 @@ const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); const babiliResults = require('./babili-results'); -module.exports = { +module.exports = defineTest({ description: 'generates valid sourcemap when source could not be determined', options: { plugins: [ { + name: 'test-plugin', renderChunk(code, chunk, options) { const format = options.format; @@ -33,4 +34,4 @@ module.exports = { assert.equal(originalLoc.line, 1); assert.equal(originalLoc.column, 8); } -}; +}); diff --git a/test/sourcemaps/samples/render-chunk/_config.js b/test/sourcemaps/samples/render-chunk/_config.js index 6ccca22403a..ce41a76c1c5 100644 --- a/test/sourcemaps/samples/render-chunk/_config.js +++ b/test/sourcemaps/samples/render-chunk/_config.js @@ -3,11 +3,12 @@ const { SourceMapConsumer } = require('source-map'); const terser = require('terser'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'preserves sourcemap chains when transforming', options: { plugins: [ { + name: 'test-plugin', renderChunk(code) { const options = { sourceMap: { @@ -36,4 +37,4 @@ module.exports = { assert.equal(originalLoc.line, 1); assert.equal(originalLoc.column, 8); } -}; +}); diff --git a/test/sourcemaps/samples/single-length-segments/_config.js b/test/sourcemaps/samples/single-length-segments/_config.js index 5217a6b5b9d..a7fe1044e4d 100644 --- a/test/sourcemaps/samples/single-length-segments/_config.js +++ b/test/sourcemaps/samples/single-length-segments/_config.js @@ -6,11 +6,12 @@ const getLocation = require('../../getLocation'); const original = readFileSync(path.resolve(__dirname, 'main.js'), 'utf8'); -module.exports = { +module.exports = defineTest({ description: 'handles single-length sourcemap segments', options: { plugins: [ { + name: 'test-plugin', transform() { return { code: readFileSync(path.resolve(__dirname, 'output.js'), 'utf8'), @@ -36,4 +37,4 @@ module.exports = { assert.equal(originalLoc.column, expectedLoc.column); } } -}; +}); diff --git a/test/sourcemaps/samples/sourcemap-base-url/_config.js b/test/sourcemaps/samples/sourcemap-base-url/_config.js index 8157403b8b5..eee1b9e94a0 100644 --- a/test/sourcemaps/samples/sourcemap-base-url/_config.js +++ b/test/sourcemaps/samples/sourcemap-base-url/_config.js @@ -2,7 +2,7 @@ const assert = require('node:assert'); const fs = require('node:fs'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'adds a sourcemap base url', options: { output: { @@ -19,4 +19,4 @@ module.exports = { `//# sourceMappingURL=https://example.com/bundle.${profile.format}.js.map` ); } -}; +}); diff --git a/test/sourcemaps/samples/sourcemap-file-hashed/_config.js b/test/sourcemaps/samples/sourcemap-file-hashed/_config.js index e6645e6a4f5..82e9387a8f5 100644 --- a/test/sourcemaps/samples/sourcemap-file-hashed/_config.js +++ b/test/sourcemaps/samples/sourcemap-file-hashed/_config.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'populates file property of sourcemap with final name when using hashes', options: { output: { @@ -12,4 +12,4 @@ module.exports = { test: (code, map, { fileName }) => { assert.strictEqual(map.file, fileName); } -}; +}); diff --git a/test/sourcemaps/samples/sourcemap-file/_config.js b/test/sourcemaps/samples/sourcemap-file/_config.js index c76dbdfe1de..6c34ba18e39 100644 --- a/test/sourcemaps/samples/sourcemap-file/_config.js +++ b/test/sourcemaps/samples/sourcemap-file/_config.js @@ -1,10 +1,11 @@ const assert = require('node:assert'); -module.exports = { +module.exports = defineTest({ description: 'populates file property of sourcemap when plugins are used (#986)', options: { plugins: [ { + name: 'test-plugin', transform() { return null; } @@ -14,4 +15,4 @@ module.exports = { test: (code, map, profile) => { assert.equal(map.file, `bundle.${profile.format}.js`); } -}; +}); diff --git a/test/sourcemaps/samples/transform-full-source-paths/_config.js b/test/sourcemaps/samples/transform-full-source-paths/_config.js index 4bfc378a652..5bb70548512 100644 --- a/test/sourcemaps/samples/transform-full-source-paths/_config.js +++ b/test/sourcemaps/samples/transform-full-source-paths/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'provides the full source map path when transforming source maps', options: { output: { @@ -14,4 +14,4 @@ module.exports = { test(code, map) { assert.deepEqual(map.sources, [path.resolve(__dirname, 'main.js').replace(/\\/g, '/')]); } -}; +}); diff --git a/test/sourcemaps/samples/transform-low-resolution/_config.js b/test/sourcemaps/samples/transform-low-resolution/_config.js index e7daeae10aa..1510874e9d5 100644 --- a/test/sourcemaps/samples/transform-low-resolution/_config.js +++ b/test/sourcemaps/samples/transform-low-resolution/_config.js @@ -1,28 +1,32 @@ const assert = require('node:assert'); const { encode } = require('@jridgewell/sourcemap-codec'); -const MagicString = require('magic-string'); +const MagicString = require('magic-string').default; const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'handles combining low-resolution and high-resolution source-maps when transforming', options: { output: { name: 'bundle' }, plugins: [ { + name: 'test-plugin1', transform(code) { // each entry of each line consist of // [generatedColumn, sourceIndex, sourceLine, sourceColumn]; // this mapping only maps the second line to the first with no column // details + /** @type {import('@jridgewell/sourcemap-codec').SourceMapMappings} */ const decodedMap = [[], [[0, 0, 0, 0]]]; return { code: `console.log('added');\n${code}`, + /** @type {any} */ map: { mappings: encode(decodedMap) } }; } }, { + name: 'test-plugin2', transform(code) { const s = new MagicString(code); s.prepend("console.log('second');\n"); @@ -44,4 +48,4 @@ module.exports = { assert.strictEqual(originalLoc.line, 1); assert.strictEqual(originalLoc.column, 0); } -}; +}); diff --git a/test/sourcemaps/samples/transform-source-paths/_config.js b/test/sourcemaps/samples/transform-source-paths/_config.js index 3f4f8374e48..439c29f240c 100644 --- a/test/sourcemaps/samples/transform-source-paths/_config.js +++ b/test/sourcemaps/samples/transform-source-paths/_config.js @@ -1,7 +1,7 @@ const assert = require('node:assert'); const path = require('node:path'); -module.exports = { +module.exports = defineTest({ description: 'transform sourcemap paths (#2168)', options: { output: { @@ -13,4 +13,4 @@ module.exports = { test(code, map) { assert.deepEqual(map.sources, ['~/pkg-name/main.js']); } -}; +}); diff --git a/test/sourcemaps/samples/transform-without-sourcemap-render-chunk/main.js b/test/sourcemaps/samples/transform-without-sourcemap-render-chunk/main.js deleted file mode 100644 index 5c72ff35124..00000000000 --- a/test/sourcemaps/samples/transform-without-sourcemap-render-chunk/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log( 42 ); diff --git a/test/sourcemaps/samples/transforms/_config.js b/test/sourcemaps/samples/transforms/_config.js index 8bc8a012231..f0d005fc354 100644 --- a/test/sourcemaps/samples/transforms/_config.js +++ b/test/sourcemaps/samples/transforms/_config.js @@ -1,14 +1,15 @@ const assert = require('node:assert'); const buble = require('buble'); -const MagicString = require('magic-string'); +const MagicString = require('magic-string').default; const { SourceMapConsumer } = require('source-map'); const getLocation = require('../../getLocation'); -module.exports = { +module.exports = defineTest({ description: 'preserves sourcemap chains when transforming', options: { plugins: [ { + name: 'test-plugin1', transform(source) { return buble.transform(source, { transforms: { modules: false } @@ -17,6 +18,7 @@ module.exports = { }, { + name: 'test-plugin2', transform(source) { const s = new MagicString(source); s.append('\nassert.equal( 1 + 1, 2 );\nassert.equal( 2 + 2, 4 );'); @@ -46,4 +48,4 @@ module.exports = { assert.equal(originalLoc.line, 3); assert.equal(originalLoc.column, 8); } -}; +}); diff --git a/test/sourcemaps/samples/untransformed-modules/_config.js b/test/sourcemaps/samples/untransformed-modules/_config.js index c9076b2957a..e4d925debe1 100644 --- a/test/sourcemaps/samples/untransformed-modules/_config.js +++ b/test/sourcemaps/samples/untransformed-modules/_config.js @@ -1,11 +1,12 @@ const assert = require('node:assert'); -const MagicString = require('magic-string'); +const MagicString = require('magic-string').default; -module.exports = { +module.exports = defineTest({ description: 'allows sourcemap chains with some untransformed modules (#404)', options: { plugins: [ { + name: 'test-plugin', transform(code, id) { if (/untransformed-modules\/foo/.test(id)) { const s = new MagicString(code); @@ -24,4 +25,4 @@ module.exports = { test() { assert.ok(true); } -}; +}); diff --git a/test/sourcemaps/tsconfig.json b/test/sourcemaps/tsconfig.json new file mode 100644 index 00000000000..22ef5710b77 --- /dev/null +++ b/test/sourcemaps/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": [ + "**/_config.js", + "./*.js", + "./define.d.ts" + ] +} diff --git a/test/tsconfig.base.json b/test/tsconfig.base.json new file mode 100644 index 00000000000..cc0447936af --- /dev/null +++ b/test/tsconfig.base.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + // enable this to capture type errors, or add @ts-check to the top of the file + // "checkJs": true, + "allowJs": true, + "composite": true, + "target": "esnext", + "module": "node16", + "noEmit": true, + "lib": ["esnext"], + "esModuleInterop": true, + "moduleResolution": "node", + "types": ["node", "mocha"] + } +} diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 00000000000..c71d3305dd7 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,29 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "checkJs": true + }, + "include": [ + "./utils.js" + ], + "references": [ + { + "path": "./browser" + }, + { + "path": "./chunking-form" + }, + { + "path": "./file-hashes" + }, + { + "path": "./form" + }, + { + "path": "./function" + }, + { + "path": "./sourcemaps" + } + ] +} diff --git a/test/types.d.ts b/test/types.d.ts new file mode 100644 index 00000000000..7dca9dfc028 --- /dev/null +++ b/test/types.d.ts @@ -0,0 +1,233 @@ +import type { SourceMap } from 'magic-string'; +import type { RollupBuild, RollupError, RollupOptions } from '../src/rollup/types'; + +export interface TestConfigBase { + /** + * Description of the test. Determines the name of the test in the test + * runner. + */ + description: string; + /** + * Only run this test if the major Node version is high enough. + */ + minNodeVersion?: number; + /** + * Only run this test on Windows. + */ + onlyWindows?: boolean; + /** + * Skip this test. + */ + skip?: boolean; + /** + * Do not run this test on Windows. + */ + skipIfWindows?: boolean; + /** + * Only run this test. Should never be committed. + */ + solo?: boolean; +} + +export interface TestConfigBrowser extends TestConfigBase { + /** + * Expected error when running rollup.rollup() + */ + error?: RollupError; + /** + * Expected warning codes. Any of these warnings will not cause the test to + * fail. + */ + expectedWarnings?: string[]; + /** + * Expected error when running bundle.generate(). + */ + generateError?: RollupError; + /** + * Rollup options for bundling. + */ + options?: RollupOptions; +} + +export interface TestConfigChunkingForm extends TestConfigBase { + /** + * Called after the test is run. + */ + after?: () => void; + /** + * Called before the test is run. + */ + before?: () => void; + /** + * Expected warning codes. Any of these warnings will not cause the test to + * fail. + */ + expectedWarnings?: string[]; + /** + * The directory to bundle the code in. + */ + nestedDir?: string; + /** + * Rollup options for bundling. + */ + options?: RollupOptions; + /** + * Execute the AMD module. + */ + runAmd?: + | boolean + | { + exports?: (exportObject: any) => void | Promise; + }; +} + +export interface TestConfigCli extends TestConfigBase { + /** + * Assert the stderr stream, return true to abort the test. + */ + abortOnStderr?: (data: string) => boolean | void | Promise; + /** + * Called after the test is run. + */ + after?: (error: Error | null, stdout: string, stderr: string) => void | Promise; + /** + * Called before the test is run. + */ + before?: () => void | Promise; + command?: string; + cwd?: string; + /** + * Environment variables to set for the test. + */ + env?: Record; + /** + * Test the expected error. Assertions about the test output will only + * be performed afterward if you return "true" or do not supply this option. + */ + error?: (error: RollupError) => boolean | void; + /** + * Execute the bundled code. + */ + execute?: boolean; + /** + * Run assertions against the exports of the bundle after executing it. + */ + exports?: (exportObject: any) => void | Promise; + /** + * Run assertions against the generated code when bundling to stdout. + */ + result?: (code: string) => void; + retry?: number; + /** + * Display generated output in console. + */ + show?: boolean; + /** + * Assert the stderr of the build. Assertions about the test output will only + * be performed afterward if you return "true" or do not supply this option. + */ + stderr?: (stderr: string) => boolean | undefined; + /** + * Run assertions after the command has finished. + */ + test?: () => void; +} + +export interface TestConfigFileHash extends TestConfigBase { + options1: RollupOptions; + options2: RollupOptions; +} + +export interface TestConfigForm extends TestConfigBase { + /** + * Called after the test is run. + */ + after?: () => void | Promise; + /** + * Called before the test is run. + */ + before?: () => void | Promise; + /** + * Expected warning codes. Any of these warnings will not cause the test to + * fail. + */ + expectedWarnings?: string[]; + /** + * Output formats to test. + */ + formats?: string[]; + /** + * Rollup options for bundling. + */ + options?: RollupOptions; +} + +export interface TestConfigFunction extends TestConfigBase { + /** + * Called after the test is run. + */ + after?: () => void | Promise; + /** + * Called before the test is run. + */ + before?: () => void | Promise; + /** + * Make assertions against the generated Rollup output object. + */ + bundle?: (bundle: RollupBuild) => void | Promise; + /** + * Make assertions against the generated code. + */ + code?: (code: string | Record) => void; + /** + * The global context executed the bundled code. + */ + context?: Record; + /** + * Expected error when running rollup.rollup() + */ + error?: RollupError; + /** + * Assetions for the exports of the bundle. + */ + exports?: (exportObject: any) => void | Promise; + /** + * Expected error when running bundle.generate(). + */ + generateError?: RollupError; + /** + * Make assertions against an expected runtime error. + */ + runtimeError?: (error: Error) => void; + /** + * Display generated output in console. + */ + show?: boolean; + /** + * Test the expected warnings. + */ + warnings?: RollupError[] | ((warnings: RollupError[]) => boolean | void); +} + +export interface TestConfigSourcemap extends TestConfigBase { + /** + * Output formats to test. + */ + formats?: string[]; + /** + * Rollup options for bundling. + */ + options?: RollupOptions; + /** + * Generate the bundle and run assertions. + */ + test: ( + code: string, + map: SourceMap, + options: { fileName: string; format: string } + ) => void | Promise; + /** + * List expected warnings. + */ + warnings?: RollupError[]; +} diff --git a/test/utils.js b/test/utils.js index 8dcbee5b7cc..322a780af23 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,3 +1,10 @@ +/** + * @typedef {import('../src/rollup/types').RollupError} RollupError + * @typedef {import('../src/rollup/types').RollupWarning} RollupWarning + * @typedef {import('../src/rollup/types').Plugin} Plugin + * @typedef {import('./types').TestConfigBase} TestConfigBase + */ + const assert = require('node:assert'); const { closeSync, @@ -14,6 +21,14 @@ const { basename, join } = require('node:path'); const { platform, version } = require('node:process'); const fixturify = require('fixturify'); +if (!globalThis.defineTest) { + globalThis.defineTest = config => config; +} + +/** + * @param {number} ms + * @returns {Promise} + */ exports.wait = function wait(ms) { return new Promise(fulfil => { setTimeout(fulfil, ms); @@ -36,6 +51,10 @@ function normaliseError(error) { return clone; } +/** + * @param {RollupError} actual + * @param {RollupError} expected + */ exports.compareError = function compareError(actual, expected) { actual = normaliseError(actual); if (expected.frame) { @@ -44,6 +63,10 @@ exports.compareError = function compareError(actual, expected) { assert.deepEqual(actual, expected); }; +/** + * @param {RollupWarning[]} actual + * @param {RollupWarning[]} expected + */ exports.compareWarnings = function compareWarnings(actual, expected) { assert.deepEqual( actual.map(normaliseError).sort(sortWarnings), @@ -58,10 +81,17 @@ exports.compareWarnings = function compareWarnings(actual, expected) { ); }; +/** + * @param {RollupWarning} a + * @param {RollupWarning} b + */ function sortWarnings(a, b) { return a.message === b.message ? 0 : a.message < b.message ? -1 : 1; } +/** + * @param {string} stringValue + */ function deindent(stringValue) { return stringValue.slice(1).replace(/^\t+/gm, '').replace(/\s+$/gm, '').trim(); } @@ -81,6 +111,10 @@ exports.executeBundle = async function executeBundle(bundle, require) { return module.exports; }; +/** + * @param {Iterable<[string, any]>} entries + * @returns {Record} + */ exports.getObject = function getObject(entries) { const object = {}; for (const [key, value] of entries) { @@ -89,13 +123,17 @@ exports.getObject = function getObject(entries) { return object; }; +/** + * @param {Record} modules + * @returns {Plugin} + */ exports.loader = function loader(modules) { modules = Object.assign(Object.create(null), modules); return { + name: 'test-plugin-loader', resolveId(id) { return id in modules ? id : null; }, - load(id) { return modules[id]; } @@ -106,21 +144,44 @@ exports.normaliseOutput = function normaliseOutput(code) { return code.toString().trim().replace(/\r\n/g, '\n'); }; +/** + * @template {TestConfigBase} C + * @param {string} suiteName + * @param {string} samplesDirectory + * @param {(directory: string, config: C) => void} runTest + * @param {() => void | Promise} [onTeardown] + */ function runTestSuiteWithSamples(suiteName, samplesDirectory, runTest, onTeardown) { describe(suiteName, () => runSamples(samplesDirectory, runTest, onTeardown)); } // You can run only or skip certain kinds of tests by appending .only or .skip +/** + * @template {TestConfigBase} C + * @param {string} suiteName + * @param {string} samplesDirectory + * @param {(directory: string, config: C) => void} runTest + * @param {() => void | Promise} onTeardown + */ runTestSuiteWithSamples.only = function (suiteName, samplesDirectory, runTest, onTeardown) { describe.only(suiteName, () => runSamples(samplesDirectory, runTest, onTeardown)); }; +/** + * @param {string} suiteName + */ runTestSuiteWithSamples.skip = function (suiteName) { describe.skip(suiteName, () => {}); }; exports.runTestSuiteWithSamples = runTestSuiteWithSamples; +/** + * @template {TestConfigBase} C + * @param {string} samplesDirectory + * @param {(directory: string, config: C) => void} runTest + * @param {Mocha.Func} onTeardown + */ function runSamples(samplesDirectory, runTest, onTeardown) { if (onTeardown) { afterEach(onTeardown); @@ -133,6 +194,11 @@ function runSamples(samplesDirectory, runTest, onTeardown) { } } +/** + * @template {TestConfigBase} C + * @param {string} directory + * @param {(directory: string, config: C) => void} runTest + */ function runTestsInDirectory(directory, runTest) { const fileNames = getFileNamesAndRemoveOutput(directory); if (fileNames.includes('_config.js')) { @@ -152,6 +218,9 @@ function runTestsInDirectory(directory, runTest) { } } +/** + * @param {string} directory + */ function getFileNamesAndRemoveOutput(directory) { try { return readdirSync(directory).filter(fileName => { @@ -180,6 +249,11 @@ function getFileNamesAndRemoveOutput(directory) { exports.getFileNamesAndRemoveOutput = getFileNamesAndRemoveOutput; +/** + * @template {TestConfigBase} C + * @param {string} directory + * @param {(directory: string, config: C) => void} runTest + */ function loadConfigAndRunTest(directory, runTest) { const configFile = join(directory, '_config.js'); const config = require(configFile); @@ -195,6 +269,10 @@ function loadConfigAndRunTest(directory, runTest) { } } +/** + * @param {string} actualDirectory + * @param {string} expectedDirectory + */ exports.assertDirectoriesAreEqual = function assertDirectoriesAreEqual( actualDirectory, expectedDirectory @@ -228,6 +306,10 @@ function assertFilesAreEqual(actualFiles, expectedFiles, directories = []) { exports.assertFilesAreEqual = assertFilesAreEqual; +/** + * @param {string} actual + * @param {string} expected + */ exports.assertIncludes = function assertIncludes(actual, expected) { try { assert.ok( @@ -241,6 +323,10 @@ exports.assertIncludes = function assertIncludes(actual, expected) { } }; +/** + * @param {string} actual + * @param {string} expected + */ exports.assertDoesNotInclude = function assertDoesNotInclude(actual, expected) { try { assert.ok( @@ -254,9 +340,14 @@ exports.assertDoesNotInclude = function assertDoesNotInclude(actual, expected) { } }; -// Workaround a race condition in fs.writeFileSync that temporarily creates -// an empty file for a brief moment which may be read by rollup watch - even -// if the content being overwritten is identical. +/** + * Workaround a race condition in fs.writeFileSync that temporarily creates + * an empty file for a brief moment which may be read by rollup watch - even + * if the content being overwritten is identical. + * + * @param {string} filePath + * @param {string} contents + */ function atomicWriteFileSync(filePath, contents) { const stagingPath = filePath + '_'; writeFileSync(stagingPath, contents); @@ -265,7 +356,12 @@ function atomicWriteFileSync(filePath, contents) { exports.atomicWriteFileSync = atomicWriteFileSync; -// It appears that on macOS, it sometimes takes long for the file system to update +/** + * It appears that on macOS, it sometimes takes long for the file system to update + * + * @param {string} filePath + * @param {string} contents + */ exports.writeAndSync = function writeAndSync(filePath, contents) { const file = openSync(filePath, 'w'); writeSync(file, contents); @@ -273,9 +369,14 @@ exports.writeAndSync = function writeAndSync(filePath, contents) { closeSync(file); }; -// Sometimes, watchers on macOS do not seem to fire. In those cases, it helps -// to write the same content again. This function returns a callback to stop -// further updates. +/** + * Sometimes, watchers on macOS do not seem to fire. In those cases, it helps + * to write the same content again. This function returns a callback to stop + * further updates. + * + * @param {string} filePath + * @param {string} contents + */ exports.writeAndRetry = function writeAndRetry(filePath, contents) { let retries = 0; let updateRetryTimeout; @@ -293,6 +394,10 @@ exports.writeAndRetry = function writeAndRetry(filePath, contents) { return () => clearTimeout(updateRetryTimeout); }; +/** + * @param {any} object + * @param {any} replaced + */ exports.replaceDirectoryInStringifiedObject = function replaceDirectoryInStringifiedObject( object, replaced diff --git a/test/watch/index.js b/test/watch/index.js index ac7551fb37d..d7841471557 100644 --- a/test/watch/index.js +++ b/test/watch/index.js @@ -4,6 +4,9 @@ const { rm, unlink, writeFile } = require('node:fs/promises'); const { resolve } = require('node:path'); const { chdir, cwd, hrtime } = require('node:process'); const { copy } = require('fs-extra'); +/** + * @type {import('../../src/rollup/types')} Rollup + */ const rollup = require('../../dist/rollup'); const { atomicWriteFileSync, wait } = require('../utils'); @@ -32,6 +35,7 @@ describe('rollup.watch', () => { watcher = rollup.watch({ input: 'test/_tmp/input/main.js', plugins: { + name: 'test-plugin', options() { assert.strictEqual(this.meta.watchMode, true, 'watchMode in options'); },