Skip to content

Commit 224f10f

Browse files
committed
For...of: replace with forEach
1 parent 089362e commit 224f10f

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

lib/adapters/JasmineAdapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class JasmineAdapter extends EventEmitter {
7676
var childSuites = []
7777
var tests = []
7878

79-
for (let child of jasmineSuite.children) {
79+
jasmineSuite.children.forEach((child) => {
8080
if (child.id.indexOf('suite') === 0) {
8181
childSuites.push(this.createGlobalSuite(child))
8282
} else {
@@ -96,7 +96,7 @@ export default class JasmineAdapter extends EventEmitter {
9696
tests.push(test)
9797
this.tests[child.id] = test
9898
}
99-
}
99+
})
100100

101101
let name = (this.isJasmineGlobalSuite(jasmineSuite)) ? undefined
102102
: jasmineSuite.description

lib/adapters/QUnitAdapter.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export default class QUnitAdapter extends EventEmitter {
6565
globalSuite.name = undefined
6666

6767
// The suiteName of global tests must be undefined.
68-
for (let test of globalSuite.tests) {
68+
globalSuite.tests.forEach(function (test) {
6969
test.suiteName = undefined
70-
}
70+
})
7171

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

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

106-
for (let parentSuite of suites) {
106+
suites.forEach(function (parentSuite) {
107107
if (parentSuite.name === parentSuiteName) {
108108
parentSuite.childSuites.push(suite)
109109
}
110-
}
110+
})
111111
} else {
112112
topLevelSuites.push(suite)
113113
}
114-
}
114+
})
115115

116116
globalSuite.childSuites = topLevelSuites
117117

@@ -144,16 +144,16 @@ export default class QUnitAdapter extends EventEmitter {
144144
}
145145

146146
emitData (suite) {
147-
for (let test of suite.tests) {
147+
suite.tests.forEach((test) => {
148148
this.emit('testStart', this.createTestStart(test))
149149
this.emit('testEnd', this.createTestEnd(test))
150-
}
150+
})
151151

152-
for (let suite of suite.childSuites) {
153-
this.emit('suiteStart', this.createSuiteStart(suite))
154-
this.emitData(suite)
155-
this.emit('suiteEnd', this.createSuiteEnd(suite))
156-
}
152+
suite.childSuites.forEach((childSuite) => {
153+
this.emit('suiteStart', this.createSuiteStart(childSuite))
154+
this.emitData(childSuite)
155+
this.emit('suiteEnd', this.createSuiteEnd(childSuite))
156+
})
157157
}
158158

159159
onBegin () {

lib/reporters/TapReporter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export default class TapReporter {
2727
} else {
2828
console.log(`not ok ${this.testCount} ${test.testName}`)
2929

30-
for (let error of test.errors) {
30+
test.errors.forEach(function (error) {
3131
console.log(' ---')
3232
console.log(` message: "${error.toString()}"`)
3333
console.log(' severity: failed')
3434
console.log(' ...')
35-
}
35+
})
3636
}
3737
}
3838

0 commit comments

Comments
 (0)