hubot 3.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/robot.js +5 -2
- package/test/robot_test.js +14 -4
- package/.node-version +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hubot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"author": "hubot",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"connect-multiparty": "^2.2.0",
|
|
22
22
|
"express": "^4.18.2",
|
|
23
23
|
"express-basic-auth": "^1.2.1",
|
|
24
|
-
"log": "
|
|
24
|
+
"log": "^6.3.1",
|
|
25
|
+
"log-node": "^8.0.3",
|
|
25
26
|
"optparse": "^1.0.5"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
package/src/robot.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
require('log-node')()
|
|
2
3
|
|
|
3
4
|
const EventEmitter = require('events').EventEmitter
|
|
4
5
|
const fs = require('fs')
|
|
5
6
|
const path = require('path')
|
|
6
7
|
|
|
7
8
|
const async = require('async')
|
|
8
|
-
const
|
|
9
|
+
const log = require('log')
|
|
9
10
|
const HttpClient = require('./httpclient')
|
|
10
11
|
|
|
11
12
|
const Brain = require('./brain')
|
|
@@ -49,7 +50,9 @@ class Robot {
|
|
|
49
50
|
response: new Middleware(this),
|
|
50
51
|
receive: new Middleware(this)
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
+
process.env.LOG_LEVEL = process.env.LOG_LEVEL || process.env.HUBOT_LOG_LEVEL || 'info'
|
|
54
|
+
this.logger = log.get('robot')
|
|
55
|
+
|
|
53
56
|
this.pingIntervalId = null
|
|
54
57
|
this.globalHttpOptions = {}
|
|
55
58
|
|
package/test/robot_test.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// Assertions and Stubbing
|
|
7
7
|
const chai = require('chai')
|
|
8
8
|
const sinon = require('sinon')
|
|
9
|
+
const emitter = require('log/lib/emitter')
|
|
9
10
|
chai.use(require('sinon-chai'))
|
|
10
11
|
|
|
11
12
|
const expect = chai.expect
|
|
@@ -422,15 +423,24 @@ describe('Robot', function () {
|
|
|
422
423
|
})
|
|
423
424
|
|
|
424
425
|
it('logs a warning for a .js file', function () {
|
|
425
|
-
|
|
426
|
+
let wasCalled = false
|
|
427
|
+
const listener = e => {
|
|
428
|
+
wasCalled = e.messageTokens.some(t => t.indexOf('Expected scripts/test-script') > -1)
|
|
429
|
+
}
|
|
430
|
+
emitter.on('log', listener)
|
|
426
431
|
this.robot.loadFile('./scripts', 'test-script.js')
|
|
427
|
-
expect(
|
|
432
|
+
expect(wasCalled).to.be.true
|
|
433
|
+
emitter.off('log', listener)
|
|
428
434
|
})
|
|
429
435
|
|
|
430
436
|
it('logs a warning for a .mjs file', function () {
|
|
431
|
-
|
|
437
|
+
let wasCalled = false
|
|
438
|
+
const listener = e => {
|
|
439
|
+
wasCalled = e.messageTokens.some(t => t.indexOf('Expected scripts/test-script') > -1)
|
|
440
|
+
}
|
|
441
|
+
emitter.on('log', listener)
|
|
432
442
|
this.robot.loadFile('./scripts', 'test-script.mjs')
|
|
433
|
-
expect(
|
|
443
|
+
expect(wasCalled).to.be.true
|
|
434
444
|
})
|
|
435
445
|
})
|
|
436
446
|
|
package/.node-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
18.16.0
|