Skip to content

Commit 36f6f09

Browse files
committed
add femto helpers to vitest + friends
1 parent fae79f3 commit 36f6f09

6 files changed

Lines changed: 42 additions & 6 deletions

File tree

src/Vitest.JestDom/Vitest.JestDom.fsproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,15 @@
1717
<PackageReference Include="Fable.Browser.Dom" />
1818
</ItemGroup>
1919

20+
<ItemGroup>
21+
<Content Include="*.fsproj; *.fs;" Exclude="**\*.fs.js" PackagePath="fable\" />
22+
</ItemGroup>
23+
24+
<PropertyGroup>
25+
<NpmDependencies>
26+
<NpmPackage Name="jsdom" Version="gt 26.0.0 lt 27.0.0" ResolutionStrategy="Max" />
27+
<NpmPackage Name="@testing-library/jest-dom" Version="gt 6.6.0 lt 7.0.0" ResolutionStrategy="Max" />
28+
</NpmDependencies>
29+
</PropertyGroup>
30+
2031
</Project>

src/Vitest.ReactTestingLibrary/Vitest.ReactTestingLibrary.fsproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@
1818
<ProjectReference Include="..\Feliz\Feliz.fsproj" />
1919
</ItemGroup>
2020

21+
<ItemGroup>
22+
<Content Include="*.fsproj; *.fs;" Exclude="**\*.fs.js" PackagePath="fable\" />
23+
</ItemGroup>
24+
25+
<PropertyGroup>
26+
<NpmDependencies>
27+
<NpmPackage Name="@testing-library/react" Version="gt 16.0.0 lt 17.0.0" ResolutionStrategy="Max" />
28+
</NpmDependencies>
29+
</PropertyGroup>
30+
2131
</Project>

src/Vitest.UserEvent/Vitest.UserEvent.fsproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,14 @@
1515
<PackageReference Include="Fable.Promise" />
1616
</ItemGroup>
1717

18+
<ItemGroup>
19+
<Content Include="*.fsproj; *.fs;" Exclude="**\*.fs.js" PackagePath="fable\" />
20+
</ItemGroup>
21+
22+
<PropertyGroup>
23+
<NpmDependencies>
24+
<NpmPackage Name="@testing-library/user-event" Version="gt 14.0.0 lt 15.0.0" ResolutionStrategy="Max" />
25+
</NpmDependencies>
26+
</PropertyGroup>
27+
1828
</Project>

src/Vitest/Library.fs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ type AbortSignal = obj
1111

1212
type IVitest = obj
1313

14-
15-
module console =
16-
[<Emit("console.log($0)")>]
17-
let log (msg: obj) = jsNative
18-
1914
[<StringEnum(CaseRules.LowerFirst)>]
2015
type TypeOf =
2116
| Bigint

src/Vitest/Vitest.fsproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,14 @@
1414
<PackageReference Include="Fable.Promise" />
1515
</ItemGroup>
1616

17+
<ItemGroup>
18+
<Content Include="*.fsproj; *.fs;" Exclude="**\*.fs.js" PackagePath="fable\" />
19+
</ItemGroup>
20+
21+
<PropertyGroup>
22+
<NpmDependencies>
23+
<NpmPackage Name="vitest" Version="gt 3.1.0 lt 4.0.0" ResolutionStrategy="Max" />
24+
</NpmDependencies>
25+
</PropertyGroup>
26+
1727
</Project>

tests/Vitest/Program.test.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Vitest.describe("TextContext", fun () ->
205205

206206
Vitest.test("sum adds two numbers with context", fun (ctx: TestContext) ->
207207
ctx.onTestFinished(fun x ->
208-
console.log(x.task.result.state)
208+
Browser.Dom.console.log(x.task.result.state)
209209
)
210210
let result = Examples.sum 2 3
211211
ctx.expect(result).toBe(5)

0 commit comments

Comments
 (0)