Skip to content

Commit ae8518c

Browse files
gcantifubhy
andauthored
refactor platform tests (#4377)
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
1 parent d1a5b43 commit ae8518c

File tree

735 files changed

+1270
-1449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

735 files changed

+1270
-1449
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@effect/dtslint": "^0.1.2",
5050
"@effect/eslint-plugin": "^0.2.0",
5151
"@effect/language-service": "^0.1.0",
52+
"@effect/vitest": "workspace:^",
5253
"@eslint/compat": "1.1.1",
5354
"@eslint/eslintrc": "3.1.0",
5455
"@eslint/js": "9.9.1",

packages/ai/ai/tsconfig.src.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"extends": "../../../tsconfig.base.json",
33
"include": ["src"],
4-
"references": [{ "path": "../../effect" }, { "path": "../../platform" }],
4+
"references": [
5+
{ "path": "../../effect/tsconfig.src.json" },
6+
{ "path": "../../platform/tsconfig.src.json" }
7+
],
58
"compilerOptions": {
69
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
710
"rootDir": "src",

packages/ai/ai/tsconfig.test.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"include": ["test"],
44
"references": [
55
{ "path": "tsconfig.src.json" },
6-
{ "path": "../../effect" },
7-
{ "path": "../../platform" },
8-
{ "path": "../../vitest" }
6+
{ "path": "../../vitest/tsconfig.src.json" }
97
],
108
"compilerOptions": {
119
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",

packages/ai/ai/vitest.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { mergeConfig, type UserConfigExport } from "vitest/config"
1+
import { mergeConfig, type ViteUserConfig } from "vitest/config"
22
import shared from "../../../vitest.shared.js"
33

4-
const config: UserConfigExport = {}
4+
const config: ViteUserConfig = {}
55

66
export default mergeConfig(shared, config)

packages/ai/openai/tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": "./tsconfig.src.json",
33
"references": [
4-
{ "path": "../../effect/tsconfig.build.json" },
54
{ "path": "../ai/tsconfig.build.json" },
5+
{ "path": "../../effect/tsconfig.build.json" },
66
{ "path": "../../experimental/tsconfig.build.json" },
77
{ "path": "../../platform/tsconfig.build.json" }
88
],

packages/ai/openai/tsconfig.src.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"extends": "../../../tsconfig.base.json",
3-
"include": ["src", "../../experimental/src/Sse.ts"],
3+
"include": ["src"],
44
"references": [
5-
{ "path": "../../effect" },
6-
{ "path": "../ai" },
7-
{ "path": "../../experimental" },
8-
{ "path": "../../platform" }
5+
{ "path": "../ai/tsconfig.src.json" },
6+
{ "path": "../../effect/tsconfig.src.json" },
7+
{ "path": "../../experimental/tsconfig.src.json" },
8+
{ "path": "../../platform/tsconfig.src.json" }
99
],
1010
"compilerOptions": {
1111
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",

packages/ai/openai/tsconfig.test.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"include": ["test"],
44
"references": [
55
{ "path": "tsconfig.src.json" },
6-
{ "path": "../../effect" },
7-
{ "path": "../ai" },
8-
{ "path": "../../experimental" },
9-
{ "path": "../../platform" },
10-
{ "path": "../../vitest" }
6+
{ "path": "../../vitest/tsconfig.src.json" }
117
],
128
"compilerOptions": {
139
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",

packages/ai/openai/vitest.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { mergeConfig, type UserConfigExport } from "vitest/config"
1+
import { mergeConfig, type ViteUserConfig } from "vitest/config"
22
import shared from "../../../vitest.shared.js"
33

4-
const config: UserConfigExport = {}
4+
const config: ViteUserConfig = {}
55

66
export default mergeConfig(shared, config)

packages/cli/test/Args.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import * as HelpDoc from "@effect/cli/HelpDoc"
44
import * as ValidationError from "@effect/cli/ValidationError"
55
import { FileSystem, Path } from "@effect/platform"
66
import { NodeContext } from "@effect/platform-node"
7+
import { describe, expect, it } from "@effect/vitest"
78
import * as Array from "effect/Array"
89
import * as Effect from "effect/Effect"
910
import * as Option from "effect/Option"
1011
import * as Schema from "effect/Schema"
11-
import { describe, expect, it } from "vitest"
1212

1313
const runEffect = <E, A>(
1414
self: Effect.Effect<A, E, NodeContext.NodeContext>

packages/cli/test/AutoCorrect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as AutoCorrect from "@effect/cli/AutoCorrect"
22
import * as CliConfig from "@effect/cli/CliConfig"
3-
import { describe, expect, it } from "vitest"
3+
import { describe, expect, it } from "@effect/vitest"
44

55
describe("AutoCorrect", () => {
66
it("should calculate the correct Levenstein distance between two strings", () => {

packages/cli/test/CliApp.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as HelpDoc from "@effect/cli/HelpDoc"
55
import * as MockConsole from "@effect/cli/test/services/MockConsole"
66
import * as ValidationError from "@effect/cli/ValidationError"
77
import { NodeContext } from "@effect/platform-node"
8+
import { describe, expect, it } from "@effect/vitest"
89
import { Array, Console, Effect, FiberRef, Layer, LogLevel } from "effect"
9-
import { describe, expect, it } from "vitest"
1010

1111
const MainLive = Effect.gen(function*(_) {
1212
const console = yield* _(MockConsole.make)

packages/cli/test/Command.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Args, Command, Options } from "@effect/cli"
22
import { NodeContext } from "@effect/platform-node"
3+
import { assert, describe, it } from "@effect/vitest"
34
import { Config, ConfigProvider, Context, Effect, Layer } from "effect"
4-
import { assert, describe, it } from "vitest"
55

66
const git = Command.make("git", {
77
verbose: Options.boolean("verbose").pipe(

packages/cli/test/CommandDescriptor.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import * as WordCount from "@effect/cli/test/utils/wc"
1111
import * as ValidationError from "@effect/cli/ValidationError"
1212
import * as NodeContext from "@effect/platform-node/NodeContext"
1313
import * as Doc from "@effect/printer/Doc"
14+
import { describe, expect, it } from "@effect/vitest"
1415
import { Array, Effect, Option, String } from "effect"
15-
import { describe, expect, it } from "vitest"
1616

1717
const runEffect = <E, A>(
1818
self: Effect.Effect<A, E, NodeContext.NodeContext>

packages/cli/test/ConfigFile.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as ConfigFile from "@effect/cli/ConfigFile"
22
import type { FileSystem } from "@effect/platform"
33
import { Path } from "@effect/platform"
44
import { NodeContext } from "@effect/platform-node"
5+
import { assert, describe, it } from "@effect/vitest"
56
import * as Config from "effect/Config"
67
import * as Effect from "effect/Effect"
7-
import { assert, describe, it } from "vitest"
88

99
const runEffect = <E, A>(
1010
self: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>

packages/cli/test/Options.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as ValidationError from "@effect/cli/ValidationError"
55
import * as NodeContext from "@effect/platform-node/NodeContext"
66
import * as FileSystem from "@effect/platform/FileSystem"
77
import * as Path from "@effect/platform/Path"
8+
import { assert, describe, expect, it } from "@effect/vitest"
89
import { BigDecimal } from "effect"
910
import * as Array from "effect/Array"
1011
import * as Data from "effect/Data"
@@ -14,7 +15,6 @@ import { identity } from "effect/Function"
1415
import * as HashMap from "effect/HashMap"
1516
import * as Option from "effect/Option"
1617
import * as Schema from "effect/Schema"
17-
import { assert, describe, expect, it } from "vitest"
1818

1919
const firstName = Options.text("firstName").pipe(Options.withAlias("f"))
2020
const lastName = Options.text("lastName")

packages/cli/test/Primitive.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as CliConfig from "@effect/cli/CliConfig"
22
import * as Primitive from "@effect/cli/Primitive"
33
import type { FileSystem } from "@effect/platform"
44
import { NodeFileSystem } from "@effect/platform-node"
5+
import { describe, expect, it } from "@effect/vitest"
56
import { Array, Effect, Equal, Function, Option } from "effect"
67
import * as fc from "effect/FastCheck"
7-
import { describe, expect, it } from "vitest"
88

99
const runEffect = <E, A>(self: Effect.Effect<A, E, FileSystem.FileSystem>): Promise<A> =>
1010
Effect.provide(self, NodeFileSystem.layer).pipe(Effect.runPromise)

packages/cli/test/Prompt.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as MockTerminal from "@effect/cli/test/services/MockTerminal"
55
import { NodeFileSystem, NodePath } from "@effect/platform-node"
66
import * as Ansi from "@effect/printer-ansi/Ansi"
77
import * as Doc from "@effect/printer-ansi/AnsiDoc"
8+
import { describe, expect, it } from "@effect/vitest"
89
import * as Console from "effect/Console"
910
import * as Effect from "effect/Effect"
1011
import * as Fiber from "effect/Fiber"
1112
import * as Layer from "effect/Layer"
1213
import * as Redacted from "effect/Redacted"
13-
import { describe, expect, it } from "vitest"
1414

1515
const MainLive = Effect.gen(function*() {
1616
const console = yield* MockConsole.make

packages/cli/test/Wizard.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as MockConsole from "@effect/cli/test/services/MockConsole"
55
import * as MockTerminal from "@effect/cli/test/services/MockTerminal"
66
import {} from "@effect/platform"
77
import { NodeFileSystem, NodePath } from "@effect/platform-node"
8+
import { describe, expect, it } from "@effect/vitest"
89
import { Array, Effect } from "effect"
910
import * as Console from "effect/Console"
1011
import * as Fiber from "effect/Fiber"
1112
import * as Layer from "effect/Layer"
12-
import { describe, expect, it } from "vitest"
1313

1414
const MainLive = Effect.gen(function*(_) {
1515
const console = yield* _(MockConsole.make)

packages/cli/tsconfig.examples.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"include": ["examples"],
44
"references": [
55
{ "path": "tsconfig.src.json" },
6-
{ "path": "../effect" },
7-
{ "path": "../printer" },
8-
{ "path": "../printer-ansi" },
9-
{ "path": "../platform" },
10-
{ "path": "../platform-node" }
6+
{ "path": "../platform-node/tsconfig.src.json" }
117
],
128
"compilerOptions": {
139
"types": ["node"],

packages/cli/tsconfig.src.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
"extends": "../../tsconfig.base.json",
33
"include": ["src"],
44
"references": [
5-
{ "path": "../effect" },
6-
{ "path": "../printer" },
7-
{ "path": "../printer-ansi" },
8-
{ "path": "../platform" },
9-
{ "path": "../platform-node" }
5+
{ "path": "../effect/tsconfig.src.json" },
6+
{ "path": "../printer/tsconfig.src.json" },
7+
{ "path": "../printer-ansi/tsconfig.src.json" },
8+
{ "path": "../platform/tsconfig.src.json" }
109
],
1110
"compilerOptions": {
1211
"types": ["node"],

packages/cli/tsconfig.test.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
"include": ["test"],
44
"references": [
55
{ "path": "tsconfig.src.json" },
6-
{ "path": "../effect" },
7-
{ "path": "../printer" },
8-
{ "path": "../printer-ansi" },
9-
{ "path": "../platform" },
10-
{ "path": "../platform-node" }
6+
{ "path": "../vitest/tsconfig.src.json" },
7+
{ "path": "../platform-node/tsconfig.src.json" }
118
],
129
"compilerOptions": {
1310
"types": ["node"],

packages/cli/vitest.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { mergeConfig, type UserConfigExport } from "vitest/config"
1+
import { mergeConfig, type ViteUserConfig } from "vitest/config"
22
import shared from "../../vitest.shared.js"
33

4-
const config: UserConfigExport = {}
4+
const config: ViteUserConfig = {}
55

66
export default mergeConfig(shared, config)

packages/cluster-browser/tsconfig.src.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"include": ["src"],
4-
"references": [{ "path": "../effect" }, { "path": "../rpc" }],
4+
"references": [
5+
{ "path": "../effect/tsconfig.src.json" },
6+
{ "path": "../rpc/tsconfig.src.json" }
7+
],
58
"compilerOptions": {
69
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
710
"rootDir": "src",

packages/cluster-browser/tsconfig.test.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "../../tsconfig.base.json",
33
"include": ["test"],
44
"references": [
5-
{ "path": "tsconfig.src.json" }
5+
{ "path": "tsconfig.src.json" },
6+
{ "path": "../vitest/tsconfig.src.json" }
67
],
78
"compilerOptions": {
89
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { mergeConfig, type UserConfigExport } from "vitest/config"
1+
import { mergeConfig, type ViteUserConfig } from "vitest/config"
22
import shared from "../../vitest.shared.js"
33

4-
const config: UserConfigExport = {}
4+
const config: ViteUserConfig = {}
55

66
export default mergeConfig(shared, config)

packages/cluster-node/tsconfig.examples.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"include": [
4-
"examples"
5-
],
3+
"include": ["examples"],
64
"references": [
75
{ "path": "tsconfig.src.json" },
8-
{ "path": "../rpc-http" },
9-
{ "path": "../platform" },
10-
{ "path": "../platform-node" }
6+
{ "path": "../rpc-http/tsconfig.src.json" },
7+
{ "path": "../platform-node/tsconfig.src.json" }
118
],
129
"compilerOptions": {
1310
"types": ["node"],

packages/cluster-node/tsconfig.src.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"extends": "../../tsconfig.base.json",
33
"include": ["src"],
44
"references": [
5-
{ "path": "../effect" },
6-
{ "path": "../cluster" },
7-
{ "path": "../rpc" }
5+
{ "path": "../effect/tsconfig.src.json" },
6+
{ "path": "../cluster/tsconfig.src.json" },
7+
{ "path": "../rpc/tsconfig.src.json" }
88
],
99
"compilerOptions": {
1010
"types": ["node"],

packages/cluster-node/tsconfig.test.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"include": [
4-
"test"
5-
],
3+
"include": ["test"],
64
"references": [
7-
{ "path": "tsconfig.src.json" }
5+
{ "path": "tsconfig.src.json" },
6+
{ "path": "../vitest/tsconfig.src.json" }
87
],
98
"compilerOptions": {
109
"types": ["node"],
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { mergeConfig, type UserConfigExport } from "vitest/config"
1+
import { mergeConfig, type ViteUserConfig } from "vitest/config"
22
import shared from "../../vitest.shared.js"
33

4-
const config: UserConfigExport = {}
4+
const config: ViteUserConfig = {}
55

66
export default mergeConfig(shared, config)

packages/cluster-workflow/test/CrashableRuntime.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import * as LogLevel from "effect/LogLevel"
55
import * as Option from "effect/Option"
66
import * as Ref from "effect/Ref"
77

8+
import { describe, expect, it } from "@effect/vitest"
89
import * as Duration from "effect/Duration"
910
import * as Effect from "effect/Effect"
1011
import { pipe } from "effect/Function"
11-
import { describe, expect, it } from "vitest"
1212

1313
describe.concurrent("CrashableRuntime", () => {
1414
const withTestEnv = <R, E, A>(fa: Effect.Effect<R, E, A>) => pipe(fa, Logger.withMinimumLogLevel(LogLevel.Info))

packages/cluster-workflow/test/DurableExecutionJournal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
55
import * as FileSystem from "@effect/platform/FileSystem"
66
import * as Sqlite from "@effect/sql-sqlite-node/SqliteClient"
77
import * as SqlClient from "@effect/sql/SqlClient"
8+
import { describe, expect, it } from "@effect/vitest"
89
import * as Chunk from "effect/Chunk"
910
import * as Effect from "effect/Effect"
1011
import * as Layer from "effect/Layer"
1112
import * as Schema from "effect/Schema"
1213
import * as Stream from "effect/Stream"
13-
import { describe, expect, it } from "vitest"
1414

1515
const makeSqlClient = Effect.gen(function*() {
1616
const fs = yield* FileSystem.FileSystem

packages/cluster-workflow/test/Workflow.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as utils from "@effect/cluster-workflow/test/utils"
88
import * as Workflow from "@effect/cluster-workflow/Workflow"
99
import * as WorkflowEngine from "@effect/cluster-workflow/WorkflowEngine"
1010
import * as Message from "@effect/cluster/Message"
11+
import { describe, expect, it } from "@effect/vitest"
1112
import * as Chunk from "effect/Chunk"
1213
import * as Deferred from "effect/Deferred"
1314
import * as Effect from "effect/Effect"
@@ -18,7 +19,6 @@ import * as LogLevel from "effect/LogLevel"
1819
import * as Ref from "effect/Ref"
1920
import * as Schema from "effect/Schema"
2021
import * as Stream from "effect/Stream"
21-
import { describe, expect, it } from "vitest"
2222

2323
describe.concurrent("Workflow", () => {
2424
const withTestEnv = <R, E, A>(fa: Effect.Effect<R, E, A>) =>

packages/cluster-workflow/test/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as Activity from "@effect/cluster-workflow/Activity"
2+
import { vi } from "@effect/vitest"
3+
import type { Mock } from "@effect/vitest"
24
import * as Effect from "effect/Effect"
35
import type * as Exit from "effect/Exit"
46
import { pipe } from "effect/Function"
57
import type * as Schema from "effect/Schema"
6-
import { vi } from "vitest"
7-
import type { Mock } from "vitest"
88

99
export function mockEffect<A, E>(
1010
impl: () => Exit.Exit<A, E>

0 commit comments

Comments
 (0)