Files
workbox/test/workbox-build/node/dependency-check.js
T
cb618332d2 Migrate workbox-build to TypeScript (#2867)
* WIP

* Finished getManifest

* GenerateSW migrated

* Getting there

* WIP

* Runtime caching TS

* More WIP

* More WIP

* Validation, type fixes

* Builds!

* No default exports

* null support in optional strings

* Accept string or buffer again

* Fix JSDocs

* CanIUse update

* test/additional-manifest-entries-transform

* lib/bundle

* cdnUtils test

* Switched to esModuleInterop

* Still WIP

* get-file-size migration

* get-string-details test migration

* A few more

* populateSWTemplate changes

* A few more

* validate options

* Update ts-auto-guard

* Fix dependency-check

* Swapped the exports

* JSON Schema + ajv

* TS 4.1.5

* Getting closer to validation

* Some default logic

* Switched default quotes

* Cleanup optional types

* Figuring out errors

* Refactor

* Update validate-options test

* Started integration test migration

* Remove joi schema

* Fixed some swDest logic

* Closer to webpack tests working

* Fix transformManifest usage

* Use a copy of the exclude array

* More include/exclude fun

* swDest default fix

* Function support?

* modifyURLPrefix workaround

* Fix an import

* Improve error messages

* Fix test string

* New validation unit test

* getManifest working

* Working through generateSW

* Function massaging

* Cleanup of exclude/include

* Fix a few more gSW tests

* RouteMatchCallback function

* Expiration w/cacheName check

* Optional globDirectory

* InjectManifest tests

* Test cleanup

* Fix a test

* Fix a config modification

* v5 injectmanifest test

* esModuleInterop support

* Fixes for proxied build

* Final tweaks

* Linting

* Automated linting fixes

* Tweak linting rules

* Update packages/workbox-build/src/lib/get-file-details.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update test/workbox-build/node/generate-sw.js

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/additional-manifest-entries-transform.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/additional-manifest-entries-transform.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/cdn-utils.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/get-file-manifest-entries.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/stringify-without-comments.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/validate-options.ts

Co-authored-by: Adriana Jara <[email protected]>

* Update packages/workbox-build/src/lib/additional-manifest-entries-transform.ts

Co-authored-by: Adriana Jara <[email protected]>

Co-authored-by: Adriana Jara <[email protected]>
2021-06-17 09:41:49 -04:00

70 lines
2.3 KiB
JavaScript

/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const upath = require('upath');
const depcheck = require('depcheck');
describe(`[workbox-build] Test Dependencies`, function() {
it(`should have required dependencies`, function() {
return new Promise((resolve, reject) => {
depcheck(upath.join(__dirname, '..', '..', '..', 'packages', 'workbox-build'), {
ignoreDirs: [
'test',
'build',
'demo',
],
ignoreMatches: [
'@babel/preset-env',
'@babel/runtime',
'type-fest',
'workbox-background-sync',
'workbox-broadcast-update',
'workbox-cacheable-response',
'workbox-core',
'workbox-expiration',
'workbox-google-analytics',
'workbox-navigation-preload',
'workbox-precaching',
'workbox-range-requests',
'workbox-recipes',
'workbox-routing',
'workbox-strategies',
'workbox-streams',
'workbox-sw',
'workbox-window',
],
}, (unusedDeps) => {
if (unusedDeps.dependencies.length > 0) {
return reject(new Error(`Unused dependencies defined in package.json: ${JSON.stringify(unusedDeps.dependencies)}`));
}
if (unusedDeps.devDependencies.length > 0) {
return reject(new Error(`Unused dependencies defined in package.json: ${JSON.stringify(unusedDeps.devDependencies)}`));
}
if (Object.keys(unusedDeps.missing).length > 0) {
return reject(new Error(`Dependencies missing from package.json: ${JSON.stringify(unusedDeps.missing)}`));
}
resolve();
});
});
});
it(`should have no devDependencies`, function() {
// This test exists because there have been a number of situations where
// dependencies have been used from the top level project and NOT from
// this module itself. So dependencies are checked above and devDependencies
// can be put in top level.
const pkg = require('../../../packages/workbox-build/package.json');
if (pkg.devDependencies && Object.keys(pkg.devDependencies) > 0) {
throw new Error('No devDependencies in this module.');
}
});
});