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

chore: re-write some files to typescript - part 2 #488

Merged
merged 7 commits into from
Aug 17, 2023

Conversation

shadowusr
Copy link
Member

@shadowusr shadowusr commented Aug 17, 2023

What's done?

  • re-written a few files to typescript as a preparation step for playwright support (sqlite-adapter, test-adapter and a few other related files)

Why?

  • to introduce strong types and be able to write new code in TS

⚠️ Notes

  • every commit is atomic, meaning all checks pass on every commit but the last one
  • might be a good idea to review each commit separately: in the final diff some moved files appear as completely removed/added, but when viewing commits separately you can see what's been truly changed

@shadowusr shadowusr changed the title chore: re-write some files to typescript chore: re-write some files to typescript - part 2 Aug 17, 2023

export type AssertViewResult = ImageDiffError;

export interface TestResult {
Copy link
Member Author

Choose a reason for hiding this comment

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

В этом файле многие типы вручную описаны, хотя похожие типы есть в hermione. Не делал импортов специально, чтобы не добавлять связности между пакетами. В будущем можно будет подрефакторить этот момент и сделать, например, адаптер

@@ -126,7 +163,7 @@ module.exports = class TestAdapter {
return {path: expectedPath, reused: false};
}

getImagesFor(status, stateName) {
getImagesFor(status: TestStatus, stateName?: string): ImageInfo | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

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

В этом методе условия стали чуть строже, а вместо {} возвращается undefined

Copy link
Member

@KuznetsovRoman KuznetsovRoman Aug 17, 2023

Choose a reason for hiding this comment

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

Почему undefined а не void?

Copy link
Member

@DudaGod DudaGod left a comment

Choose a reason for hiding this comment

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

/ok

lib/sqlite-adapter.ts Outdated Show resolved Hide resolved
lib/sqlite-adapter.ts Outdated Show resolved Hide resolved
lib/sqlite-adapter.ts Show resolved Hide resolved
lib/sqlite-adapter.ts Outdated Show resolved Hide resolved
lib/sqlite-adapter.ts Outdated Show resolved Hide resolved
@shadowusr shadowusr force-pushed the users/shadowusr/HERMIONE-1003.typescript-part-2 branch from d7efc5b to e438e5a Compare August 17, 2023 13:04
@shadowusr shadowusr merged commit b19fab3 into master Aug 17, 2023
4 of 5 checks passed
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.

3 participants