diff --git a/packages/@lwc/babel-plugin-component/src/__tests__/index.spec.ts b/packages/@lwc/babel-plugin-component/src/__tests__/index.spec.ts index 4980065a24..2a0ccc41ec 100644 --- a/packages/@lwc/babel-plugin-component/src/__tests__/index.spec.ts +++ b/packages/@lwc/babel-plugin-component/src/__tests__/index.spec.ts @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import path from 'node:path'; +import { describe } from 'vitest'; import { transformSync } from '@babel/core'; import { LWC_VERSION, HIGHEST_API_VERSION } from '@lwc/shared'; import { testFixtureDir } from '@lwc/test-utils-lwc-internals'; diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts index 57e5204f7c..21f0d19d51 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, expect, it } from 'vitest'; import { TransformOptions } from '../../options'; import { transform } from '../transformer'; diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts index 26f856843d..d4e6d42d33 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { vi } from 'vitest'; +import { vi, describe, it, expect } from 'vitest'; import { APIVersion, noop } from '@lwc/shared'; import { TransformOptions } from '../../options'; import { transformSync } from '../transformer'; diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts index 357de4090d..ebae03d6a7 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { vi } from 'vitest'; +import { vi, describe, it, expect } from 'vitest'; import { noop } from '@lwc/shared'; import { TransformOptions } from '../../options'; import { transform, transformSync } from '../transformer'; diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform.spec.ts index 2c1717692a..378b72adad 100755 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { transform, transformSync } from '../../transformers/transformer'; function testValidateOptions(methodName: string, method: any) { diff --git a/packages/@lwc/engine-core/src/libs/mutation-tracker/__tests__/index.spec.ts b/packages/@lwc/engine-core/src/libs/mutation-tracker/__tests__/index.spec.ts index 7eea66eeeb..342d4fd141 100644 --- a/packages/@lwc/engine-core/src/libs/mutation-tracker/__tests__/index.spec.ts +++ b/packages/@lwc/engine-core/src/libs/mutation-tracker/__tests__/index.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { ReactiveObserver, valueMutated, valueObserved } from '../index'; describe('reactive-service', () => { diff --git a/packages/@lwc/engine-dom/src/formatters/__tests__/component.spec.ts b/packages/@lwc/engine-dom/src/formatters/__tests__/component.spec.ts index b08e571698..975a17c77d 100644 --- a/packages/@lwc/engine-dom/src/formatters/__tests__/component.spec.ts +++ b/packages/@lwc/engine-dom/src/formatters/__tests__/component.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { createElement, LightningElement, diff --git a/packages/@lwc/engine-server/src/__tests__/create-element.spec.ts b/packages/@lwc/engine-server/src/__tests__/create-element.spec.ts index 029e27cf2f..b05f27dfa6 100644 --- a/packages/@lwc/engine-server/src/__tests__/create-element.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/create-element.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { createElement } from '../index'; describe('createElement', () => { diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts b/packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts index adcf29e356..a7ab4db836 100755 --- a/packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts @@ -5,11 +5,10 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; - +import path from 'node:path'; +import { vi, describe } from 'vitest'; import { rollup } from 'rollup'; import lwcRollupPlugin from '@lwc/rollup-plugin'; -import { vi } from 'vitest'; import { testFixtureDir, formatHTML } from '@lwc/test-utils-lwc-internals'; import type * as lwc from '../index'; @@ -42,7 +41,7 @@ async function compileFixture({ input, dirname }: { input: string; dirname: stri const bundle = await rollup({ input, - external: ['lwc'], + external: ['lwc', 'vitest'], plugins: [ lwcRollupPlugin({ enableDynamicComponents: true, diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-noop/modules/x/getter-class-list-noop/getter-class-list-noop.js b/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-noop/modules/x/getter-class-list-noop/getter-class-list-noop.js index 89a6358782..c790a77d78 100755 --- a/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-noop/modules/x/getter-class-list-noop/getter-class-list-noop.js +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-noop/modules/x/getter-class-list-noop/getter-class-list-noop.js @@ -1,3 +1,4 @@ +import { expect } from 'vitest'; import { LightningElement } from 'lwc'; export default class GetterClassListNoop extends LightningElement{ diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list/modules/x/getter-class-list/getter-class-list.js b/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list/modules/x/getter-class-list/getter-class-list.js index f2234ff23a..becc5ae5cd 100755 --- a/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list/modules/x/getter-class-list/getter-class-list.js +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list/modules/x/getter-class-list/getter-class-list.js @@ -1,3 +1,4 @@ +import { expect } from 'vitest'; import { LightningElement } from 'lwc'; export default class GetterClassList extends LightningElement{ diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/methods-noop/modules/x/methods-noop/methods-noop.js b/packages/@lwc/engine-server/src/__tests__/fixtures/methods-noop/modules/x/methods-noop/methods-noop.js index 20a5ef65c6..c98fa7dc39 100644 --- a/packages/@lwc/engine-server/src/__tests__/fixtures/methods-noop/modules/x/methods-noop/methods-noop.js +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/methods-noop/modules/x/methods-noop/methods-noop.js @@ -1,3 +1,4 @@ +import { expect } from 'vitest'; import { LightningElement } from 'lwc'; export default class MethodsNoop extends LightningElement { diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/methods-unsupported/modules/x/methods-unsupported/methods-unsupported.js b/packages/@lwc/engine-server/src/__tests__/fixtures/methods-unsupported/modules/x/methods-unsupported/methods-unsupported.js index 13d1a141f0..a03a9af6e0 100755 --- a/packages/@lwc/engine-server/src/__tests__/fixtures/methods-unsupported/modules/x/methods-unsupported/methods-unsupported.js +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/methods-unsupported/modules/x/methods-unsupported/methods-unsupported.js @@ -1,3 +1,4 @@ +import { expect } from 'vitest'; import { LightningElement } from 'lwc'; export default class MethodsUnsupported extends LightningElement { diff --git a/packages/@lwc/engine-server/src/__tests__/html-serialization.spec.ts b/packages/@lwc/engine-server/src/__tests__/html-serialization.spec.ts index 6da2e50c87..e9290ebc1c 100644 --- a/packages/@lwc/engine-server/src/__tests__/html-serialization.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/html-serialization.spec.ts @@ -5,14 +5,14 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; -import vm from 'vm'; +import path from 'node:path'; +import vm from 'node:vm'; +import { vi, describe, it, expect } from 'vitest'; import { parseFragment, serialize } from 'parse5'; import { rollup, RollupLog } from 'rollup'; import replace from '@rollup/plugin-replace'; import virtual from '@rollup/plugin-virtual'; import lwcRollupPlugin from '@lwc/rollup-plugin'; -import { vi } from 'vitest'; import * as engineServer from '../index'; /** diff --git a/packages/@lwc/engine-server/src/__tests__/render-component.spec.ts b/packages/@lwc/engine-server/src/__tests__/render-component.spec.ts index 9f004de179..41c9cc7de4 100644 --- a/packages/@lwc/engine-server/src/__tests__/render-component.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/render-component.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { renderComponent, LightningElement } from '../index'; class Test extends LightningElement {} diff --git a/packages/@lwc/engine-server/src/__tests__/unsupported-apis.spec.ts b/packages/@lwc/engine-server/src/__tests__/unsupported-apis.spec.ts index 56eb7d9c5d..c725068c22 100644 --- a/packages/@lwc/engine-server/src/__tests__/unsupported-apis.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/unsupported-apis.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { it, expect } from 'vitest'; import { swapComponent, swapStyle, swapTemplate } from '../index'; it('throws error for swapComponent', () => { diff --git a/packages/@lwc/engine-server/src/__tests__/validate-style-text-contents.spec.ts b/packages/@lwc/engine-server/src/__tests__/validate-style-text-contents.spec.ts index 9b38607a0c..b7ca601cb7 100644 --- a/packages/@lwc/engine-server/src/__tests__/validate-style-text-contents.spec.ts +++ b/packages/@lwc/engine-server/src/__tests__/validate-style-text-contents.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { validateStyleTextContents } from '../utils/validate-style-text-contents'; // See https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions diff --git a/packages/@lwc/errors/src/__tests__/errors.spec.ts b/packages/@lwc/errors/src/__tests__/errors.spec.ts index ee0079a0e2..b8f64e5c69 100644 --- a/packages/@lwc/errors/src/__tests__/errors.spec.ts +++ b/packages/@lwc/errors/src/__tests__/errors.spec.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import 'vitest'; -import path from 'path'; -import fs from 'fs'; +import path from 'node:path'; +import fs from 'node:fs'; +import { describe, it, expect } from 'vitest'; + import { hasOwnProperty } from '@lwc/shared'; import * as CompilerErrors from '../compiler/error-info'; import { LWCErrorInfo } from '../shared/types'; diff --git a/packages/@lwc/errors/src/compiler/__tests__/compiler-errors.spec.ts b/packages/@lwc/errors/src/compiler/__tests__/compiler-errors.spec.ts index 4fd038903e..5e0c71b8d7 100644 --- a/packages/@lwc/errors/src/compiler/__tests__/compiler-errors.spec.ts +++ b/packages/@lwc/errors/src/compiler/__tests__/compiler-errors.spec.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; + import { CompilerError, generateCompilerError, diff --git a/packages/@lwc/errors/src/compiler/__tests__/error-info.spec.ts b/packages/@lwc/errors/src/compiler/__tests__/error-info.spec.ts index 36f2abfd8e..d067d9cbd6 100644 --- a/packages/@lwc/errors/src/compiler/__tests__/error-info.spec.ts +++ b/packages/@lwc/errors/src/compiler/__tests__/error-info.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, expect, it } from 'vitest'; import * as errorInfo from '../error-info'; // All exported objects are maps of label/error info, except for GENERIC_COMPILER_ERROR, // which is a top-level error info object diff --git a/packages/@lwc/features/src/__tests__/features.spec.ts b/packages/@lwc/features/src/__tests__/features.spec.ts index b9c0451ab9..6ec07b0f30 100644 --- a/packages/@lwc/features/src/__tests__/features.spec.ts +++ b/packages/@lwc/features/src/__tests__/features.spec.ts @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import features from '../index'; describe('features', () => { diff --git a/packages/@lwc/features/src/__tests__/lwcRuntimeFlags.spec.ts b/packages/@lwc/features/src/__tests__/lwcRuntimeFlags.spec.ts index e281a415cb..87d740cdf3 100644 --- a/packages/@lwc/features/src/__tests__/lwcRuntimeFlags.spec.ts +++ b/packages/@lwc/features/src/__tests__/lwcRuntimeFlags.spec.ts @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { lwcRuntimeFlags } from '../index'; describe('lwcRuntimeFlags', () => { diff --git a/packages/@lwc/features/src/__tests__/setFeatureFlag.spec.ts b/packages/@lwc/features/src/__tests__/setFeatureFlag.spec.ts index 23c4d11555..8dc87c743f 100644 --- a/packages/@lwc/features/src/__tests__/setFeatureFlag.spec.ts +++ b/packages/@lwc/features/src/__tests__/setFeatureFlag.spec.ts @@ -5,7 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { MockInstance, vi } from 'vitest'; +import { vi, describe, afterEach, beforeEach, expect, it, type MockInstance } from 'vitest'; import { lwcRuntimeFlags, setFeatureFlag } from '../index'; describe('setFeatureFlag', () => { diff --git a/packages/@lwc/module-resolver/scripts/test/setup-test.ts b/packages/@lwc/module-resolver/scripts/test/setup-test.ts index 1a3978880a..3fe606d76e 100644 --- a/packages/@lwc/module-resolver/scripts/test/setup-test.ts +++ b/packages/@lwc/module-resolver/scripts/test/setup-test.ts @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { expect } from 'vitest'; import { toThrowErrorWithType } from './matchers/to-throw-error-with-type'; import { toThrowErrorWithCode } from './matchers/to-throw-error-with-code'; diff --git a/packages/@lwc/module-resolver/src/__tests__/mapping.spec.ts b/packages/@lwc/module-resolver/src/__tests__/mapping.spec.ts index 106692d698..9326c41ab1 100644 --- a/packages/@lwc/module-resolver/src/__tests__/mapping.spec.ts +++ b/packages/@lwc/module-resolver/src/__tests__/mapping.spec.ts @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import '../../scripts/test/types'; import { resolveModule } from '../index'; import { RegistryType } from '../types'; diff --git a/packages/@lwc/module-resolver/src/__tests__/module-errors.spec.ts b/packages/@lwc/module-resolver/src/__tests__/module-errors.spec.ts index a12ac2256f..3592ade3e1 100644 --- a/packages/@lwc/module-resolver/src/__tests__/module-errors.spec.ts +++ b/packages/@lwc/module-resolver/src/__tests__/module-errors.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import '../../scripts/test/types'; import { resolveModule } from '../index'; import { fixture, NO_LWC_MODULE_FOUND_CODE, LWC_CONFIG_ERROR_CODE } from './test-utils'; diff --git a/packages/@lwc/module-resolver/src/__tests__/multi-version.spec.ts b/packages/@lwc/module-resolver/src/__tests__/multi-version.spec.ts index a1ffbe2bc3..e5670d72fb 100644 --- a/packages/@lwc/module-resolver/src/__tests__/multi-version.spec.ts +++ b/packages/@lwc/module-resolver/src/__tests__/multi-version.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import '../../scripts/test/types'; import { resolveModule } from '../index'; import { RegistryType } from '../types'; diff --git a/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts b/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts index 79e80c4261..46838ca589 100644 --- a/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts +++ b/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import '../../scripts/test/types'; import { resolveModule } from '../index'; import { RegistryType } from '../types'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/apiVersion/apiVersion.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/apiVersion/apiVersion.spec.ts index 82b2c95f1d..cdde2327d7 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/apiVersion/apiVersion.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/apiVersion/apiVersion.spec.ts @@ -5,6 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import path from 'node:path'; +import { describe, it, expect } from 'vitest'; + import { rollup, RollupLog } from 'rollup'; import { APIVersion, HIGHEST_API_VERSION, LOWEST_API_VERSION } from '@lwc/shared'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/compilerConfig/compilerConfig.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/compilerConfig/compilerConfig.spec.ts index 0e673bb741..a3682da90e 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/compilerConfig/compilerConfig.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/compilerConfig/compilerConfig.spec.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; +import path from 'node:path'; +import { describe, it, expect } from 'vitest'; import { rollup, type RollupLog, type RollupBuild } from 'rollup'; import lwc, { type RollupLwcOptions } from '../../index'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/enableStaticContentOptimization/enableStaticContentOptimization.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/enableStaticContentOptimization/enableStaticContentOptimization.spec.ts index ee8d0e83de..64e3821f38 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/enableStaticContentOptimization/enableStaticContentOptimization.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/enableStaticContentOptimization/enableStaticContentOptimization.spec.ts @@ -5,6 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import path from 'node:path'; +import { describe, it, expect } from 'vitest'; + import { rollup, RollupLog } from 'rollup'; import lwc, { RollupLwcOptions } from '../../index'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/integrations/integrations.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/integrations/integrations.spec.ts index 24fb450073..74498add7d 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/integrations/integrations.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/integrations/integrations.spec.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; +import path from 'node:path'; +import { describe, it, expect } from 'vitest'; import { rollup } from 'rollup'; import lwc from '../../index'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/resolver/resolver.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/resolver/resolver.spec.ts index c1ab46a231..99ac067508 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/resolver/resolver.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/resolver/resolver.spec.ts @@ -4,8 +4,9 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; -import fs from 'fs'; +import path from 'node:path'; +import fs from 'node:fs'; +import { describe, it, expect } from 'vitest'; import { rollup, type RollupLog, type Plugin, type RollupBuild } from 'rollup'; import nodeResolve from '@rollup/plugin-node-resolve'; diff --git a/packages/@lwc/rollup-plugin/src/__tests__/rootDir/rootDir.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/rootDir/rootDir.spec.ts index 59096976f0..55acc3142e 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/rootDir/rootDir.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/rootDir/rootDir.spec.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; -import { rollup } from 'rollup'; +import path from 'node:path'; +import { describe, it, expect } from 'vitest'; +import { rollup, type RollupLog } from 'rollup'; import lwc from '../../index'; describe('rootDir', () => { @@ -35,7 +36,7 @@ describe('rootDir', () => { }); it('warns if an "input" object is passed and when "rootDir" is not set', async () => { - const warnings: any = []; + const warnings: RollupLog[] = []; await rollup({ input: { diff --git a/packages/@lwc/rollup-plugin/src/__tests__/warnings/warnings.spec.ts b/packages/@lwc/rollup-plugin/src/__tests__/warnings/warnings.spec.ts index 54822e0ce2..921d2956e6 100644 --- a/packages/@lwc/rollup-plugin/src/__tests__/warnings/warnings.spec.ts +++ b/packages/@lwc/rollup-plugin/src/__tests__/warnings/warnings.spec.ts @@ -4,7 +4,9 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; +import path from 'node:path'; +import { describe, it, expect } from 'vitest'; + import { rollup, RollupLog } from 'rollup'; import { APIVersion } from '@lwc/shared'; import lwc from '../../index'; diff --git a/packages/@lwc/shared/src/__tests__/assert.spec.ts b/packages/@lwc/shared/src/__tests__/assert.spec.ts index 91182b65e2..281bbb190e 100644 --- a/packages/@lwc/shared/src/__tests__/assert.spec.ts +++ b/packages/@lwc/shared/src/__tests__/assert.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { assert } from '../index'; describe('assert', () => { diff --git a/packages/@lwc/shared/src/__tests__/html-attributes.spec.ts b/packages/@lwc/shared/src/__tests__/html-attributes.spec.ts index 3a275e729b..669b38ec70 100644 --- a/packages/@lwc/shared/src/__tests__/html-attributes.spec.ts +++ b/packages/@lwc/shared/src/__tests__/html-attributes.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import { htmlPropertyToAttribute, kebabCaseToCamelCase } from '../html-attributes'; type StringPair = [prop: string, attr: string]; diff --git a/packages/@lwc/shared/src/__tests__/signals.spec.ts b/packages/@lwc/shared/src/__tests__/signals.spec.ts index 3e2b5ebf74..b958052a79 100644 --- a/packages/@lwc/shared/src/__tests__/signals.spec.ts +++ b/packages/@lwc/shared/src/__tests__/signals.spec.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { vi } from 'vitest'; +import { describe, beforeEach, expect, it, vi } from 'vitest'; describe('signals', () => { let setTrustedSignalSet: (signals: WeakSet) => void; diff --git a/packages/@lwc/signals/src/__tests__/index.spec.ts b/packages/@lwc/signals/src/__tests__/index.spec.ts index d528874883..9f4b42dc7d 100644 --- a/packages/@lwc/signals/src/__tests__/index.spec.ts +++ b/packages/@lwc/signals/src/__tests__/index.spec.ts @@ -5,7 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { vi } from 'vitest'; +import { vi, describe, it, expect } from 'vitest'; import { Signal } from './signal'; describe('signal protocol', () => { diff --git a/packages/@lwc/ssr-compiler/src/__tests__/compilation.spec.ts b/packages/@lwc/ssr-compiler/src/__tests__/compilation.spec.ts index 134331a13f..95e75a688b 100644 --- a/packages/@lwc/ssr-compiler/src/__tests__/compilation.spec.ts +++ b/packages/@lwc/ssr-compiler/src/__tests__/compilation.spec.ts @@ -1,4 +1,5 @@ import path from 'node:path'; +import { describe, test, expect } from 'vitest'; import { compileComponentForSSR } from '../index'; describe('component compilation', () => { diff --git a/packages/@lwc/ssr-compiler/src/__tests__/estemplate.spec.ts b/packages/@lwc/ssr-compiler/src/__tests__/estemplate.spec.ts index 1157b6892a..6b1f65b8c8 100644 --- a/packages/@lwc/ssr-compiler/src/__tests__/estemplate.spec.ts +++ b/packages/@lwc/ssr-compiler/src/__tests__/estemplate.spec.ts @@ -6,6 +6,7 @@ */ import { is, builders as b } from 'estree-toolkit'; +import { describe, test, expect } from 'vitest'; import { esTemplate, esTemplateWithYield } from '../estemplate'; describe.each( @@ -54,7 +55,7 @@ describe.each( const tmpl = topLevelFn` const ${is.identifier} = 'foo'; `; - const doReplacement = () => tmpl(b.literal('I am not an identifier')); + const doReplacement = () => tmpl(b.literal('I am not an identifier') as any); expect(doReplacement).toThrow( 'Validation failed for templated node of type Identifier' ); diff --git a/packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts b/packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts index 7a97b684dc..208572684a 100644 --- a/packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts +++ b/packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts @@ -6,7 +6,7 @@ */ import path from 'node:path'; -import { vi } from 'vitest'; +import { vi, describe } from 'vitest'; import { rollup, RollupLog } from 'rollup'; import lwcRollupPlugin from '@lwc/rollup-plugin'; import { FeatureFlagName } from '@lwc/features/dist/types'; diff --git a/packages/@lwc/ssr-compiler/src/__tests__/transmogrify.spec.ts b/packages/@lwc/ssr-compiler/src/__tests__/transmogrify.spec.ts index c83c37a672..3018ec9cd0 100644 --- a/packages/@lwc/ssr-compiler/src/__tests__/transmogrify.spec.ts +++ b/packages/@lwc/ssr-compiler/src/__tests__/transmogrify.spec.ts @@ -1,6 +1,6 @@ import { parseModule } from 'meriyah'; import { generate } from 'astring'; -import { beforeAll } from 'vitest'; +import { describe, beforeAll, test, expect } from 'vitest'; import { transmogrify } from '../transmogrify'; import type { Program as EsProgram } from 'estree'; diff --git a/packages/@lwc/ssr-runtime/src/__tests__/render-component.spec.ts b/packages/@lwc/ssr-runtime/src/__tests__/render-component.spec.ts index e00b6d8218..4104c4f75d 100644 --- a/packages/@lwc/ssr-runtime/src/__tests__/render-component.spec.ts +++ b/packages/@lwc/ssr-runtime/src/__tests__/render-component.spec.ts @@ -1,5 +1,6 @@ import path from 'node:path'; import fs from 'node:fs/promises'; +import { describe, beforeAll, test, expect } from 'vitest'; import { rollup } from 'rollup'; import lwcRollupPlugin from '@lwc/rollup-plugin'; import { renderComponent } from '../index'; diff --git a/packages/@lwc/ssr-runtime/src/__tests__/server-side-render-component-alias.spec.ts b/packages/@lwc/ssr-runtime/src/__tests__/server-side-render-component-alias.spec.ts index 7e5ffcd20d..d12b22d1c4 100644 --- a/packages/@lwc/ssr-runtime/src/__tests__/server-side-render-component-alias.spec.ts +++ b/packages/@lwc/ssr-runtime/src/__tests__/server-side-render-component-alias.spec.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest'; import { renderComponent, serverSideRenderComponent } from '../index'; describe('renderComponent as alias of serverSideRenderComponent', () => { diff --git a/packages/@lwc/ssr-runtime/src/__tests__/to-iterator-directive.spec.ts b/packages/@lwc/ssr-runtime/src/__tests__/to-iterator-directive.spec.ts index cf99841fe1..996c8254c0 100644 --- a/packages/@lwc/ssr-runtime/src/__tests__/to-iterator-directive.spec.ts +++ b/packages/@lwc/ssr-runtime/src/__tests__/to-iterator-directive.spec.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest'; import { toIteratorDirective } from '../to-iterator-directive'; describe('toIteratorDirective', () => { diff --git a/packages/@lwc/ssr-runtime/src/__tests__/validate-style-text-contents.spec.ts b/packages/@lwc/ssr-runtime/src/__tests__/validate-style-text-contents.spec.ts index f18bdc9fba..ca65d2d99a 100644 --- a/packages/@lwc/ssr-runtime/src/__tests__/validate-style-text-contents.spec.ts +++ b/packages/@lwc/ssr-runtime/src/__tests__/validate-style-text-contents.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { validateStyleTextContents } from '../validate-style-text-contents'; // See https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions diff --git a/packages/@lwc/style-compiler/src/__tests__/index.spec.ts b/packages/@lwc/style-compiler/src/__tests__/index.spec.ts index bb795c4620..b352b4558d 100644 --- a/packages/@lwc/style-compiler/src/__tests__/index.spec.ts +++ b/packages/@lwc/style-compiler/src/__tests__/index.spec.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; +import path from 'node:path'; +import { describe } from 'vitest'; import { testFixtureDir } from '@lwc/test-utils-lwc-internals'; import { LWC_VERSION } from '@lwc/shared'; diff --git a/packages/@lwc/style-compiler/src/__tests__/inline.spec.ts b/packages/@lwc/style-compiler/src/__tests__/inline.spec.ts index 6a93e0caf0..319bad3a23 100644 --- a/packages/@lwc/style-compiler/src/__tests__/inline.spec.ts +++ b/packages/@lwc/style-compiler/src/__tests__/inline.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { transform } from '../index'; describe('playground test for debugging', () => { diff --git a/packages/@lwc/template-compiler/src/__tests__/config.spec.ts b/packages/@lwc/template-compiler/src/__tests__/config.spec.ts index cd41fe0f5f..2ae907a918 100644 --- a/packages/@lwc/template-compiler/src/__tests__/config.spec.ts +++ b/packages/@lwc/template-compiler/src/__tests__/config.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { HIGHEST_API_VERSION } from '@lwc/shared'; import { normalizeConfig } from '../config'; diff --git a/packages/@lwc/template-compiler/src/__tests__/error-codes.spec.ts b/packages/@lwc/template-compiler/src/__tests__/error-codes.spec.ts index e6d9c26e01..4411ac2165 100644 --- a/packages/@lwc/template-compiler/src/__tests__/error-codes.spec.ts +++ b/packages/@lwc/template-compiler/src/__tests__/error-codes.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { ErrorCodes } from 'parse5'; import { errorCodesToErrorOn, errorCodesToWarnOnInOlderAPIVersions } from '../parser/parse5Errors'; diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures.spec.ts b/packages/@lwc/template-compiler/src/__tests__/fixtures.spec.ts index a674d55509..168ba72f2e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures.spec.ts +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures.spec.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import path from 'path'; +import path from 'node:path'; +import { describe } from 'vitest'; import { LWC_VERSION } from '@lwc/shared'; import prettier from 'prettier'; import { testFixtureDir } from '@lwc/test-utils-lwc-internals'; diff --git a/packages/@lwc/template-compiler/src/__tests__/index.spec.ts b/packages/@lwc/template-compiler/src/__tests__/index.spec.ts index 42eb29eb68..8ea3df7fd8 100644 --- a/packages/@lwc/template-compiler/src/__tests__/index.spec.ts +++ b/packages/@lwc/template-compiler/src/__tests__/index.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, it, expect } from 'vitest'; import { DiagnosticLevel } from '@lwc/errors'; import compile, { Config, parse } from '../index'; diff --git a/packages/@lwc/wire-service/src/__tests__/index.spec.ts b/packages/@lwc/wire-service/src/__tests__/index.spec.ts index 4735221074..f6ca3a0888 100644 --- a/packages/@lwc/wire-service/src/__tests__/index.spec.ts +++ b/packages/@lwc/wire-service/src/__tests__/index.spec.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { vi } from 'vitest'; +import { vi, describe, it, expect } from 'vitest'; import { register, WireEventTarget, ValueChangedEvent } from '../index'; describe('WireEventTarget from register', () => { diff --git a/packages/lwc/__tests__/default-exports.spec.ts b/packages/lwc/__tests__/default-exports.spec.ts index 43c07c8043..42bd14a8e8 100644 --- a/packages/lwc/__tests__/default-exports.spec.ts +++ b/packages/lwc/__tests__/default-exports.spec.ts @@ -6,6 +6,7 @@ */ import * as fs from 'node:fs'; import * as path from 'node:path'; +import { describe, beforeAll, test, expect } from 'vitest'; const PACKAGE_ROOT = path.join(__dirname, '..'); diff --git a/packages/lwc/__tests__/isomorphic-exports.spec.ts b/packages/lwc/__tests__/isomorphic-exports.spec.ts index b388397cc7..18fcb5e791 100644 --- a/packages/lwc/__tests__/isomorphic-exports.spec.ts +++ b/packages/lwc/__tests__/isomorphic-exports.spec.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { describe, test, expect } from 'vitest'; import * as engineDom from '@lwc/engine-dom'; import * as engineServer from '@lwc/engine-server'; import * as ssrRuntime from '@lwc/ssr-runtime'; diff --git a/packages/lwc/__tests__/package-exports.spec.ts b/packages/lwc/__tests__/package-exports.spec.ts index c8f9fcc4fc..21656d01d0 100644 --- a/packages/lwc/__tests__/package-exports.spec.ts +++ b/packages/lwc/__tests__/package-exports.spec.ts @@ -6,6 +6,7 @@ */ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; +import { describe, test, expect } from 'vitest'; /** Packages that only contain type definitions, no JavaScript. */ const tsPackages = ['@lwc/types']; diff --git a/scripts/test-utils/test-fixture-dir.ts b/scripts/test-utils/test-fixture-dir.ts index ecfc9f6fe6..0ac9116ab8 100644 --- a/scripts/test-utils/test-fixture-dir.ts +++ b/scripts/test-utils/test-fixture-dir.ts @@ -7,6 +7,7 @@ import fs from 'node:fs'; import path from 'node:path'; +import { test } from 'vitest'; import * as glob from 'glob'; import type { Config as StyleCompilerConfig } from '@lwc/style-compiler'; const { globSync } = glob; diff --git a/tsconfig.json b/tsconfig.json index 6937306031..06449dfb2b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "lib": ["es2021"], // Disable automatic inclusion of @types packages - "types": ["node", "vitest/globals"], + "types": ["node"], // @rollup/plugin-typescript is actually responsible for writing dist files. Using "." as the declarationDir // ensures that .d.ts files are co-located with JS files, e.g. `dist/index.js` and `dist/index.d.ts`. diff --git a/vitest.shared.mjs b/vitest.shared.mjs index 6e74ae1dc2..26e7c05579 100644 --- a/vitest.shared.mjs +++ b/vitest.shared.mjs @@ -6,7 +6,6 @@ export default defineConfig({ test: { // Don't time out if we detect a debugger attached testTimeout: inspector.url() ? Number.MAX_SAFE_INTEGER : undefined, - globals: true, include: ['**/*.{test,spec}.{mjs,js,ts}'], snapshotFormat: { printBasicPrototype: true,