Skip to content

Commit

Permalink
refactor platform tests (#4377)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Lorenz <[email protected]>
  • Loading branch information
gcanti and fubhy authored Jan 31, 2025
1 parent d1a5b43 commit ae8518c
Show file tree
Hide file tree
Showing 735 changed files with 1,270 additions and 1,449 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@effect/dtslint": "^0.1.2",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@effect/vitest": "workspace:^",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/ai/ai/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"references": [{ "path": "../../effect" }, { "path": "../../platform" }],
"references": [
{ "path": "../../effect/tsconfig.src.json" },
{ "path": "../../platform/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
"rootDir": "src",
Expand Down
4 changes: 1 addition & 3 deletions packages/ai/ai/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"include": ["test"],
"references": [
{ "path": "tsconfig.src.json" },
{ "path": "../../effect" },
{ "path": "../../platform" },
{ "path": "../../vitest" }
{ "path": "../../vitest/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/ai/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeConfig, type UserConfigExport } from "vitest/config"
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../../vitest.shared.js"

const config: UserConfigExport = {}
const config: ViteUserConfig = {}

export default mergeConfig(shared, config)
2 changes: 1 addition & 1 deletion packages/ai/openai/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "./tsconfig.src.json",
"references": [
{ "path": "../../effect/tsconfig.build.json" },
{ "path": "../ai/tsconfig.build.json" },
{ "path": "../../effect/tsconfig.build.json" },
{ "path": "../../experimental/tsconfig.build.json" },
{ "path": "../../platform/tsconfig.build.json" }
],
Expand Down
10 changes: 5 additions & 5 deletions packages/ai/openai/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"extends": "../../../tsconfig.base.json",
"include": ["src", "../../experimental/src/Sse.ts"],
"include": ["src"],
"references": [
{ "path": "../../effect" },
{ "path": "../ai" },
{ "path": "../../experimental" },
{ "path": "../../platform" }
{ "path": "../ai/tsconfig.src.json" },
{ "path": "../../effect/tsconfig.src.json" },
{ "path": "../../experimental/tsconfig.src.json" },
{ "path": "../../platform/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
Expand Down
6 changes: 1 addition & 5 deletions packages/ai/openai/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"include": ["test"],
"references": [
{ "path": "tsconfig.src.json" },
{ "path": "../../effect" },
{ "path": "../ai" },
{ "path": "../../experimental" },
{ "path": "../../platform" },
{ "path": "../../vitest" }
{ "path": "../../vitest/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/openai/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeConfig, type UserConfigExport } from "vitest/config"
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../../vitest.shared.js"

const config: UserConfigExport = {}
const config: ViteUserConfig = {}

export default mergeConfig(shared, config)
2 changes: 1 addition & 1 deletion packages/cli/test/Args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import * as HelpDoc from "@effect/cli/HelpDoc"
import * as ValidationError from "@effect/cli/ValidationError"
import { FileSystem, Path } from "@effect/platform"
import { NodeContext } from "@effect/platform-node"
import { describe, expect, it } from "@effect/vitest"
import * as Array from "effect/Array"
import * as Effect from "effect/Effect"
import * as Option from "effect/Option"
import * as Schema from "effect/Schema"
import { describe, expect, it } from "vitest"

const runEffect = <E, A>(
self: Effect.Effect<A, E, NodeContext.NodeContext>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/AutoCorrect.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as AutoCorrect from "@effect/cli/AutoCorrect"
import * as CliConfig from "@effect/cli/CliConfig"
import { describe, expect, it } from "vitest"
import { describe, expect, it } from "@effect/vitest"

describe("AutoCorrect", () => {
it("should calculate the correct Levenstein distance between two strings", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/CliApp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as HelpDoc from "@effect/cli/HelpDoc"
import * as MockConsole from "@effect/cli/test/services/MockConsole"
import * as ValidationError from "@effect/cli/ValidationError"
import { NodeContext } from "@effect/platform-node"
import { describe, expect, it } from "@effect/vitest"
import { Array, Console, Effect, FiberRef, Layer, LogLevel } from "effect"
import { describe, expect, it } from "vitest"

const MainLive = Effect.gen(function*(_) {
const console = yield* _(MockConsole.make)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/Command.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Args, Command, Options } from "@effect/cli"
import { NodeContext } from "@effect/platform-node"
import { assert, describe, it } from "@effect/vitest"
import { Config, ConfigProvider, Context, Effect, Layer } from "effect"
import { assert, describe, it } from "vitest"

const git = Command.make("git", {
verbose: Options.boolean("verbose").pipe(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/CommandDescriptor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import * as WordCount from "@effect/cli/test/utils/wc"
import * as ValidationError from "@effect/cli/ValidationError"
import * as NodeContext from "@effect/platform-node/NodeContext"
import * as Doc from "@effect/printer/Doc"
import { describe, expect, it } from "@effect/vitest"
import { Array, Effect, Option, String } from "effect"
import { describe, expect, it } from "vitest"

const runEffect = <E, A>(
self: Effect.Effect<A, E, NodeContext.NodeContext>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/ConfigFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as ConfigFile from "@effect/cli/ConfigFile"
import type { FileSystem } from "@effect/platform"
import { Path } from "@effect/platform"
import { NodeContext } from "@effect/platform-node"
import { assert, describe, it } from "@effect/vitest"
import * as Config from "effect/Config"
import * as Effect from "effect/Effect"
import { assert, describe, it } from "vitest"

const runEffect = <E, A>(
self: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/Options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as ValidationError from "@effect/cli/ValidationError"
import * as NodeContext from "@effect/platform-node/NodeContext"
import * as FileSystem from "@effect/platform/FileSystem"
import * as Path from "@effect/platform/Path"
import { assert, describe, expect, it } from "@effect/vitest"
import { BigDecimal } from "effect"
import * as Array from "effect/Array"
import * as Data from "effect/Data"
Expand All @@ -14,7 +15,6 @@ import { identity } from "effect/Function"
import * as HashMap from "effect/HashMap"
import * as Option from "effect/Option"
import * as Schema from "effect/Schema"
import { assert, describe, expect, it } from "vitest"

const firstName = Options.text("firstName").pipe(Options.withAlias("f"))
const lastName = Options.text("lastName")
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/Primitive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as CliConfig from "@effect/cli/CliConfig"
import * as Primitive from "@effect/cli/Primitive"
import type { FileSystem } from "@effect/platform"
import { NodeFileSystem } from "@effect/platform-node"
import { describe, expect, it } from "@effect/vitest"
import { Array, Effect, Equal, Function, Option } from "effect"
import * as fc from "effect/FastCheck"
import { describe, expect, it } from "vitest"

const runEffect = <E, A>(self: Effect.Effect<A, E, FileSystem.FileSystem>): Promise<A> =>
Effect.provide(self, NodeFileSystem.layer).pipe(Effect.runPromise)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/Prompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import * as MockTerminal from "@effect/cli/test/services/MockTerminal"
import { NodeFileSystem, NodePath } from "@effect/platform-node"
import * as Ansi from "@effect/printer-ansi/Ansi"
import * as Doc from "@effect/printer-ansi/AnsiDoc"
import { describe, expect, it } from "@effect/vitest"
import * as Console from "effect/Console"
import * as Effect from "effect/Effect"
import * as Fiber from "effect/Fiber"
import * as Layer from "effect/Layer"
import * as Redacted from "effect/Redacted"
import { describe, expect, it } from "vitest"

const MainLive = Effect.gen(function*() {
const console = yield* MockConsole.make
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/Wizard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import * as MockConsole from "@effect/cli/test/services/MockConsole"
import * as MockTerminal from "@effect/cli/test/services/MockTerminal"
import {} from "@effect/platform"
import { NodeFileSystem, NodePath } from "@effect/platform-node"
import { describe, expect, it } from "@effect/vitest"
import { Array, Effect } from "effect"
import * as Console from "effect/Console"
import * as Fiber from "effect/Fiber"
import * as Layer from "effect/Layer"
import { describe, expect, it } from "vitest"

const MainLive = Effect.gen(function*(_) {
const console = yield* _(MockConsole.make)
Expand Down
6 changes: 1 addition & 5 deletions packages/cli/tsconfig.examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"include": ["examples"],
"references": [
{ "path": "tsconfig.src.json" },
{ "path": "../effect" },
{ "path": "../printer" },
{ "path": "../printer-ansi" },
{ "path": "../platform" },
{ "path": "../platform-node" }
{ "path": "../platform-node/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
9 changes: 4 additions & 5 deletions packages/cli/tsconfig.src.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"extends": "../../tsconfig.base.json",
"include": ["src"],
"references": [
{ "path": "../effect" },
{ "path": "../printer" },
{ "path": "../printer-ansi" },
{ "path": "../platform" },
{ "path": "../platform-node" }
{ "path": "../effect/tsconfig.src.json" },
{ "path": "../printer/tsconfig.src.json" },
{ "path": "../printer-ansi/tsconfig.src.json" },
{ "path": "../platform/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"include": ["test"],
"references": [
{ "path": "tsconfig.src.json" },
{ "path": "../effect" },
{ "path": "../printer" },
{ "path": "../printer-ansi" },
{ "path": "../platform" },
{ "path": "../platform-node" }
{ "path": "../vitest/tsconfig.src.json" },
{ "path": "../platform-node/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeConfig, type UserConfigExport } from "vitest/config"
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../vitest.shared.js"

const config: UserConfigExport = {}
const config: ViteUserConfig = {}

export default mergeConfig(shared, config)
5 changes: 4 additions & 1 deletion packages/cluster-browser/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"references": [{ "path": "../effect" }, { "path": "../rpc" }],
"references": [
{ "path": "../effect/tsconfig.src.json" },
{ "path": "../rpc/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
"rootDir": "src",
Expand Down
3 changes: 2 additions & 1 deletion packages/cluster-browser/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../tsconfig.base.json",
"include": ["test"],
"references": [
{ "path": "tsconfig.src.json" }
{ "path": "tsconfig.src.json" },
{ "path": "../vitest/tsconfig.src.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo",
Expand Down
4 changes: 2 additions & 2 deletions packages/cluster-browser/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeConfig, type UserConfigExport } from "vitest/config"
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../vitest.shared.js"

const config: UserConfigExport = {}
const config: ViteUserConfig = {}

export default mergeConfig(shared, config)
9 changes: 3 additions & 6 deletions packages/cluster-node/tsconfig.examples.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"include": [
"examples"
],
"include": ["examples"],
"references": [
{ "path": "tsconfig.src.json" },
{ "path": "../rpc-http" },
{ "path": "../platform" },
{ "path": "../platform-node" }
{ "path": "../rpc-http/tsconfig.src.json" },
{ "path": "../platform-node/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
6 changes: 3 additions & 3 deletions packages/cluster-node/tsconfig.src.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"extends": "../../tsconfig.base.json",
"include": ["src"],
"references": [
{ "path": "../effect" },
{ "path": "../cluster" },
{ "path": "../rpc" }
{ "path": "../effect/tsconfig.src.json" },
{ "path": "../cluster/tsconfig.src.json" },
{ "path": "../rpc/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
7 changes: 3 additions & 4 deletions packages/cluster-node/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"include": [
"test"
],
"include": ["test"],
"references": [
{ "path": "tsconfig.src.json" }
{ "path": "tsconfig.src.json" },
{ "path": "../vitest/tsconfig.src.json" }
],
"compilerOptions": {
"types": ["node"],
Expand Down
4 changes: 2 additions & 2 deletions packages/cluster-node/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeConfig, type UserConfigExport } from "vitest/config"
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../vitest.shared.js"

const config: UserConfigExport = {}
const config: ViteUserConfig = {}

export default mergeConfig(shared, config)
2 changes: 1 addition & 1 deletion packages/cluster-workflow/test/CrashableRuntime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import * as LogLevel from "effect/LogLevel"
import * as Option from "effect/Option"
import * as Ref from "effect/Ref"

import { describe, expect, it } from "@effect/vitest"
import * as Duration from "effect/Duration"
import * as Effect from "effect/Effect"
import { pipe } from "effect/Function"
import { describe, expect, it } from "vitest"

describe.concurrent("CrashableRuntime", () => {
const withTestEnv = <R, E, A>(fa: Effect.Effect<R, E, A>) => pipe(fa, Logger.withMinimumLogLevel(LogLevel.Info))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
import * as FileSystem from "@effect/platform/FileSystem"
import * as Sqlite from "@effect/sql-sqlite-node/SqliteClient"
import * as SqlClient from "@effect/sql/SqlClient"
import { describe, expect, it } from "@effect/vitest"
import * as Chunk from "effect/Chunk"
import * as Effect from "effect/Effect"
import * as Layer from "effect/Layer"
import * as Schema from "effect/Schema"
import * as Stream from "effect/Stream"
import { describe, expect, it } from "vitest"

const makeSqlClient = Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
Expand Down
2 changes: 1 addition & 1 deletion packages/cluster-workflow/test/Workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as utils from "@effect/cluster-workflow/test/utils"
import * as Workflow from "@effect/cluster-workflow/Workflow"
import * as WorkflowEngine from "@effect/cluster-workflow/WorkflowEngine"
import * as Message from "@effect/cluster/Message"
import { describe, expect, it } from "@effect/vitest"
import * as Chunk from "effect/Chunk"
import * as Deferred from "effect/Deferred"
import * as Effect from "effect/Effect"
Expand All @@ -18,7 +19,6 @@ import * as LogLevel from "effect/LogLevel"
import * as Ref from "effect/Ref"
import * as Schema from "effect/Schema"
import * as Stream from "effect/Stream"
import { describe, expect, it } from "vitest"

describe.concurrent("Workflow", () => {
const withTestEnv = <R, E, A>(fa: Effect.Effect<R, E, A>) =>
Expand Down
4 changes: 2 additions & 2 deletions packages/cluster-workflow/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Activity from "@effect/cluster-workflow/Activity"
import { vi } from "@effect/vitest"
import type { Mock } from "@effect/vitest"
import * as Effect from "effect/Effect"
import type * as Exit from "effect/Exit"
import { pipe } from "effect/Function"
import type * as Schema from "effect/Schema"
import { vi } from "vitest"
import type { Mock } from "vitest"

export function mockEffect<A, E>(
impl: () => Exit.Exit<A, E>
Expand Down
Loading

0 comments on commit ae8518c

Please sign in to comment.