microsoft / vscode-css

CSS Textmate grammar for syntax highlighting
Other
15 stars 11 forks source link

Rebuilding a test suite for this package #8

Open romainmenke opened 1 year ago

romainmenke commented 1 year ago

Unless I am overlooking something there aren't any working tests at this moment. The lack of tests makes it very difficult to contribute safely to this package.

There is spec/css-spec.coffee but there is no way to actually run that.

romainmenke commented 1 year ago

@andreamah, can you give guidance on this or do you know who to ping to move this forward?

I am happy to contribute my time to help with this effort but I need to know the preferred direction before getting started.

andreamah commented 10 months ago

Hey! I'm so so sorry for not replying for so long.

I gathered some info for testing this. We use the colorization tests in the vscode repo (ie: https://github.com/microsoft/vscode/blob/ce40e7ce61f2ba02b64efadd4ca1f5376307163f/extensions/vscode-colorize-tests/test/colorize-results/test_css.json), which get run by the integration tests here https://github.com/Microsoft/vscode/blob/9eeb60b7f286a104f844e99b3a69974bbad72f97/scripts/test-integration.bat#L51-L53. Feel free to add to test_css.json.

We store the output in snapshots. When the test run they compare whether the snapshots have changed. This is an example PR that changes the snapshot for CSharp https://github.com/microsoft/vscode/pull/196839/files

Otherwise, to sanity test, you can

  1. Use vscode-textmate to run a grammar against sample code
  2. Verify the output whether the emitted and offsets and scopes make sense
romainmenke commented 10 months ago

Hi @andreamah,

Thank you so much for this information and context.

I wont have time in the near future for this effort but maybe someone else does? I am hoping to switch back to larger CSS contributions in a few months.