Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

Commit

Permalink
Merge f6c9909 into 8ba0494
Browse files Browse the repository at this point in the history
  • Loading branch information
benansell committed May 19, 2019
2 parents 8ba0494 + f6c9909 commit 7901f0d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js

node_js:
- "6"
- "8"
- "10"
- "12"

cache:
directories:
Expand All @@ -12,6 +12,7 @@ cache:
os:
- osx
- linux
- windows

before_install:
- node --version
Expand Down
7 changes: 4 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
environment:
matrix:
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "12"


cache:
- '%APPDATA%\elm\0.19.0\package'
Expand All @@ -15,7 +16,7 @@ matrix:

init:
# report build worker details
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
# update node version
Expand All @@ -35,7 +36,7 @@ test_script:

on_finish:
# pause before completion when $blockRdp is true
#- ps: $blockRdp = $false;
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

# upload unit test results
- ps: |
Expand Down
5 changes: 3 additions & 2 deletions lib/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class AnalyzerImp implements Analyzer {

const maxPathDepth = _.max(items.map(x => this.toPathDepth(x.moduleName)))!;
const maxLabelLength = _.max(items.map(x => !x.moduleName ? 0 : x.moduleName.length))!;
const maxLineNumberLength = _.max(items.map(x => x.node.start.lineNumber))!;
const maxLineNumberLength = _.max(items.map(x => x.node.start.lineNumber.toString().length))!;

return _.sortBy(items, (x: AnalyzedTestFunctionNode) => this.toSortKey(maxPathDepth, maxLabelLength, maxLineNumberLength, x));
}
Expand Down Expand Up @@ -349,9 +349,10 @@ export class AnalyzerImp implements Analyzer {
moduleName = this.util.padRight(item.moduleName, maxLabelLength);
}

const location = this.util.padRight(item.node.start.lineNumber.toString(), maxLineNumberLength);
const location = _.padStart(item.node.start.lineNumber.toString(), maxLineNumberLength);

return pathDepth + moduleName + location;

}

public toNameAndStartLocation(appDirectory: string, filePath: string, functionNode: AnalyzedTestFunctionNode): string {
Expand Down
7 changes: 4 additions & 3 deletions test/unit/lib/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1234,15 +1234,16 @@ describe("lib analyzer", () => {
<AnalyzedTestFunctionNode> {moduleName: "bar", node: {start: {lineNumber: 123}}},
<AnalyzedTestFunctionNode> {moduleName: "bar", node: {start: {lineNumber: 4}}}
];
mockUtil.padRight = _.padEnd;

// act
const actual = analyzerImp.sortItemsByLabel(items);

// assert
expect(actual.length).to.equal(3);
expect(actual[0]).to.equal(items[2]);
expect(actual[1]).to.equal(items[1]);
expect(actual[2]).to.equal(items[0]);
expect(actual[1]).to.equal(items[0]);
expect(actual[2]).to.equal(items[1]);
});
});

Expand Down Expand Up @@ -1393,7 +1394,7 @@ describe("lib analyzer", () => {
mockPadRight.returns("baz");

// act
const actual = analyzerImp.toSortKey(12, 34, 56, functionNode);
const actual = analyzerImp.toSortKey(12, 34, 3, functionNode);

// assert
expect(actual).to.equal("78baz456");
Expand Down

0 comments on commit 7901f0d

Please sign in to comment.