Skip to content

Commit

Permalink
For...of: replace with forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
flore77 committed Jul 14, 2016
1 parent 089362e commit 224f10f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions lib/adapters/JasmineAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class JasmineAdapter extends EventEmitter {
var childSuites = []
var tests = []

for (let child of jasmineSuite.children) {
jasmineSuite.children.forEach((child) => {
if (child.id.indexOf('suite') === 0) {
childSuites.push(this.createGlobalSuite(child))
} else {
Expand All @@ -96,7 +96,7 @@ export default class JasmineAdapter extends EventEmitter {
tests.push(test)
this.tests[child.id] = test
}
}
})

let name = (this.isJasmineGlobalSuite(jasmineSuite)) ? undefined
: jasmineSuite.description
Expand Down
26 changes: 13 additions & 13 deletions lib/adapters/QUnitAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export default class QUnitAdapter extends EventEmitter {
globalSuite.name = undefined

// The suiteName of global tests must be undefined.
for (let test of globalSuite.tests) {
globalSuite.tests.forEach(function (test) {
test.suiteName = undefined
}
})

modules = this.QUnit.config.modules.slice(1)
} else {
Expand All @@ -88,7 +88,7 @@ export default class QUnitAdapter extends EventEmitter {
//
// If a suite does not have a composed name, add it to the topLevelSuites,
// this means that this suite is the direct child of the global suite.
for (let suite of suites) {
suites.forEach(function (suite) {
let indexEnd = suite.name.lastIndexOf(' > ')

if (indexEnd !== -1) {
Expand All @@ -103,15 +103,15 @@ export default class QUnitAdapter extends EventEmitter {
// Keep only the name of the suite itself.
suite.name = suite.name.substring(indexEnd + 3)

for (let parentSuite of suites) {
suites.forEach(function (parentSuite) {
if (parentSuite.name === parentSuiteName) {
parentSuite.childSuites.push(suite)
}
}
})
} else {
topLevelSuites.push(suite)
}
}
})

globalSuite.childSuites = topLevelSuites

Expand Down Expand Up @@ -144,16 +144,16 @@ export default class QUnitAdapter extends EventEmitter {
}

emitData (suite) {
for (let test of suite.tests) {
suite.tests.forEach((test) => {
this.emit('testStart', this.createTestStart(test))
this.emit('testEnd', this.createTestEnd(test))
}
})

for (let suite of suite.childSuites) {
this.emit('suiteStart', this.createSuiteStart(suite))
this.emitData(suite)
this.emit('suiteEnd', this.createSuiteEnd(suite))
}
suite.childSuites.forEach((childSuite) => {
this.emit('suiteStart', this.createSuiteStart(childSuite))
this.emitData(childSuite)
this.emit('suiteEnd', this.createSuiteEnd(childSuite))
})
}

onBegin () {
Expand Down
4 changes: 2 additions & 2 deletions lib/reporters/TapReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export default class TapReporter {
} else {
console.log(`not ok ${this.testCount} ${test.testName}`)

for (let error of test.errors) {
test.errors.forEach(function (error) {
console.log(' ---')
console.log(` message: "${error.toString()}"`)
console.log(' severity: failed')
console.log(' ...')
}
})
}
}

Expand Down

0 comments on commit 224f10f

Please sign in to comment.