-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
uvu
is not browser compatible
#37
Comments
uvu/assert
is not browser compatibleuvu
is not browser compatible
I need to amend: |
Hey 👋 There's a browser wrapper/extension coming that will bundle your tests for you and auto-execute them inside a puppeteer or playwright instance. Right now, all that really needs to happen is a simple As it stands, my browser-layer will use these Rollup plugins which should cover most cases: resolve(),
commonjs(),
globals(),
builtins(), And here's a screenshot of AKA, it's definitely possible, but requires a little bit of effort right now (hence "compatible"). It should probably be asterisked... but the plan was to release the browser-layer soon after |
Ohai :D Getting bundling, shimming and puppeteering out of the box sounds great. Happy to dog-food that whenever it’s available. |
Cool, thank you :) My goal is to make it so that all you have to do is modify the CLI command (add The second usage pattern is programmatic, requiring an |
With {
input: 'path/to/test.js',
output: {
// suggested
format: 'esm',
file: 'path/to/output.js',
sourcemap: 'inline'
},
plugins: [
resolve(), // <~ @rollup/plugin-node-resolve
]
} I'll circle back here once I feel reasonably confident about the official browser thingy. |
👋 @lukeed, This approach works perfect for testing in browser. Do you have any recommendation on how to get code coverage report when running |
Hey, I'm slowly trying to design a new API that will accomodate programmatic usage – or at least make it easier. So eventually this will be easier. But until then, what I'm doing (am using playwright) is listening to the const strip = str => str.replace(/\x1b\[\d{1,2}m/g, '');
const toCount = (title, line) => Number(strip(line).split(title)[1]);
// ...
page.on('console', msg => {
let txt = msg.text();
if (txt.includes(' Total: ')) {
total += toCount('Total:', txt);
} else if (txt.includes(' Passed: ')) {
pass += toCount('Passed:', txt);
} else if (txt.includes(' Skipped: ')) {
skips += toCount('Skipped:', txt);
} else if (txt.includes(' Duration: ')) {
resolve({ total, pass, skips });
} else {
process.stdout.write(txt);
}
}); If you're running directly in a browser, you'll probably have to override the |
This sounds great, but maybe I was not super clear before. What I am looking for is to be able to obtain I looked at your earlier
This is something that might work in user land, but I am curious if The question was really about the roadmap for |
Oh gotcha. uvu will always just be the core test runner & "write the tests"-collection of utilities. It will remain agnostic to its environment, but always work as a Nodejs test runner by default. umu will be the opinionated browser orchestration tool. Like uvu, it will have its own CLI but could also be used programmatically. It's basically a wrapper around playwright (might make this flexible) and take care of the 90% use case of what people want from a frontend-testing setup. It will also have a programmatic interface so that you could pull it into existing tests or control tabs/page-reloads/etc if desired. The idea here is that you don't like or want the done-for-you solution (umu), you can always build on top of uvu, since it should be flexible & light enough to do what you want to do. TBH I'm not working on any frontend codebases right now, which means I'm not working on umu right now either, haha. Until then, you could import puppeteer/playwright directly into your uvu tests & do what you need to do – including collecting coverage. There are examples of this in the repo already & there are a number of projects that are using this approach w/ uvu too. So ya, uvu itself is nearly done, but its roadmap is:
|
Thank you @lukeed, this is great 🎉. I really appreciate you taking time to write that down 👍. |
Hi everyone, we have been using uvu in our company for the last five months and we are very happy with the result. We did a browser runner with |
This is the first I heard about an |
umu isn't publicly released yet as it's going thru major drastic changes. It's not ready or stable enough for public usage, but its development is tied to the |
@lukeed All of this sounds great! Can't wait! :) |
Not sure if this is intentional and there’s just a note missing in the README, but
uvu/assert
relies onkleur
, which assumesprocess
exists.I’d love if I could just bundle my test suite and run it in the browser.
The text was updated successfully, but these errors were encountered: