lit / lit

Lit is a simple library for building fast, lightweight web components.
https://lit.dev
BSD 3-Clause "New" or "Revised" License
18.57k stars 915 forks source link

[infra] Add support for trusted types to test system #1270

Open rictic opened 4 years ago

rictic commented 4 years ago

In order to add Trusted Types support to lit next we need to be able to test it, and it looks like our current test setup has issues.

We're using @web/test-runner with @web/test-runner-mocha, which depends on mocha, which does some .innerHTML assignment. I sent over https://github.com/mochajs/mocha/pull/4447 to fix.

Patching that in, I think that's all that we need here. If that change doesn't get reviewed in a timely fashion though, we can look into alternatives like jasmine.

LarsDenBakker commented 4 years ago

If the amount of tests you need to write for this are somewhat manageable, you could also write tests without a test framework. You just need to set up some boilerplate to ping back results to the test runner.

You can write them in JS, but that requires running a separate test runner instance. If you write a HTML test, you can set this up within the current test runner. See an example here at the bottom of the page.

LarsDenBakker commented 4 years ago

You may also be able to bypass the this issue by not using the HTML reporter in mocha.

rictic commented 4 years ago

Ideally we'd run all of our tests both with and without trusted types enabled.

Running without the HTML reporter would work I bet. The only other place that needed changing was some bit of code highlighting.

justinfagnani commented 3 years ago

@rictic how is this looking? Looks like you got a ping on https://github.com/mochajs/mocha/pull/4447

nicolejadeyee commented 2 years ago

@rictic can we close this out?