Skip to content

Commit

Permalink
feature: duplicated import rule
Browse files Browse the repository at this point in the history
  • Loading branch information
dbale-altoros committed Jan 16, 2025
1 parent 9add7b5 commit 0248080
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions e2e/formatters-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ describe('e2e', function () {
const joinedFoo = foo1Output.concat(foo2Output)
let expectedLine

for (let i = 0; i < reportLines.length - 3; i++) {
for (let i = 0; i < reportLines.length - 7; i++) {
expectedLine = `${joinedFoo[i].filePath}:${joinedFoo[i].line}:${joinedFoo[i].column}: ${joinedFoo[i].message} [${joinedFoo[i].severity}/${joinedFoo[i].ruleId}]`
expect(reportLines[i]).to.equal(expectedLine)
}
// because there's an error
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)

const finalLine = '10 problem/s (1 error/s, 9 warning/s)'
expect(reportLines[reportLines.length - 2]).to.contain(finalLine)
expect(reportLines[reportLines.length - 6]).to.contain(finalLine)
})
})

Expand Down Expand Up @@ -198,14 +198,14 @@ describe('e2e', function () {
const reportLines = stdout.split('\n')
let expectedLine

for (let i = 0; i < reportLines.length - 3; i++) {
for (let i = 0; i < reportLines.length - 7; i++) {
expectedLine = `${foo2Output[i].filePath}: line ${foo2Output[i].line}, col ${foo2Output[i].column}, ${foo2Output[i].severity} - ${foo2Output[i].message} (${foo2Output[i].ruleId})`
expect(reportLines[i]).to.equal(expectedLine)
}
expect(code).to.equal(EXIT_CODES.OK)

const finalLine = '3 problem/s (3 warning/s)'
expect(reportLines[reportLines.length - 2]).to.equal(finalLine)
expect(reportLines[reportLines.length - 6]).to.equal(finalLine)
})
it('should make the output report with compact formatter for Foo and Foo2 and Foo3', () => {
const { code, stdout } = shell.exec(
Expand All @@ -216,15 +216,15 @@ describe('e2e', function () {
const joinedFoo = foo1Output.concat(foo2Output)
let expectedLine

for (let i = 0; i < reportLines.length - 3; i++) {
for (let i = 0; i < reportLines.length - 7; i++) {
expectedLine = `${joinedFoo[i].filePath}: line ${joinedFoo[i].line}, col ${joinedFoo[i].column}, ${joinedFoo[i].severity} - ${joinedFoo[i].message} (${joinedFoo[i].ruleId})`
expect(reportLines[i]).to.equal(expectedLine)
}
// because there's an error
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)

const finalLine = '10 problem/s (1 error/s, 9 warning/s)'
expect(reportLines[reportLines.length - 2]).to.contain(finalLine)
expect(reportLines[reportLines.length - 6]).to.contain(finalLine)
})
})

Expand Down Expand Up @@ -256,7 +256,7 @@ describe('e2e', function () {
let expectedLine = foo2Output[0].filePath
expect(reportLines[1]).to.equal(expectedLine)

for (let i = 2; i < reportLines.length - 4; i++) {
for (let i = 2; i < reportLines.length - 8; i++) {
expectedLine = ` ${foo2Output[i - 2].line}:${foo2Output[i - 2].column} ${foo2Output[
i - 2
].severity.toLowerCase()} ${foo2Output[i - 2].message} ${foo2Output[i - 2].ruleId}`
Expand All @@ -266,7 +266,7 @@ describe('e2e', function () {
expect(code).to.equal(EXIT_CODES.OK)

const finalLine = '\u2716 3 problems (0 errors, 3 warnings)'
expect(reportLines[reportLines.length - 3]).to.equal(finalLine)
expect(reportLines[reportLines.length - 7]).to.equal(finalLine)
})
it('should make the output report with stylish formatter for Foo and Foo2 and Foo3', () => {
const { code, stdout } = shell.exec(
Expand All @@ -286,7 +286,7 @@ describe('e2e', function () {
reportLines.splice(9, 2)
reportLines.splice(1, 1)

for (let i = 1; i < reportLines.length - 4; i++) {
for (let i = 1; i < reportLines.length - 8; i++) {
expectedLine = ` ${joinedFoo[i - 1].line}:${joinedFoo[i - 1].column} ${joinedFoo[
i - 1
].severity.toLowerCase()} ${joinedFoo[i - 1].message} ${joinedFoo[i - 1].ruleId}`
Expand All @@ -296,7 +296,7 @@ describe('e2e', function () {
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)

const finalLine = '\u2716 10 problems (1 error, 9 warnings)'
expect(reportLines[reportLines.length - 3]).to.equal(finalLine)
expect(reportLines[reportLines.length - 7]).to.equal(finalLine)
})
})

Expand Down

0 comments on commit 0248080

Please sign in to comment.