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

test: exclude content of UI assets from comparison in html output tests #4037

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

berezinant
Copy link
Contributor

No description provided.

Comment on lines 67 to 72
val excludedFiles = listOf(
"ui-kit/ui-kit.min.js",
"ui-kit/ui-kit.min.css",
"styles/main.css",
"scripts/main.js",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be a good idea to create a global variable dokkaHtmlStyleFiles: List<String>, so if they need to be changed they can be updated in all tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -20,8 +20,8 @@ import kotlin.io.path.*
*
* Only files will be compared, directories are ignored.
*/
infix fun Path.shouldBeADirectoryWithSameContentAs(path: Path) {
val differences = describeFileDifferences(this, path)
fun Path.shouldBeADirectoryWithSameContentAs(path: Path, excludeFiles: List<String> = emptyList()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excludeFiles will completely exclude the files from the comparison. Maybe it would be better to exclude checking the file's content instead? That way we can still check that the files exist, but the actual styling isn't relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the check inside the contents comparison part

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think it'd be a good idea to update the variable name too, to be more descriptive. wdyt?

E.g. filesExcludedFromContentCheck

@berezinant berezinant force-pushed the html-output-tests branch 2 times, most recently from 8da1a5b to bbe0c4b Compare February 25, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants