Skip to content
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

Implement tests! #13

Open
captainbrosset opened this issue Dec 8, 2017 · 3 comments
Open

Implement tests! #13

captainbrosset opened this issue Dec 8, 2017 · 3 comments

Comments

@captainbrosset
Copy link
Owner

This was hacked up together in one evening, so of course tests were the last thing on my mind. But it won't be able to survive much longer without proper testing.

@AugustasV
Copy link

AugustasV commented Jan 4, 2018

I want to do that, but I don't have any experience. Maybe you can give me some source, or names how I should google it to learn it? @captainbrosset ? @juliandescottes

@juliandescottes
Copy link
Contributor

Thanks @AugustasV !

There are no "extension-specific" tests we could easily implement, so the best to get started would be to pick a javascript unit test framework and write unit tests after extracting the main logic of the extension to dedicated files.

Some devtools repositories use jest, so that might be an option. Let me know if you need pointers on how to set this up for this project. Setting up a unit-testing solution will already be a great step forward here.

Regarding actually writing test, it can be done afterwards. I haven't read the code in too much details so @captainbrosset probably can point to which part of the code would be worth testing at the moment?

@captainbrosset
Copy link
Owner Author

This sounds like a good plan. Thank you @juliandescottes.

In terms of what to test, an interesting part is in https://github.com/captainbrosset/devtools-highlighter/blob/master/src/devtools/panel/devtools-panel.js

This is where the code that displays nodes and handles UI interactions currently lives.
It can, indeed, be broken up into smaller files that are easier to test.

The other part is in https://github.com/captainbrosset/devtools-highlighter/blob/master/src/content_scripts/content.js
That's the code that is responsible for finding nodes in the page based on search queries.
The most complex code is the one that parses and executes CSS computed style queries. Adding tests for this would be awesome.
And, again, moving this to its own file would be great too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants