@@ -11,6 +11,9 @@ import {fs} from 'mz';
1111import * as firefox from '../../../src/firefox/index.js' ;
1212import { onlyInstancesOf , UsageError , WebExtError } from '../../../src/errors.js' ;
1313import { withTempDir } from '../../../src/util/temp-dir.js' ;
14+ import {
15+ consoleStream , // instance is imported to inspect logged messages
16+ } from '../../../src/util/logger.js' ;
1417import {
1518 basicManifest ,
1619 fixturePath ,
@@ -240,6 +243,41 @@ describe('firefox', () => {
240243 } ) ;
241244 } ) ;
242245
246+ it ( 'logs link to debugging docs' , async ( ) => {
247+ const runner = createFakeFxRunner ( ) ;
248+ consoleStream . flushCapturedLogs ( ) ;
249+ consoleStream . startCapturing ( ) ;
250+
251+ const expectedMessage = 'More info about WebExtensions debugging:' ;
252+ const expectedURLToDocs =
253+ 'https://extensionworkshop.com/documentation/develop/debugging/' ;
254+ await runFirefox ( { fxRunner : runner , devtools : false } ) ;
255+ assert . notOk ( consoleStream . capturedMessages . find (
256+ ( msg ) => msg . includes ( expectedMessage )
257+ ) ) ;
258+ assert . notOk ( consoleStream . capturedMessages . find (
259+ ( msg ) => msg . includes ( expectedURLToDocs )
260+ ) ) ;
261+
262+ consoleStream . flushCapturedLogs ( ) ;
263+
264+ await runFirefox ( { fxRunner : runner , devtools : true } ) ;
265+ const foundMessage = consoleStream . capturedMessages . find (
266+ ( msg ) => msg . includes ( expectedMessage )
267+ ) ;
268+ const foundDocURL = consoleStream . capturedMessages . find (
269+ ( msg ) => msg . includes ( expectedURLToDocs )
270+ ) ;
271+
272+ // Expect the logs to be found.
273+ assert . ok ( foundMessage ) ;
274+ assert . ok ( foundDocURL ) ;
275+
276+ // Expected to be emitted as info level logs.
277+ assert . ok ( foundMessage ?. includes ( '[info]' ) ) ;
278+ assert . ok ( foundDocURL ?. includes ( '[info]' ) ) ;
279+ } ) ;
280+
243281 } ) ;
244282
245283 describe ( 'copyProfile' , ( ) => {
@@ -1003,7 +1041,6 @@ describe('firefox', () => {
10031041 sinon . assert . calledOnce ( fakeAsyncFsStat ) ;
10041042 }
10051043 ) ) ;
1006-
10071044 } ) ;
10081045
10091046} ) ;
0 commit comments