@@ -9,7 +9,7 @@ const { TextMessage, User } = require('../index.js')
99const path = require ( 'node:path' )
1010
1111describe ( 'Running bin/hubot.js' , ( ) => {
12- it ( 'should load adapter from HUBOT_FILE environment variable' , async function ( ) {
12+ it ( 'should load adapter from HUBOT_FILE environment variable' , async ( ) => {
1313 process . env . HUBOT_HTTPD = 'false'
1414 process . env . HUBOT_FILE = path . resolve ( root , 'test' , 'fixtures' , 'MockAdapter.mjs' )
1515 const hubot = require ( '../bin/hubot.js' )
@@ -31,4 +31,32 @@ describe('Running bin/hubot.js', () => {
3131 hubot . shutdown ( )
3232 }
3333 } )
34+ const { spawn } = require ( 'child_process' )
35+
36+ it ( 'should output a help message when run with --help' , ( t , done ) => {
37+ const hubot = spawn ( './bin/hubot' , [ '--help' ] )
38+ const expected = `Usage: hubot [options]
39+ -a, --adapter HUBOT_ADAPTER
40+ -f, --file HUBOT_FILE
41+ -c, --create HUBOT_CREATE
42+ -d, --disable-httpd HUBOT_HTTPD
43+ -h, --help
44+ -l, --alias HUBOT_ALIAS
45+ -n, --name HUBOT_NAME
46+ -r, --require PATH
47+ -t, --config-check
48+ -v, --version
49+ `
50+ let actual = ''
51+ hubot . stdout . on ( 'data' , ( data ) => {
52+ actual += data . toString ( )
53+ } )
54+ hubot . stderr . on ( 'data' , ( data ) => {
55+ actual += data . toString ( )
56+ } )
57+ hubot . on ( 'close' , ( code ) => {
58+ assert . deepEqual ( actual , expected )
59+ done ( )
60+ } )
61+ } )
3462} )
0 commit comments