Skip to content

Commit 6eb6570

Browse files
committed
more es5 conversion
1 parent 248e2d1 commit 6eb6570

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

lib/views/cpu-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function CpuView(options) {
1212
this.line = contrib.line({
1313
label: " cpu utilization ",
1414
border: {
15-
type: "line"
15+
type: "line"
1616
},
1717
style: {
1818
line: "yellow",

test/app/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ require("../../index");
55

66
var _ = require("lodash");
77

8-
var slowFunc = (count) => {
8+
var slowFunc = function (count) {
99
var begin = Date.now();
1010

11-
let values = _.times(count, () => _.random(0, count));
11+
var values = _.times(count, _.random(0, count));
1212
values = _.sortBy(values);
1313

1414
return Date.now() - begin;
@@ -17,25 +17,25 @@ var slowFunc = (count) => {
1717

1818
var bigBuffer = new Buffer(200000000);
1919

20-
let count = 1;
21-
setInterval(() => {
22-
console.log(`Reporting from a test app, ${count}.`);
20+
var count = 1;
21+
setInterval(function () {
22+
console.log("Reporting from a test app, %d.", count);
2323
count++;
2424
}, 1000);
2525

26-
setInterval(() => {
26+
setInterval(function () {
2727
console.log("Slow call started...");
2828
var duration = slowFunc(_.random(1000,100000));
2929
console.log("Completed in: ", duration);
3030
}, 3000);
3131

32-
setInterval(() => {
32+
setInterval(function () {
3333
console.log("Filling buffer...");
3434
bigBuffer.fill(2);
3535
}, 5000);
3636

3737

3838

39-
setInterval(() => {
39+
setInterval(function () {
4040
console.error("bummer shoulda read the dox :(", new Error().stack);
4141
}, 5000);

test/lib/dashboard-agent.spec.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,61 @@ var config = require("../../lib/config");
88
var dashboardAgent = require("../../lib/dashboard-agent");
99
var pusage = require("pidusage");
1010

11-
describe("dashboard-agent", () => {
11+
describe("dashboard-agent", function () {
1212

13-
let server;
14-
let agent;
13+
var server;
14+
var agent;
1515
var TEST_PORT = 12345;
1616
var REPORTING_THRESHOLD = 1500;
1717

18-
before(() => {
18+
before(function () {
1919
process.env[config.PORT_KEY] = TEST_PORT;
2020
process.env[config.BLOCKED_THRESHOLD_KEY] = 1;
2121
});
2222

23-
beforeEach(() => {
23+
beforeEach(function () {
2424
agent = dashboardAgent();
2525
server = new SocketIO(TEST_PORT);
2626
});
2727

28-
afterEach(() => {
28+
afterEach(function () {
2929
server.close();
3030
agent.destroy();
3131
});
3232

33-
describe("initialization", () => {
34-
let clock;
35-
before(() => {
33+
describe("initialization", function () {
34+
var clock;
35+
before(function () {
3636
clock = sinon.useFakeTimers();
3737
});
3838

39-
after(() => {
39+
after(function () {
4040
clock.restore();
4141
});
4242

43-
it("should use environment variables for configuration", (done) => {
44-
var checkMetrics = (metrics) => {
43+
it("should use environment variables for configuration", function (done) {
44+
var checkMetrics = function (metrics) {
4545
expect(metrics).to.be.exist;
4646
expect(metrics.eventLoop.delay).to.equal(0);
4747
};
4848

4949
clock.tick(REPORTING_THRESHOLD);
5050

51-
server.on("connection", (socket) => {
51+
server.on("connection", function (socket) {
5252
expect(socket).to.be.defined;
5353
socket.on("error", done);
54-
socket.on("metrics", (data) => { //eslint-disable-line max-nested-callbacks
54+
socket.on("metrics", function (data) { //eslint-disable-line max-nested-callbacks
5555
checkMetrics(JSON.parse(data));
5656
done();
5757
});
5858
});
5959
});
6060
});
6161

62-
describe("reporting", () => {
63-
it("should provide basic metrics", (done) => {
62+
describe("reporting", function () {
63+
it("should provide basic metrics", function (done) {
6464

65-
var checkMetrics = (metrics) => {
65+
var checkMetrics = function (metrics) {
6666
expect(metrics).to.be.defined;
6767
expect(metrics.eventLoop).to.deep.equal({ delay: 0, high: 0 });
6868
expect(metrics.mem).to.exist;
@@ -73,39 +73,39 @@ describe("dashboard-agent", () => {
7373
expect(metrics.cpu.utilization).to.be.above(0);
7474
};
7575

76-
agent._getStats((err, metrics) => {
76+
agent._getStats(function (err, metrics) {
7777
expect(err).to.be.null;
7878
checkMetrics(metrics);
7979
done();
8080
});
8181
});
8282

83-
it("should report an event loop delay and cpu stats", (done) => {
83+
it("should report an event loop delay and cpu stats", function (done) {
8484
var delay = { current: 100, max: 150 };
8585
var pusageResults = { cpu: 50 };
8686
var pidStub = sinon.stub(pusage, "stat").yields(null, pusageResults);
8787

8888
agent._delayed(delay.max);
8989
agent._delayed(delay.current);
9090

91-
var checkMetrics = (metrics) => {
91+
var checkMetrics = function (metrics) {
9292
expect(metrics.eventLoop.delay).to.equal(delay.current);
9393
expect(metrics.eventLoop.high).to.be.equal(delay.max);
9494
expect(metrics.cpu.utilization).to.equal(pusageResults.cpu);
9595
};
9696

97-
agent._getStats((err, metrics) => {
97+
agent._getStats(function (err, metrics) {
9898
expect(err).to.be.null;
9999
checkMetrics(metrics);
100100
pidStub.restore();
101101
done();
102102
});
103103
});
104104

105-
it("should return an error when pusage fails", (done) => {
105+
it("should return an error when pusage fails", function (done) {
106106
var pidStub = sinon.stub(pusage, "stat").yields(new Error("bad error"));
107107

108-
agent._getStats((err, metrics) => {
108+
agent._getStats(function (err, metrics) {
109109
expect(err).to.exist;
110110
expect(metrics).to.be.undefined;
111111
expect(err.message).to.equal("bad error");

0 commit comments

Comments
 (0)