Open johannesodland opened 5 months ago
Yes, this is more than reasonable to do.
Which test suite did you have in mind? In the past I’ve used mocha
which was very easy to work with but if I’m not mistaken Node comes with a testrunner nowadays.
I'm interested in switching the build system as well, and possibly using typescript so that there'd be better IDE integration, documentation of types, etc. I was thinking maybe vite? In which case vitest..?
I want a build system that will make it easy to set up at least three different versions of the build,
add unit tests where we implement internal procedures
I suspect it would be good to avoid testing parts that are not publicly observable, as otherwise it might create unnecessary work when improving the internals. But there are many things not tested in wpt, that possibly don't make sense to test in wpt but would make sense to test, e.g. that the css parsing correctly respects @media queries, nested selectors, etc, where in wpt it is assumed that the features work together because they're independent from one another in browser space.
I was thinking maybe vite? In which case vitest..?
I haven't tested Vite in library mode, but it sounds tempting. Vitest works great, I've used it for testing some of the features before committing a PR. (I also tried Jest, but it doesn't work well with esm.)
I suspect it would be good to avoid testing parts that are not publicly observable, as otherwise it might create unnecessary work when improving the internals.
I agree. I think testing the internal implementations through the public API would be best.
Could we add a test framework for unit tests?
It would be useful to be able to build unit tests for some of the functionality. The web platform tests can take quite a while to run, and it would be useful to add unit tests where we implement internal procedures that are not tested directly in the WPT tests.