Skip to content

Conversation

@jkone27
Copy link
Owner

@jkone27 jkone27 commented Apr 4, 2025

adds npm run test support with vitest, and VI and TestingLibrary (dom) custom bindings

"@solidjs/testing-library": "^0.8.10",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/user-event": "^14.6.1",
"jsdom": "^26.0.0",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add deps


<ItemGroup>
<Compile Include="App.fs" />
<Compile Include="App.test.fs" />
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test file


[<Import("fireEvent", from = "@solidjs/testing-library")>]
let fireEvent: DomEvent = jsNative

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dom (TestingLibrary) fable bindings

let test(name: string, test: unit -> unit) = jsNative

[<Import("describe", from = "vitest")>]
let describe(name: string, testSuite: unit -> unit) = jsNative
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vi (vitest) fable bindings

Dom.fireEvent.click(buttonElement)
let updatedButtonElement = element.getByText("count is 1")
Vi.expect(updatedButtonElement).toBeInTheDocument()
)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual test

conditions: ["development", "browser"],
test: {
server: {
deps: { inline: true }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requitred for this to work in vscode ext

@jkone27 jkone27 merged commit 7ae6452 into main Apr 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants