Open NEO97online opened 2 years ago
This had come up before in #1255 and it's not at all clear to me who would actually be running these tests.
If, from the Svelte compiler's point of view, all it had to do was ignore these script blocks when building the app, that would be easy to do with a preprocessor. And telling the test runner how to read these files would have to be specific to that particular test runner.
I agree with @Conduitry too. This seems to be possible to be supported in userland, and I think it should stay that way as it depends on the test runner. The most Svelte can do is endorse the context="test"
convention, but I don't think there's a need to.
Describe the problem
Testing does not currently feel like a first-class feature in Svelte, but I believe it should be. One way we could improve this is by adding support for a
test
context within components, which could be run bysvelte-check
.Once tests are written in
.svelte
files, we open up the possibilities of the compiler to make test cases even easier to read and write and integrate directly with our svelte components.Describe the proposed solution
Here's an example of how a component could look with tests:
Alternatives considered
The current alternative is to write test cases in
js
orts
files, using a test runner likejest
.Importance
would make my life easier