Skip to content

Commit 5b82c7a

Browse files
committed
Fix breaking tests
1 parent 794b6fd commit 5b82c7a

File tree

5 files changed

+9
-72
lines changed

5 files changed

+9
-72
lines changed

.gitignore

-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ coverage
2323
logs
2424
*.log
2525
npm-debug.log*
26-
yarn-debug.log*
27-
yarn-error.log*
2826

2927
# Dependency directories
3028
node_modules/
@@ -42,9 +40,6 @@ jspm_packages/
4240
# Output of 'npm pack'
4341
*.tgz
4442

45-
# Yarn Integrity file
46-
.yarn-integrity
47-
4843
# dotenv environment variables file
4944
.env
5045

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ Spits out some stats about webpack compilation process to a file.
1010
npm install --save-dev webpack-bundle-tracker
1111
```
1212

13-
```bash
14-
yarn add --dev webpack-bundle-tracker
15-
```
16-
1713
<br>
1814

1915
## Usage

lib/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class BundleTrackerPlugin {
5858

5959
// Set output directories
6060
this.outputChunkDir = path.resolve(get(compiler.options, 'output.path', process.cwd()));
61+
// @ts-ignore: TS2345 this.options.filename can't be undefined here because we set a default value above
6162
this.outputTrackerFile = path.resolve(this.options.filename);
6263
this.outputTrackerDir = path.dirname(this.outputTrackerFile);
6364

@@ -84,6 +85,8 @@ class BundleTrackerPlugin {
8485
* @param {string} content
8586
*/
8687
_computeIntegrity(content) {
88+
// @ts-ignore: TS2532 this.options.integrityHashes can't be undefined here because
89+
// we set a default value on _setParamsFromCompiler
8790
return this.options.integrityHashes
8891
.map(algorithm => {
8992
const hash = crypto

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@typescript-eslint/eslint-plugin": "^2.34.0",
5050
"@typescript-eslint/parser": "^2.34.0",
5151
"commitizen": "^4.2.4",
52-
"compression-webpack-plugin": "^7.1.2",
52+
"compression-webpack-plugin": "^6.1.1",
5353
"css-loader": "^3.6.0",
5454
"cz-conventional-changelog": "3.3.0",
5555
"eslint": "^6.8.0",

tests/base.test.js

+5-62
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,10 @@ describe('BundleTrackerPlugin bases tests', () => {
351351
{
352352
status: 'done',
353353
chunks: {
354-
app1: ['js/vendors.js', 'js/commons.js', 'js/app1.js'],
355-
app2: ['js/vendors.js', 'js/commons.js', 'js/app2.js'],
354+
app1: ['js/commons.js', 'js/app1.js'],
355+
app2: ['js/commons.js', 'js/app2.js'],
356356
},
357357
assets: {
358-
'js/2.js': {
359-
name: 'js/2.js',
360-
path: 'js/2.js',
361-
publicPath: 'http://localhost:3000/assets/js/2.js',
362-
},
363358
'js/app1.js': {
364359
name: 'js/app1.js',
365360
path: 'js/app1.js',
@@ -375,11 +370,6 @@ describe('BundleTrackerPlugin bases tests', () => {
375370
path: 'js/commons.js',
376371
publicPath: 'http://localhost:3000/assets/js/commons.js',
377372
},
378-
'js/vendors.js': {
379-
name: 'js/vendors.js',
380-
path: 'js/vendors.js',
381-
publicPath: 'http://localhost:3000/assets/js/vendors.js',
382-
},
383373
},
384374
},
385375
'webpack-stats.json',
@@ -446,8 +436,8 @@ describe('BundleTrackerPlugin bases tests', () => {
446436
{
447437
status: 'done',
448438
chunks: {
449-
app1: ['js/vendors.js', 'js/commons.js', 'js/app1.js'],
450-
appWithAssets: ['js/vendors.js', 'js/commons.js', 'styles.css', 'js/appWithAssets.js'],
439+
app1: ['js/commons.js', 'js/app1.js'],
440+
appWithAssets: ['js/commons.js', 'styles.css', 'js/appWithAssets.js'],
451441
},
452442
publicPath: 'http://localhost:3000/assets/',
453443
assets: {
@@ -457,18 +447,6 @@ describe('BundleTrackerPlugin bases tests', () => {
457447
integrity: expect.stringMatching(/^^sha256-[\w+=/]+ sha384-[\w+=/]+ sha512-[\w+=/]+$/),
458448
publicPath: 'http://localhost:3000/assets/js/commons.js',
459449
},
460-
'js/vendors.js': {
461-
name: 'js/vendors.js',
462-
path: 'js/vendors.js',
463-
integrity: expect.stringMatching(/^^sha256-[\w+=/]+ sha384-[\w+=/]+ sha512-[\w+=/]+$/),
464-
publicPath: 'http://localhost:3000/assets/js/vendors.js',
465-
},
466-
'js/2.js': {
467-
name: 'js/2.js',
468-
path: 'js/2.js',
469-
integrity: expect.stringMatching(/^^sha256-[\w+=/]+ sha384-[\w+=/]+ sha512-[\w+=/]+$/),
470-
publicPath: 'http://localhost:3000/assets/js/2.js',
471-
},
472450
'js/app1.js': {
473451
name: 'js/app1.js',
474452
path: 'js/app1.js',
@@ -571,13 +549,8 @@ describe('BundleTrackerPlugin bases tests', () => {
571549
{
572550
status: 'done',
573551
chunks: {
574-
app1: [
575-
expect.stringMatching(/^js\/vendors.js$/),
576-
expect.stringMatching(/^js\/commons.js$/),
577-
expect.stringMatching(/^js\/app1.js$/),
578-
],
552+
app1: [expect.stringMatching(/^js\/commons.js$/), expect.stringMatching(/^js\/app1.js$/)],
579553
appWithAssets: [
580-
expect.stringMatching(/^js\/vendors.js$/),
581554
expect.stringMatching(/^js\/commons.js$/),
582555
expect.stringMatching(/^css\/appWithAssets.css$/),
583556
expect.stringMatching(/^js\/appWithAssets.js$/),
@@ -589,16 +562,6 @@ describe('BundleTrackerPlugin bases tests', () => {
589562
path: 'js/commons.js',
590563
publicPath: 'http://localhost:3000/assets/js/commons.js',
591564
},
592-
'js/vendors.js': {
593-
name: 'js/vendors.js',
594-
path: 'js/vendors.js',
595-
publicPath: 'http://localhost:3000/assets/js/vendors.js',
596-
},
597-
'js/2.js': {
598-
name: 'js/2.js',
599-
path: 'js/2.js',
600-
publicPath: 'http://localhost:3000/assets/js/2.js',
601-
},
602565
'js/app1.js': {
603566
name: 'js/app1.js',
604567
path: 'js/app1.js',
@@ -619,16 +582,6 @@ describe('BundleTrackerPlugin bases tests', () => {
619582
path: 'js/commons.js.gz',
620583
publicPath: 'http://localhost:3000/assets/js/commons.js.gz',
621584
},
622-
'js/vendors.js.gz': {
623-
name: 'js/vendors.js.gz',
624-
path: 'js/vendors.js.gz',
625-
publicPath: 'http://localhost:3000/assets/js/vendors.js.gz',
626-
},
627-
'js/2.js.gz': {
628-
name: 'js/2.js.gz',
629-
path: 'js/2.js.gz',
630-
publicPath: 'http://localhost:3000/assets/js/2.js.gz',
631-
},
632585
'js/app1.js.gz': {
633586
name: 'js/app1.js.gz',
634587
path: 'js/app1.js.gz',
@@ -649,21 +602,11 @@ describe('BundleTrackerPlugin bases tests', () => {
649602
path: 'js/commons.js.br',
650603
publicPath: 'http://localhost:3000/assets/js/commons.js.br',
651604
},
652-
'js/2.js.br': {
653-
name: 'js/2.js.br',
654-
path: 'js/2.js.br',
655-
publicPath: 'http://localhost:3000/assets/js/2.js.br',
656-
},
657605
'css/appWithAssets.css.br': {
658606
name: 'css/appWithAssets.css.br',
659607
path: 'css/appWithAssets.css.br',
660608
publicPath: 'http://localhost:3000/assets/css/appWithAssets.css.br',
661609
},
662-
'js/vendors.js.br': {
663-
name: 'js/vendors.js.br',
664-
path: 'js/vendors.js.br',
665-
publicPath: 'http://localhost:3000/assets/js/vendors.js.br',
666-
},
667610
'js/app1.js.br': {
668611
name: 'js/app1.js.br',
669612
path: 'js/app1.js.br',

0 commit comments

Comments
 (0)