Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the log grouping #1116

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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