-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(ui): add summary #493
Merged
Merged
Changes from 10 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
e28ae6e
feat: ui summary
userquin 7babb57
Merge branch 'main' into userquin/feat-ui-summary
userquin 3cb7181
feat(ui): add summary
userquin 070ab38
Merge branch 'main' into userquin/feat-ui-summary
userquin 593b902
chore: include running + adjust colors
userquin 7a3e47f
chore: use v-show for graph (save state)
userquin ca0a1a8
fix: initial file on F5
userquin 3aee56e
chore: add tests entry to summary
userquin a707146
chore: update skipped test color legend
userquin 111ea57
chore: revert current module handling
userquin 41d8847
chore: progress bars width changes, update logic
userquin 0f607b7
chore: add border top to global progress bars
userquin d284f20
chore: update requested changes
userquin 291351c
chore: add global time
userquin 289dc94
chore: use total instead unref
userquin e2029cc
chore: use tests instead files for time
userquin ab39493
chore: `currentModule` was reverted
userquin e48bffe
chore: add navigation logic again
userquin b23cc2d
Merge remote-tracking branch 'origin/userquin/feat-ui-summary' into u…
userquin 103583a
chore: adjust debounce logic
userquin d9f3677
chore: fix split panes layout
userquin 3dd68ea
cleanup: remove split ref
userquin 9b85406
chore: initialize nav and suite width equals
userquin 0b86602
chore: make search input grow
userquin 2fd8aa3
chore: adjust suite pane % to match nav width
userquin 57f53df
chore: add summary icon
userquin 112faf9
chore: add summary icon animations
userquin c7d9512
chore: center summary content
userquin a7e7f4d
chore: fix scrolls on suite panel
userquin 4594f20
Merge branch 'main' into userquin/feat-ui-summary
antfu c09c678
chore: buttons title + report summary
userquin ab4eece
Merge remote-tracking branch 'origin/userquin/feat-ui-summary' into u…
userquin beb439d
chore: replace inject/provide with globals
userquin 5e33ff8
chore: change summary with dashboard
userquin d475161
chore: update dashboard
userquin d984f55
chore: update files and tests sizes, paddings and gaps
userquin 27bc979
chore: make progress bar always visible
userquin 8878ea4
chore: update dark bg color on dashboard section
userquin e477e24
chore: fix summary dashboard layout
userquin 59d092d
wip
antfu 1574d01
Merge branch 'main' into userquin/feat-ui-summary
antfu 1c59ca4
chore: update
antfu 9cfe8b8
Merge branch 'main' into userquin/feat-ui-summary
antfu 48c0cbd
chore: keep simple for now
antfu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<script setup lang="ts"> | ||
const props = defineProps<{ total: number; failed: number; pass: number; inProgress: boolean }>() | ||
const widthPass = computed(() => { | ||
const total = props.total | ||
return total > 0 ? (350 * props.pass / total) : 0 | ||
}) | ||
const widthFailed = computed(() => { | ||
const total = props.total | ||
return total > 0 ? (350 * props.failed / total) : 0 | ||
}) | ||
const pending = computed(() => { | ||
return props.total - props.failed - props.pass | ||
}) | ||
const widthPending = computed(() => { | ||
const total = props.total | ||
return total > 0 ? (350 * pending.value / total) : 0 | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div h-8 line-height-1 px-0 grid="~ auto-cols-max" justify-items-center> | ||
<div h-1rem relative max-w-300px min-w-300px w-300px overflow-hidden class="px-0"> | ||
<div | ||
absolute | ||
left-0 | ||
top-0 | ||
h-full | ||
line-height-1 | ||
text-right | ||
bg-red5 | ||
:class="[{'in-progress': props.inProgress}]" | ||
:style="`width: ${widthFailed}px;`" | ||
> | ||
<template v-if="!inProgress"> | ||
<div vertical-align-middle c-white text-xs m="y-0 x-5px" ws-nowrap> | ||
{{ props.failed }} | ||
</div> | ||
</template> | ||
</div> | ||
<div | ||
absolute | ||
left-0 | ||
top-0 | ||
h-full | ||
line-height-1 | ||
text-right | ||
bg-green5 | ||
:class="[{'in-progress': props.inProgress}]" | ||
:style="`left: ${widthFailed}px; width: ${widthPass}px;`" | ||
> | ||
<template v-if="!inProgress"> | ||
<div vertical-align-middle c-white text-xs m="y-0 x-5px" ws-nowrap> | ||
{{ props.pass }} | ||
</div> | ||
</template> | ||
</div> | ||
<div | ||
absolute | ||
left-0 | ||
top-0 | ||
h-full | ||
line-height-1 | ||
text-right | ||
bg-yellow5 | ||
class="test-bg-pending" | ||
:class="[{'in-progress': props.inProgress}]" | ||
:style="`left: ${widthPass + widthFailed}px; width: ${widthPending}px;`" | ||
> | ||
<template v-if="!inProgress"> | ||
<div vertical-align-middle c-white font-size-12px m="y-0 x-5px" ws-nowrap> | ||
  | ||
</div> | ||
</template> | ||
</div> | ||
</div> | ||
<div text-center text-xs> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.in-progress { | ||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); | ||
background-size: 40px 40px; | ||
animation: in-progress-stripes 2s linear infinite; | ||
} | ||
@keyframes in-progress-stripes { | ||
from { | ||
background-position: 40px 0; | ||
} | ||
to { | ||
background-position: 0 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup lang="ts"> | ||
import type { Task, Test } from 'vitest/src' | ||
import { files, isConnected } from '~/composables/client' | ||
|
||
const failed = computed(() => files.value.filter(f => f.result?.state === 'fail')) | ||
const success = computed(() => files.value.filter(f => f.result?.state === 'pass')) | ||
const ignore = computed(() => files.value.filter(f => f.mode === 'skip' || f.mode === 'todo')) | ||
const running = computed(() => files.value.filter(f => | ||
!failed.value.includes(f) | ||
&& !success.value.includes(f) | ||
&& !ignore.value.includes(f), | ||
)) | ||
const skipped = computed(() => ignore.value.filter(f => f.mode === 'skip')) | ||
const todo = computed(() => ignore.value.filter(f => f.mode === 'todo')) | ||
const finished = computed(() => { | ||
return running.value.length === 0 | ||
}) | ||
type Nullable<T> = T | null | undefined | ||
type Arrayable<T> = T | Array<T> | ||
function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> { | ||
array = array || [] | ||
if (Array.isArray(array)) | ||
return array | ||
return [array] | ||
} | ||
function getTests(suite: Arrayable<Task>): Test[] { | ||
return toArray(suite).flatMap(s => s.type === 'test' ? [s] : s.tasks.flatMap(c => c.type === 'test' ? [c] : getTests(c))) | ||
} | ||
const tests = computed(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think all this computed values should be before methods |
||
return getTests(files.value) | ||
}) | ||
const testsFailed = computed(() => { | ||
return tests.value.filter(f => f.result?.state === 'fail') | ||
}) | ||
const testsSuccess = computed(() => { | ||
return tests.value.filter(f => f.result?.state === 'pass') | ||
}) | ||
const testsIgnore = computed(() => tests.value.filter(f => f.mode === 'skip' || f.mode === 'todo')) | ||
const testsSkipped = computed(() => testsIgnore.value.filter(f => f.mode === 'skip')) | ||
const testsTodo = computed(() => testsIgnore.value.filter(f => f.mode === 'todo')) | ||
const totalTests = computed(() => { | ||
return testsFailed.value.length + testsSuccess.value.length | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div v-if="isConnected" flex="~ col" items-center justify-center gap-y-1 p-y-2> | ||
<ProgressBar :total="files.length" :failed="failed.length" :pass="success.length" :in-progress="!finished"> | ||
Test Files <span text-red5>{{ failed.length }} failed</span> | <span text-green5>{{ success.length }} passed</span> | <span text-yellow5>{{ running.length }} running</span> <span c-gray op-75>({{ files.length }})</span> | ||
</ProgressBar> | ||
<ProgressBar :total="totalTests" :failed="testsFailed.length" :pass="testsSuccess.length" :in-progress="!finished"> | ||
Tests <span text-red5>{{ testsFailed.length }} failed</span> | <span text-green5>{{ testsSuccess.length }} passed</span> | <span text-yellow5>{{ testsSkipped.length }} skipped</span> | <span c-gray op-75>{{ testsTodo.length }} todo</span> <span c-gray op-75>({{ tests.length }})</span> | ||
</ProgressBar> | ||
<div>Time: </div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,6 +372,23 @@ Repository: [email protected]:moxystudio/node-cross-spawn.git | |
|
||
--------------------------------------- | ||
|
||
## detect-indent | ||
antfu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
License: MIT | ||
By: Sindre Sorhus | ||
Repository: sindresorhus/detect-indent | ||
|
||
> MIT License | ||
> | ||
> Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
--------------------------------------- | ||
|
||
## diff | ||
License: BSD-3-Clause | ||
Repository: git:https://github.com/kpdecker/jsdiff.git | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not destructure this props so you can just use the values directly inside template instead of
props.value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
total can be outside the computed i.e
const total = unref(total)
since it's been reused in multiple places