Skip to content

Commit

Permalink
Fix index file path and title mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Taha Paksu committed Mar 2, 2020
1 parent a06706a commit 975e625
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ In lieu of a formal styleguide take care to maintain the existing coding style.
* 0.1.0 - added more source line definitions such as "@file?id:line:pos" and " at Anonymous function (file?id:line:pos) for parsing,
- added folder separation by browser type,
- fixed some exceptions
* 0.1.1 - fixed index file title and path mismatch
## Author
Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* karma-code-reporter v0.1.0
* karma-code-reporter v0.1.1
*
* Copyright 2017 Taha PAKSU
*
Expand Down Expand Up @@ -37,8 +37,6 @@ var codeReporter = function (baseReporterDecorator, config, logger, helper, form
var basePath = __dirname;
/* created files array */
var createdFiles = [];
/* created file titles array */
var fileTitles = [];

/**
* Event triggered when browsers are ready and execution starts
Expand Down Expand Up @@ -115,8 +113,10 @@ var codeReporter = function (baseReporterDecorator, config, logger, helper, form
// create file
this.createFile(outputFilename, html);
// push the created file path and title to an array for building the index page
createdFiles.push(outputFilename);
fileTitles.push(failedSpecList[i].browser.name + " - " + failedSpecList[i].result.description);
createdFiles.push({
title: failedSpecList[i].browser.name + " - " + failedSpecList[i].result.description,
path: outputFilename
});
}
}
}
Expand Down Expand Up @@ -177,9 +177,9 @@ var codeReporter = function (baseReporterDecorator, config, logger, helper, form
// append the list
html += "<div class='col-md-12'><ul class='spec_list_ul'>";
// for each file created
fileTitles.sort((a,b) => a >= b ? 1 : -1).forEach(function (value, index) {
createdFiles.sort((a,b) => a.title >= b.title ? 1 : -1).forEach(function (value) {
// append the file title and link it to the file path
html += "<li><a href='" + url.pathToFileURL(path.resolve(config.basePath + path.sep + createdFiles[index])) + "'>" + fileTitles[index] + "</a></li>";
html += "<li><a href='" + url.pathToFileURL(path.resolve(config.basePath + path.sep + value.path)) + "'>" + value.title + "</a></li>";
});
// close the document
html += "</ul></div></div></div></body></html>";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "karma-code-reporter",
"version": "0.1.0",
"version": "0.1.1",
"description": "A Karma failed test examples creator module/plugin",
"main": "index.js",
"homepage": "https://github.com/tpaksu/karma-code-reporter",
Expand Down

0 comments on commit 975e625

Please sign in to comment.