mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
refactor: move extension testing package to pkg/
Move the extension testing package from internal/extensions/test to pkg/extensions/test to make it publicly importable by external extension authors. Changes: - Moved test package files to pkg/extensions/test/ - Updated all imports from internal/ to pkg/ path: - README.md - examples/extensions/tool-logger_test.go - examples/extensions/extension_test_template.go - skills/kit-extensions/SKILL.md - www/pages/extensions/testing.md - pkg/extensions/test/README.md - pkg/extensions/test/harness.go The test package is now available for external import as: github.com/mark3labs/kit/pkg/extensions/test All tests pass with race detector.
This commit is contained in:
@@ -362,7 +362,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test that your extension loads without errors
|
// Test that your extension loads without errors
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test that the tool-logger extension loads and registers handlers
|
// Test that the tool-logger extension loads and registers handlers
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Testing Kit Extensions
|
# Testing Kit Extensions
|
||||||
|
|
||||||
The `github.com/mark3labs/kit/internal/extensions/test` package provides utilities for testing Kit extensions using standard Go testing patterns.
|
The `github.com/mark3labs/kit/pkg/extensions/test` package provides utilities for testing Kit extensions using standard Go testing patterns.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ The test package is part of the Kit codebase. Import it in your extension tests:
|
|||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@@ -32,7 +32,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
//
|
//
|
||||||
// import (
|
// import (
|
||||||
// "testing"
|
// "testing"
|
||||||
// "github.com/mark3labs/kit/internal/extensions/test"
|
// "github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
// )
|
// )
|
||||||
//
|
//
|
||||||
// func TestMyExtension(t *testing.T) {
|
// func TestMyExtension(t *testing.T) {
|
||||||
@@ -930,7 +930,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1216,6 +1216,6 @@ func applyMode(ctx ext.Context, active bool, tools []string) {
|
|||||||
- [`internal/extensions/runner.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/runner.go) — Event dispatch and state management
|
- [`internal/extensions/runner.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/runner.go) — Event dispatch and state management
|
||||||
- [`internal/extensions/loader.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/loader.go) — Yaegi interpreter setup
|
- [`internal/extensions/loader.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/loader.go) — Yaegi interpreter setup
|
||||||
- [`internal/extensions/symbols.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/symbols.go) — All types exported to extensions
|
- [`internal/extensions/symbols.go`](https://github.com/mark3labs/kit/blob/main/internal/extensions/symbols.go) — All types exported to extensions
|
||||||
- [`internal/extensions/test/`](https://github.com/mark3labs/kit/tree/main/internal/extensions/test) — Testing package with harness, mocks, and assertions
|
- [`pkg/extensions/test/`](https://github.com/mark3labs/kit/tree/main/pkg/extensions/test) — Testing package with harness, mocks, and assertions
|
||||||
- [`examples/extensions/tool-logger_test.go`](https://github.com/mark3labs/kit/blob/main/examples/extensions/tool-logger_test.go) — Complete test example
|
- [`examples/extensions/tool-logger_test.go`](https://github.com/mark3labs/kit/blob/main/examples/extensions/tool-logger_test.go) — Complete test example
|
||||||
- [`examples/extensions/`](https://github.com/mark3labs/kit/tree/main/examples/extensions) — 25+ working example extensions
|
- [`examples/extensions/`](https://github.com/mark3labs/kit/tree/main/examples/extensions) — 25+ working example extensions
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ description: Write unit tests for your Kit extensions using the test package.
|
|||||||
|
|
||||||
# Testing Extensions
|
# Testing Extensions
|
||||||
|
|
||||||
Kit provides a testing package (`github.com/mark3labs/kit/internal/extensions/test`) that enables you to write unit tests for your extensions. Tests run outside the Yaegi interpreter but load your extension code into an isolated interpreter instance, allowing you to verify behavior without running the full Kit TUI.
|
Kit provides a testing package (`github.com/mark3labs/kit/pkg/extensions/test`) that enables you to write unit tests for your extensions. Tests run outside the Yaegi interpreter but load your extension code into an isolated interpreter instance, allowing you to verify behavior without running the full Kit TUI.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ The test package is part of the Kit codebase. Import it in your extension tests:
|
|||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@@ -41,7 +41,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/mark3labs/kit/internal/extensions/test"
|
"github.com/mark3labs/kit/pkg/extensions/test"
|
||||||
"github.com/mark3labs/kit/internal/extensions"
|
"github.com/mark3labs/kit/internal/extensions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user