Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit 8b2d180

Browse files
radelmannaddaleax
authored andcommitted
async_hooks: replace concat w template literals
updated test/async-hooks/init-hooks.js PR-URL: nodejs/node#15968 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c498448 commit 8b2d180

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

test/async-hooks/init-hooks.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,52 @@ class ActivityCollector {
6565
}
6666

6767
const violations = [];
68+
let tempActivityString;
69+
6870
function v(msg) { violations.push(msg); }
6971
for (const a of this._activities.values()) {
72+
tempActivityString = activityString(a);
7073
if (types != null && !types.includes(a.type)) continue;
7174

7275
if (a.init && a.init.length > 1) {
73-
v('Activity inited twice\n' + activityString(a) +
76+
v(`Activity inited twice\n${tempActivityString}` +
7477
'\nExpected "init" to be called at most once');
7578
}
7679
if (a.destroy && a.destroy.length > 1) {
77-
v('Activity destroyed twice\n' + activityString(a) +
80+
v(`Activity destroyed twice\n${tempActivityString}` +
7881
'\nExpected "destroy" to be called at most once');
7982
}
8083
if (a.before && a.after) {
8184
if (a.before.length < a.after.length) {
8285
v('Activity called "after" without calling "before"\n' +
83-
activityString(a) +
86+
`${tempActivityString}` +
8487
'\nExpected no "after" call without a "before"');
8588
}
8689
if (a.before.some((x, idx) => x > a.after[idx])) {
8790
v('Activity had an instance where "after" ' +
8891
'was invoked before "before"\n' +
89-
activityString(a) +
92+
`${tempActivityString}` +
9093
'\nExpected "after" to be called after "before"');
9194
}
9295
}
9396
if (a.before && a.destroy) {
9497
if (a.before.some((x, idx) => x > a.destroy[idx])) {
9598
v('Activity had an instance where "destroy" ' +
9699
'was invoked before "before"\n' +
97-
activityString(a) +
100+
`${tempActivityString}` +
98101
'\nExpected "destroy" to be called after "before"');
99102
}
100103
}
101104
if (a.after && a.destroy) {
102105
if (a.after.some((x, idx) => x > a.destroy[idx])) {
103106
v('Activity had an instance where "destroy" ' +
104107
'was invoked before "after"\n' +
105-
activityString(a) +
108+
`${tempActivityString}` +
106109
'\nExpected "destroy" to be called after "after"');
107110
}
108111
}
109112
if (!a.handleIsObject) {
110-
v('No resource object\n' + activityString(a) +
113+
v(`No resource object\n${tempActivityString}` +
111114
'\nExpected "init" to be called with a resource object');
112115
}
113116
}
@@ -125,7 +128,7 @@ class ActivityCollector {
125128
Array.from(this._activities.values()) :
126129
this.activitiesOfTypes(types);
127130

128-
if (stage != null) console.log('\n%s', stage);
131+
if (stage != null) console.log(`\n${stage}`);
129132
console.log(util.inspect(activities, false, depth, true));
130133
}
131134

@@ -206,7 +209,7 @@ class ActivityCollector {
206209
_maybeLog(uid, type, name) {
207210
if (this._logid &&
208211
(type == null || this._logtype == null || this._logtype === type)) {
209-
print(this._logid + '.' + name + '.uid-' + uid);
212+
print(`${this._logid}.${name}.uid-${uid}`);
210213
}
211214
}
212215
}

0 commit comments

Comments
 (0)