diff --git a/aio/content/guide/service-worker-devops.md b/aio/content/guide/service-worker-devops.md index f216b253fa..d9f5d73968 100644 --- a/aio/content/guide/service-worker-devops.md +++ b/aio/content/guide/service-worker-devops.md @@ -171,6 +171,7 @@ is `ngsw/state`. Here is an example of this debug page's contents: ``` NGSW Debug Info: +Driver version: 13.3.7 Driver state: NORMAL ((nominal)) Latest manifest hash: eea7f5f464f90789b621170af5a569d6be077e5c Last update check: never diff --git a/packages/service-worker/worker/src/debug.ts b/packages/service-worker/worker/src/debug.ts index 20fa8b1199..80b4b575fd 100644 --- a/packages/service-worker/worker/src/debug.ts +++ b/packages/service-worker/worker/src/debug.ts @@ -9,6 +9,7 @@ import {Adapter} from './adapter'; import {Debuggable, DebugLogger} from './api'; +const SW_VERSION = '0.0.0-PLACEHOLDER'; const DEBUG_LOG_BUFFER_SIZE = 100; interface DebugMessage { @@ -37,6 +38,7 @@ export class DebugHandler implements DebugLogger { const msgState = `NGSW Debug Info: +Driver version: ${SW_VERSION} Driver state: ${state.state} (${state.why}) Latest manifest hash: ${state.latestHash || 'none'} Last update check: ${this.since(state.lastUpdateCheck)}`; diff --git a/packages/service-worker/worker/test/happy_spec.ts b/packages/service-worker/worker/test/happy_spec.ts index 8abef97725..881f7159f7 100644 --- a/packages/service-worker/worker/test/happy_spec.ts +++ b/packages/service-worker/worker/test/happy_spec.ts @@ -1237,19 +1237,19 @@ describe('Driver', () => { describe('serving ngsw/state', () => { it('should show debug info (when in NORMAL state)', async () => { expect(await makeRequest(scope, '/ngsw/state')) - .toMatch(/^NGSW Debug Info:\n\nDriver state: NORMAL/); + .toMatch(/^NGSW Debug Info:\n\nDriver version: .+\nDriver state: NORMAL/); }); it('should show debug info (when in EXISTING_CLIENTS_ONLY state)', async () => { driver.state = DriverReadyState.EXISTING_CLIENTS_ONLY; expect(await makeRequest(scope, '/ngsw/state')) - .toMatch(/^NGSW Debug Info:\n\nDriver state: EXISTING_CLIENTS_ONLY/); + .toMatch(/^NGSW Debug Info:\n\nDriver version: .+\nDriver state: EXISTING_CLIENTS_ONLY/); }); it('should show debug info (when in SAFE_MODE state)', async () => { driver.state = DriverReadyState.SAFE_MODE; expect(await makeRequest(scope, '/ngsw/state')) - .toMatch(/^NGSW Debug Info:\n\nDriver state: SAFE_MODE/); + .toMatch(/^NGSW Debug Info:\n\nDriver version: .+\nDriver state: SAFE_MODE/); }); it('should show debug info when the scope is not root', async () => { @@ -1258,7 +1258,7 @@ describe('Driver', () => { new Driver(newScope, newScope, new CacheDatabase(newScope, newScope)); expect(await makeRequest(newScope, '/foo/bar/ngsw/state')) - .toMatch(/^NGSW Debug Info:\n\nDriver state: NORMAL/); + .toMatch(/^NGSW Debug Info:\n\nDriver version: .+\nDriver state: NORMAL/); }); });