mirror of
https://github.com/dorny/test-reporter.git
synced 2026-03-22 07:52:14 +01:00
Use String.substring() function instead of the deprecated String.substr()
This commit is contained in:
parent
ff2d13cc36
commit
17c900ba4e
9 changed files with 12 additions and 12 deletions
|
|
@ -242,13 +242,13 @@ export class DartJsonParser implements TestParser {
|
|||
private getRelativePath(path: string): string {
|
||||
const prefix = 'file://'
|
||||
if (path.startsWith(prefix)) {
|
||||
path = path.substr(prefix.length)
|
||||
path = path.substring(prefix.length)
|
||||
}
|
||||
|
||||
path = normalizeFilePath(path)
|
||||
const workDir = this.getWorkDir(path)
|
||||
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||
path = path.substr(workDir.length)
|
||||
path = path.substring(workDir.length)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ export class DotnetNunitParser implements TestParser {
|
|||
path = normalizeFilePath(path)
|
||||
const workDir = this.getWorkDir(path)
|
||||
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||
path = path.substr(workDir.length)
|
||||
path = path.substring(workDir.length)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ export class DotnetTrxParser implements TestParser {
|
|||
const resultTestName = r.result.$.testName
|
||||
const testName =
|
||||
resultTestName.startsWith(className) && resultTestName[className.length] === '.'
|
||||
? resultTestName.substr(className.length + 1)
|
||||
? resultTestName.substring(className.length + 1)
|
||||
: resultTestName
|
||||
|
||||
const test = new Test(testName, r.result.$.outcome, duration, error)
|
||||
|
|
@ -177,7 +177,7 @@ export class DotnetTrxParser implements TestParser {
|
|||
const filePath = normalizeFilePath(fileStr)
|
||||
const workDir = this.getWorkDir(filePath)
|
||||
if (workDir) {
|
||||
const file = filePath.substr(workDir.length)
|
||||
const file = filePath.substring(workDir.length)
|
||||
if (trackedFiles.includes(file)) {
|
||||
const line = parseInt(lineStr)
|
||||
return {path: file, line}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ export class JestJunitParser implements TestParser {
|
|||
path = normalizeFilePath(path)
|
||||
const workDir = this.getWorkDir(path)
|
||||
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||
path = path.substr(workDir.length)
|
||||
path = path.substring(workDir.length)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export class MochaJsonParser implements TestParser {
|
|||
private processTest(suite: TestSuiteResult, test: MochaJsonTest, result: TestExecutionResult): void {
|
||||
const groupName =
|
||||
test.fullTitle !== test.title
|
||||
? test.fullTitle.substr(0, test.fullTitle.length - test.title.length).trimEnd()
|
||||
? test.fullTitle.substring(0, test.fullTitle.length - test.title.length).trimEnd()
|
||||
: null
|
||||
|
||||
let group = suite.groups.find(grp => grp.name === groupName)
|
||||
|
|
@ -103,7 +103,7 @@ export class MochaJsonParser implements TestParser {
|
|||
path = normalizeFilePath(path)
|
||||
const workDir = this.getWorkDir(path)
|
||||
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||
path = path.substr(workDir.length)
|
||||
path = path.substring(workDir.length)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export class PhpunitJunitParser implements TestParser {
|
|||
path = normalizeFilePath(path)
|
||||
const workDir = this.getWorkDir(path)
|
||||
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||
path = path.substr(workDir.length)
|
||||
path = path.substring(workDir.length)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export class RspecJsonParser implements TestParser {
|
|||
private processTest(suite: TestSuiteResult, test: RspecExample, result: TestExecutionResult): void {
|
||||
const groupName =
|
||||
test.full_description !== test.description
|
||||
? test.full_description.substr(0, test.full_description.length - test.description.length).trimEnd()
|
||||
? test.full_description.substring(0, test.full_description.length - test.description.length).trimEnd()
|
||||
: null
|
||||
|
||||
let group = suite.groups.find(grp => grp.name === groupName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue