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: fix build duration for HTML Reporter #3683

Merged
merged 4 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/reporter/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class HtmlReporter extends BaseReporter {
this.environments[testEnv].stats.failed += failedCount;
this.environments[testEnv].stats.skipped += module.skippedCount;
this.environments[testEnv].stats.total += passedCount + failedCount + module.skippedCount;
this.environments[testEnv].stats.time += this.environments[testEnv].stats.time || module.timeMs;
this.environments[testEnv].stats.time += module.timeMs || this.environments[testEnv].stats.time;
swrdfish marked this conversation as resolved.
Show resolved Hide resolved
this.environments[testEnv].metadata.platformName = this.environments[testEnv].metadata.platformName || sessionCapabilities.platformName;
this.environments[testEnv].metadata.browserName = this.environments[testEnv].metadata.browserName || sessionCapabilities.browserName;
this.environments[testEnv].metadata.browserVersion = this.environments[testEnv].metadata.browserVersion || sessionCapabilities.browserVersion;
Expand All @@ -121,12 +121,15 @@ class HtmlReporter extends BaseReporter {
}

aggregateStats() {
const startTime = new Date(this.results.startTimestamp).getTime();
const endTime = new Date(this.results.endTimestamp).getTime();

const stats = {
total: 0,
passed: 0,
failed: 0,
skipped: 0,
time: 0
time: endTime - startTime
};

for (const envName of Object.keys(this.environments)) {
Expand All @@ -136,7 +139,6 @@ class HtmlReporter extends BaseReporter {
stats.failed += env.stats.failed;
stats.skipped += env.stats.skipped;
stats.total += env.stats.total;
stats.time += env.stats.time || 0;
}

return stats;
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@nightwatch/chai": "5.0.2",
"@nightwatch/html-reporter-template": "0.2.0",
"@nightwatch/html-reporter-template": "0.2.1",
"@nightwatch/nightwatch-inspector": "^1.0.1",
"ansi-to-html": "0.7.2",
"aria-query": "^5.1.3",
Expand Down
Loading