Skip to content

Commit

Permalink
Fixing the log grouping (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Gaunt authored and jeffposnick committed Dec 11, 2017
1 parent a53b3d2 commit 1e980d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';
import {fetchWrapper} from 'workbox-core/_private/fetchWrapper.mjs';
import {cacheWrapper} from 'workbox-core/_private/cacheWrapper.mjs';
import {assert} from 'workbox-core/_private/assert.mjs';
import {logger} from 'workbox-core/_private/logger.mjs';
import PrecacheEntry from '../models/PrecacheEntry.mjs';
import PrecachedDetailsModel from '../models/PrecachedDetailsModel.mjs';
import showWarningsIfNeeded from '../utils/showWarningsIfNeeded.mjs';
import openInstallLogGroup from '../utils/openInstallLogGroup.mjs';
import printInstallDetails from '../utils/printInstallDetails.mjs';
import printCleanupDetails from '../utils/printCleanupDetails.mjs';
import cleanRedirect from '../utils/cleanRedirect.mjs';
import '../_version.mjs';
Expand Down Expand Up @@ -165,17 +164,13 @@ class PrecacheController {
}
}

if (process.env.NODE_ENV !== 'production') {
openInstallLogGroup(entriesToPrecache, entriesAlreadyPrecached);
}

// Wait for all requests to be cached.
await Promise.all(entriesToPrecache.map((precacheEntry) => {
return this._cacheEntry(precacheEntry);
}));

if (process.env.NODE_ENV !== 'production') {
logger.groupEnd();
printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ export default (entriesToPrecache, alreadyPrecachedEntries) => {
_nestedGroup(
`View URLs that were already precached.`,
alreadyPrecachedEntries);
logger.groupEnd();
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {expect} from 'chai';

import {devOnly} from '../../../../infra/testing/env-it';
import {logger} from '../../../../packages/workbox-core/_private/logger.mjs';
import openInstallLogGroup from '../../../../packages/workbox-precaching/utils/openInstallLogGroup.mjs';
import printInstallDetails from '../../../../packages/workbox-precaching/utils/printInstallDetails.mjs';
import PrecacheEntry from '../../../../packages/workbox-precaching/models/PrecacheEntry.mjs';

describe(`[workbox-precaching] openInstallLogGroup`, function() {
describe(`[workbox-precaching] printInstallDetails`, function() {
let sandbox = sinon.sandbox.create();

beforeEach(function() {
Expand All @@ -19,7 +19,7 @@ describe(`[workbox-precaching] openInstallLogGroup`, function() {

devOnly.it(`should print with single update`, function() {
const precacheEntry = new PrecacheEntry({url: '/'}, '/', '/', false);
openInstallLogGroup([], [precacheEntry]);
printInstallDetails([], [precacheEntry]);

expect(logger.log.callCount).to.equal(1);
});
Expand Down

0 comments on commit 1e980d6

Please sign in to comment.