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

Call new on the corresponding Plugin class. #1216

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

jeffposnick
Copy link
Contributor

R: @addyosmani @gauntface
CC: @mischnic

Fixes #1215

The missing new was an oversight during the migration to using the plugins: [] property for configuring all strategy classes.

@@ -436,10 +435,10 @@ describe(`[workbox-build] entry-points/generate-sw-string.js (End to End)`, func
await validateServiceWorkerRuntime({swCode, expectedMethodCalls: {
[STRING_HANDLER]: [[{
cacheName: firstRuntimeCachingOptions.cacheName,
plugins: ['workbox.expiration.Plugin'],
plugins: [{}],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI regarding this change: we previously had a hardcoded string returned by the stubbed plugin methods in the mock environment used to make this sort of test easier to write.

Now that we're using actual classes instead of stubbed methods (to ensure that new is being called), the return value looks like a generic object. We get the same test coverage by virtue of testing the cacheableResponsePlugin and cacheExpirationPlugin spies on the following lines, though.

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

No file sizes have changed.

New Files

No new files have been added.

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.21 KB 3.21 KB 0% 1.38 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.06 KB 1.06 KB 0% 567 B
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 2.52 KB 2.52 KB 0% 1.06 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.41 KB 3.41 KB 0% 1.27 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 598 B 598 B 0% 350 B
packages/workbox-cli/build/app.js 4.57 KB 4.57 KB 0% 1.65 KB
packages/workbox-cli/build/bin.js 2.55 KB 2.55 KB 0% 1.08 KB
packages/workbox-core/build/workbox-core.prod.js 6.40 KB 6.40 KB 0% 2.54 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.07 KB 2.07 KB 0% 1.02 KB
packages/workbox-precaching/build/workbox-precaching.prod.js 5.18 KB 5.18 KB 0% 2.02 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.66 KB 1.66 KB 0% 816 B
packages/workbox-routing/build/workbox-routing.prod.js 2.77 KB 2.77 KB 0% 1.26 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 3.24 KB 3.24 KB 0% 1.01 KB
packages/workbox-sw/build/workbox-sw.js 1.46 KB 1.46 KB 0% 796 B
packages/workbox-webpack-plugin/build/generate-sw.js 5.84 KB 5.84 KB 0% 2.04 KB
packages/workbox-webpack-plugin/build/index.js 742 B 742 B 0% 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 7.95 KB 7.95 KB 0% 2.65 KB

Workbox Aggregate Size Plugin

☠️ WARNING ☠️

We are using 154% of our max size budget.

Total Size: 22.53KB
Percentage of Size Used: 154%

Gzipped: 9.02KB

@jeffposnick jeffposnick merged commit b312073 into v3 Jan 23, 2018
@jeffposnick jeffposnick deleted the proper-plugin-instantiation branch January 23, 2018 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants