-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fable tests #196
Fable tests #196
Conversation
Awesome 😍 I'll look into it during the next few days |
I also converted Hedgehog.Fable.Tests.fsproj to use paket and updated paket.exe to the newest version. Hope this is OK. |
Do you run the latest VS 2019? The issue (failing do read |
SDK 3.1.201 was reported to be good again, but I can't build with it either. |
Yeah, I had the same problems. Following is working for me: In the root directory after fresh clone or after For running expecto tests:
I am not sure why .paket\paket.exe restore is not working here but For running fable/mocha tests in nodejs (You have to wait a little bit, there are some long running tests)
For running fable/mocha tests in browser (Here I have to click in browser to wait for the application because of the long running tests).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so worth it 😲 🚀 Thank you, thank you, thank you, for all the great work. — If we'd use Expecto from start, now we would avoid all the duplication, right?
If that's the case, shouldn't we consider replacing the existing (xUnit.net) test-suite with just a single Expecto one?
As I see it, there's a huge benefit here: one test-suite for both native (F#) and compiled (JS headless and browser) targets.
No problem. This is fun.
Yes. If we write everything in expecto style we can use it for Fable.Tests. The thing that does not work in Fable.Mocha is it does not support property based tests like Expecto but we are going to change it :-)
Yes. This is the idea to write one test for both worlds. That is excatly why Zaid Ajaj made Fable.Mocha library to have the same interface as Expecto. |
This shouldn't be a problem as most (if not all) of the test-suite is xUnit.net-based. |
🏓 |
Sorry, is it expected from me to do something here? I am not sure how this works :-) |
It's just a 'ping' (mostly for me) to get back to this anytime soon. Sorry for any trouble caused. |
No problem. I just didn't know if I had to do something so I asked. |
Marking this pull request as draft now. The plan is to try to remove the duplication in the test code. |
5a08ece
to
eed3f27
Compare
@moodmosaic I would love to get this merged. For some reason ionide gets stuck in a tight loop in the presence of double back-ticks, and makes my computer sound like it's going to achieve flight. Given that all of the xunit tests have double back-ticks everywhere this is a problem for me. @ThisFunctionalTom are you able to rebase these changes? |
eed3f27
to
3f4df3d
Compare
Did it. Also, we could try to upgrade fable compiler to fable 3. |
@ThisFunctionalTom, thanks for rebasing. 👍 I haven't followed Fable (3) but if that means we can run everything without having to install Node.js (and NPM) then perhaps it'll make things simpler. @adam-becker, off the top of my head, we'd have to check the following before even consider merging:
|
I don't think we can escape Node.js 😢 because we have to run the tests with mocha test runner and it comes as npm package.
I have to check this. I will try to do it this week. |
@ThisFunctionalTom Isn't the point of these tests that it's flexible? According to the documentation, we should be able to run with expecto. At least in a CI setting, whatever a developer chooses to do with their local environment is up to them. |
@adam-becker The problem is that the underlying
Running the tests just with expecto has nothing to do with fable compiler. It is just normal F# compiler + .NET runtime. |
@ThisFunctionalTom I just meant from a CI perspective, but you're right that we would still want to exercise the Fable generated code in case any bugs crop up there. As long as the project doesn't require nodejs for development I think it's still fine. @moodmosaic I'm unsure how much you're allowed customize the build environment with github actions, but if it's anything like GitLab CI with docker then this should be trivial to support. |
3f4df3d
to
9e4454a
Compare
Hi, sorry for the long delay. I made following changes:
I ran into a small issue with fable 3. Since
I removed the private modifier from npm is still needed for running tests in node/browser runtimes. If you would like to merge this we should probably think/talk about exchanging Hedgehog.Tests with Hedghog.Fable.Tests because they are duplicates now. If we run Hedghog.Fable.Tests with To try the same tests in javascript you can:
|
9e4454a
to
a7f6122
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @ThisFunctionalTom! I'm in favor of these changes, just a few things I think we should address.
Hedgehog.Tests
should be supplanted by these changes. In other words, delete that project, and renameHedgehog.Fable.Tests
to justHedgehog.Tests
.- Since
Xunit
is no longer a dependency, the functions inTestHelpers.fs
should be updated to removeXunit
terminology. However, I would prefer those helpers being inlined and removed. - The
theory
tests use<|
to pass a lambda as the last argument, we removed usages of this operator in Remove backward pipe #276, so we should consider not reintroducing it here. I won't block on this point however. - These tests need to run as part of CI, so changing
master.yml
andpull_request.yml
to include these tests would be my only real requirement.
a7f6122
to
2f22be9
Compare
also make the new Hedgehog.Tests `dotnet run` compatible
For more information see [here](actions/setup-dotnet#155 (comment))
I was able to rebase the branch, I'll give it another look and merge. |
@ThisFunctionalTom Thanks again! Great work. |
Hi,
I just converted all of the Hedgehog tests from xunit to Fable.Mocha to test if everything is working OK.
There a 3 tests failing with Range.exponentialBounded. I put them in "pending" mode.
Otherwise it looks good.
Two tests are taking a lot of time "unicode doesn't return any surrogate" and "unicode doesn't return any noncharacter" because they generate 100000 values but they are green.
If you would like to speed the tests you can put them in pending state by changing the fact to pfact and theory to ptheory.
To run tests with nodjs use
npm test
To run live tests in browser use
npm start
and then open http://localhost:8085I also added expecto as the runner for Hedgehog.Fable.Tests. To run it you have to compile the Hedghog.Fable.Tests project with msbuild (dotnet build is not working for the reason you already know). After the build you can run Hedgehog.Fable.Tests like a normal console application and expecto will run the tests. There is also a npm run script
npm run dotnet-expecto
but you need to have msbuild in your path to use it.I would also like to create some sample with Fable tests but I guess I will put it in another pull requests.
kind regards,
Tom