diff --git a/packages/require/integration/extensions/__tests__/index.ts b/packages/require/integration/extensions/__tests__/index.ts index 6d7fd61d4..9da2f084d 100644 --- a/packages/require/integration/extensions/__tests__/index.ts +++ b/packages/require/integration/extensions/__tests__/index.ts @@ -1,5 +1,6 @@ import execa, { NodeOptions } from "execa"; import { dirname, join } from "node:path"; +import { describe, test, expect } from "vitest"; const testDir = dirname(__dirname); diff --git a/packages/require/integration/import/__tests__/__snapshots__/index.ts.snap b/packages/require/integration/import/__tests__/__snapshots__/index.ts.snap index 853cdfd67..13431eb95 100644 --- a/packages/require/integration/import/__tests__/__snapshots__/index.ts.snap +++ b/packages/require/integration/import/__tests__/__snapshots__/index.ts.snap @@ -1,4 +1,18 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Node.js CJS > should import CJS file 1`] = `"{"default":{"ext":"mjs"},"ext":"mjs"}"`; + +exports[`Node.js CJS > should import JS file in package whose type = commonjs 1`] = `"{"default":{"ext":"js"},"ext":"js"}"`; + +exports[`Node.js CJS > should import JS file in package whose type = module 1`] = `"{"ext":"js"}"`; + +exports[`Node.js CJS > should import JSON file 1`] = `"{"default":{"ext":"json"}}"`; + +exports[`Node.js CJS > should import MJS file 1`] = `"{"ext":"mjs"}"`; + +exports[`Node.js CJS > should import MTS file 1`] = `"{"ext":"mts"}"`; + +exports[`Node.js CJS > should import TS file in package whose type = module 1`] = `"{"ext":"ts"}"`; exports[`Node.js CJS should import CJS file 1`] = `"{"default":{"ext":"mjs"},"ext":"mjs"}"`; @@ -14,6 +28,20 @@ exports[`Node.js CJS should import MTS file 1`] = `"{"ext":"mts"}"`; exports[`Node.js CJS should import TS file in package whose type = module 1`] = `"{"ext":"ts"}"`; +exports[`Node.js ESM > should import CJS file 1`] = `"{"default":{"ext":"mjs"},"ext":"mjs"}"`; + +exports[`Node.js ESM > should import JS file in package whose type = commonjs 1`] = `"{"default":{"ext":"js"},"ext":"js"}"`; + +exports[`Node.js ESM > should import JS file in package whose type = module 1`] = `"{"ext":"js"}"`; + +exports[`Node.js ESM > should import JSON file 1`] = `"{"default":{"ext":"json"}}"`; + +exports[`Node.js ESM > should import MJS file 1`] = `"{"ext":"mjs"}"`; + +exports[`Node.js ESM > should import MTS file 1`] = `"{"ext":"mts"}"`; + +exports[`Node.js ESM > should import TS file in package whose type = module 1`] = `"{"ext":"ts"}"`; + exports[`Node.js ESM should import CJS file 1`] = `"{"default":{"ext":"mjs"},"ext":"mjs"}"`; exports[`Node.js ESM should import JS file in package whose type = commonjs 1`] = `"{"default":{"ext":"js"},"ext":"js"}"`; diff --git a/packages/require/integration/import/__tests__/index.ts b/packages/require/integration/import/__tests__/index.ts index ed9aa041c..88ce49038 100644 --- a/packages/require/integration/import/__tests__/index.ts +++ b/packages/require/integration/import/__tests__/index.ts @@ -1,5 +1,6 @@ import execa, { NodeOptions } from "execa"; import { dirname, join } from "node:path"; +import { describe, test, expect } from "vitest"; const testDir = dirname(__dirname); diff --git a/packages/require/integration/jest.config.js b/packages/require/integration/jest.config.js deleted file mode 100644 index b69622d47..000000000 --- a/packages/require/integration/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - preset: "@kosko/jest-preset/integration" -}; diff --git a/packages/require/package.json b/packages/require/package.json index 86c7e801b..3b5df4b3f 100644 --- a/packages/require/package.json +++ b/packages/require/package.json @@ -49,10 +49,12 @@ "@kosko/build-scripts": "workspace:^", "@kosko/jest-preset": "workspace:^", "@kosko/test-utils": "workspace:^", + "@kosko/vitest-config": "workspace:^", "@types/node": "^18.11.9", "execa": "^5.1.1", "ts-node": "^10.9.2", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.2.2" }, "jest": { "preset": "@kosko/jest-preset" diff --git a/packages/require/vitest.config.integration.ts b/packages/require/vitest.config.integration.ts new file mode 100644 index 000000000..4f3ac4719 --- /dev/null +++ b/packages/require/vitest.config.integration.ts @@ -0,0 +1 @@ +export { integration as default } from "@kosko/vitest-config"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6608ebd5e..0722a1e53 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -652,6 +652,9 @@ importers: '@kosko/test-utils': specifier: workspace:^ version: link:../../internal/test-utils + '@kosko/vitest-config': + specifier: workspace:^ + version: link:../../internal/vitest-config '@types/node': specifier: ^18.11.9 version: 18.11.14 @@ -664,6 +667,9 @@ importers: typescript: specifier: ^5.3.3 version: 5.3.3 + vitest: + specifier: ^1.2.2 + version: 1.2.2(@types/node@18.11.14) packages/template: dependencies: