chore [P-12]: kdkdk
This commit is contained in:
1 parent
c156614ee3
commit
bcdcabb4a1
12 files changed
+312
-44
No files matched your search
@@ -528,6 +528,10 @@ export default withMermaid({
|
||||
"text": "MainmenuStore",
|
||||
"link": "/src/store/MainmenuStore"
|
||||
},
|
||||
{
|
||||
"text": "UseAlertStore",
|
||||
"link": "/src/store/UseAlertStore"
|
||||
},
|
||||
{
|
||||
"text": "WeekendsStore",
|
||||
"link": "/src/store/WeekendsStore"
|
||||
@@ -539,10 +543,6 @@ export default withMermaid({
|
||||
{
|
||||
"text": "index",
|
||||
"link": "/src/store/index"
|
||||
},
|
||||
{
|
||||
"text": "useAlertStore",
|
||||
"link": "/src/store/useAlertStore"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -3,44 +3,109 @@
|
||||
<div>
|
||||
<h2>Результаты тестов:</h2>
|
||||
|
||||
<!-- Общее состояние тестов -->
|
||||
<div v-if="results.success" class="success">✅ Все тесты успешно пройдены!</div>
|
||||
|
||||
<div v-else-if="results.numFailedTestSuites > 0" class="error">
|
||||
❌ Ошибки в тестах: {{ results.numFailedTestSuites }}
|
||||
❌ Ошибки в тестах: {{ results.numFailedTestSuites }} из {{ results.numTotalTestSuites }}
|
||||
</div>
|
||||
<div v-else class="warning">⚠️ Некоторые тесты не завершились корректно.</div>
|
||||
|
||||
<!-- Сообщения об ошибках -->
|
||||
<pre v-if="errorMessage" class="error-log">{{ errorMessage }}</pre>
|
||||
|
||||
<ul>
|
||||
<li v-for="test in results.testResults" :key="test.name">
|
||||
<strong>{{ test.name }}</strong>
|
||||
<br>
|
||||
<span v-if="test.status === 'passed'" class="passed">✅ Успешно</span>
|
||||
<span v-else class="failed">❌ Ошибка</span>
|
||||
<pre v-if="test.message" class="error-log">{{ test.message }}</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Сводная информация -->
|
||||
<div v-if="results.testResults" class="summary">
|
||||
<h3>Сводка по тестам:</h3>
|
||||
<ul>
|
||||
<li><strong>Общее количество тестов:</strong> {{ results.numTotalTests }}</li>
|
||||
<li>
|
||||
<strong>Пройдено:</strong> {{ results.numPassedTests }} ({{
|
||||
getPercentage(results.numPassedTests, results.numTotalTests)
|
||||
}}%)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Неудачных:</strong> {{ results.numFailedTests }} ({{
|
||||
getPercentage(results.numFailedTests, results.numTotalTests)
|
||||
}}%)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Список успешных тестов -->
|
||||
<div v-if="passedTests.length">
|
||||
<h3>Успешные тесты:</h3>
|
||||
<ul>
|
||||
<li v-for="test in passedTests" :key="test.fullName">
|
||||
<strong>{{ test.fullName }}</strong> ✅ ({{ test.duration }} мс)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Список неудачных тестов -->
|
||||
<div v-if="failedTests.length">
|
||||
<h3>Неудачные тесты:</h3>
|
||||
<ul>
|
||||
<li v-for="test in failedTests" :key="test.fullName">
|
||||
<strong>{{ test.fullName }}</strong> ❌ ({{ test.duration }} мс)
|
||||
<pre v-if="test.failureMessages.length" class="error-log">
|
||||
{{ test.failureMessages.join('\n') }}
|
||||
</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, computed, watch } from 'vue';
|
||||
|
||||
const results = ref({});
|
||||
const errorMessage = ref('');
|
||||
|
||||
// Функция для вычисления процента успешных/неудачных тестов
|
||||
const getPercentage = (num, total) => {
|
||||
return ((num / total) * 100).toFixed(2);
|
||||
};
|
||||
|
||||
// Загружаем результаты тестов при монтировании компонента
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await fetch('/test-results.json');
|
||||
const data = await response.json();
|
||||
results.value = data;
|
||||
|
||||
// Если есть ошибки, собираем все сообщения об ошибках
|
||||
if (!data.success) {
|
||||
errorMessage.value = data.testResults.map((t) => t.message).join('\n\n');
|
||||
errorMessage.value = data.testResults
|
||||
.map((t) => (t.failureMessages ? t.failureMessages.join('\n') : ''))
|
||||
.join('\n\n');
|
||||
}
|
||||
} catch (error) {
|
||||
errorMessage.value = `Ошибка при загрузке результатов: ${error.message}`;
|
||||
}
|
||||
} catch (error) {}
|
||||
});
|
||||
|
||||
// Вычисляем успешные и неудачные тесты
|
||||
const passedTests = computed(() => {
|
||||
const assertionResults = results.value?.testResults?.[0]?.assertionResults;
|
||||
return (
|
||||
assertionResults
|
||||
?.filter((test) => test.status === 'passed')
|
||||
.map((test) => ({
|
||||
...test,
|
||||
failureMessages: test.failureMessages || [],
|
||||
})) || []
|
||||
);
|
||||
});
|
||||
|
||||
const failedTests = computed(() => {
|
||||
const assertionResults = results.value?.testResults?.[0]?.assertionResults;
|
||||
return (
|
||||
assertionResults
|
||||
?.filter((test) => test.status === 'failed')
|
||||
.map((test) => ({
|
||||
...test,
|
||||
failureMessages: test.failureMessages || [],
|
||||
})) || []
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -55,6 +120,11 @@ onMounted(async () => {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: orange;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.passed {
|
||||
color: green;
|
||||
}
|
||||
@@ -70,4 +140,13 @@ onMounted(async () => {
|
||||
white-space: pre-wrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.summary {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.duration {
|
||||
color: #555;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user