Skip to content

Instantly share code, notes, and snippets.

@thw0rted
Created May 14, 2020 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thw0rted/e616537c31cf26331912f44a815fe029 to your computer and use it in GitHub Desktop.
Save thw0rted/e616537c31cf26331912f44a815fe029 to your computer and use it in GitHub Desktop.
Second test run errors -- html-webpack-plugin
FAIL spec/basic.spec.js (50.953s)
HtmlWebpackPlugin
√ generates a default index.html file for a single entry point (2901ms)
√ properly encodes file names in emitted URIs (104ms)
× properly encodes file names in emitted URIs but keeps the querystring (30018ms)
√ generates a default index.html file with multiple entry points (114ms)
× allows you to specify a custom loader without injection (45ms)
√ should pass through loader errors (1356ms)
× uses a custom loader from webpacks config (47ms)
√ works when using html-loader (535ms)
× allows you to specify your own HTML template file (34ms)
× picks up src/index.ejs by default (148ms)
√ allows you to inject the assets into a given html file (84ms)
√ allows you to inject the assets into the body of the given template (147ms)
√ allows you to inject the assets into the head of the given template (143ms)
√ allows you to inject a specified asset into a given html file (130ms)
√ allows you to inject a specified asset into a given html file (134ms)
√ allows you to use chunkhash with asset into a given html file (109ms)
√ allows you to disable injection (104ms)
√ allows you to specify your own HTML template function (75ms)
√ works with source maps (165ms)
√ handles hashes in bundle filenames (89ms)
√ handles hashes in the directory which has the bundle file (76ms)
√ allows to append hashes to the assets (88ms)
√ allows to append hashes to the assets (88ms)
√ should work with the css extract plugin (633ms)
√ should work with the css extract plugin on windows and protocol relative urls support (#205) (117ms)
√ should allow to add cache hashes to with the css assets (105ms)
√ should allow to add cache hashes to with the css assets (111ms)
√ should allow to add cache hashes to with the css assets (99ms)
√ should allow to add cache hashes to with the css assets (96ms)
√ should allow to add cache hashes to with the css assets (116ms)
√ should inject css files when using the extract text plugin (110ms)
√ should allow to add cache hashes to with injected css assets (151ms)
√ should output xhtml link stylesheet tag (167ms)
√ prepends the publicPath to function (72ms)
√ prepends the publicPath to /some/ (65ms)
√ prepends the publicPath to /some (70ms)
√ prepends the publicPath to /some (60ms)
√ prepends the publicPath to undefined (65ms)
√ prepends the publicPath to undefined (82ms)
√ prepends the publicPath to script src (77ms)
√ handles subdirectories in the webpack output bundles (62ms)
√ handles subdirectories in the webpack output bundles along with a relative path (66ms)
√ handles subdirectories in the webpack output bundles along with a relative path (78ms)
√ handles subdirectories in the webpack output bundles along with a absolute path (66ms)
√ allows you to configure the title of the generated HTML page (75ms)
√ allows you to configure the output filename (70ms)
√ will replace [hash] in the filename with the child compilation hash (78ms)
√ should allow filename in the format of [<hashType>:contenthash:<digestType>:<length>] (157ms)
√ will replace [contenthash] in the filename with a content hash of 32 hex characters (76ms)
√ will replace [templatehash] in the filename with a content hash of 32 hex characters (86ms)
√ allows you to use an absolute output filename (58ms)
√ allows you to use an absolute output filename outside the output path (57ms)
√ allows you to use an relative output filename outside the output path (76ms)
√ will try to use a relative name if the filename is in a subdirectory (68ms)
√ will try to use a relative name if the filename and the script are in a subdirectory (87ms)
√ allows you write multiple HTML files (147ms)
√ should inject js css files even if the html file is incomplete (92ms)
√ exposes the webpack configuration to templates (77ms)
√ fires the html-webpack-plugin-alter-asset-tags event (129ms)
√ allows events to add a no-value attribute (105ms)
√ allows events to remove an attribute by setting it to false (103ms)
√ fires the html-webpack-plugin-after-template-execution event (130ms)
√ fires the html-webpack-plugin-before-emit event (132ms)
√ fires the html-webpack-plugin-after-emit event (100ms)
√ allows to modify the html during html-webpack-plugin-before-emit event (151ms)
√ allows to access all hooks from within a plugin (92ms)
√ allows to modify sequentially the html during html-webpack-plugin-before-emit event by edit the given arguments object (123ms)
√ allows to modify sequentially the html during html-webpack-plugin-before-emit event either by edit the given arguments object or by return a new object in the callback (63ms)
√ allows to modify sequentially the html during html-webpack-plugin-before-emit event by return a new object in the callback (67ms)
√ allows to modify the html during html-webpack-plugin-after-template-execution event (92ms)
√ allows to modify the html during html-webpack-plugin-before-asset-tag-generation event (106ms)
√ fires the events in the correct order (70ms)
√ works with commons chunk plugin (95ms)
√ adds a favicon (64ms)
√ adds a base tag with attributes (214ms)
√ adds a base tag short syntax (155ms)
√ adds a meta tag (133ms)
√ adds a meta tag with short notation (166ms)
√ adds a favicon with publicPath set to /some/ (130ms)
√ adds a favicon with publicPath set to /some (160ms)
√ adds a favicon with publicPath set to some/ (140ms)
√ adds a favicon with publicPath undefined (182ms)
√ adds a favicon with publicPath undefined (92ms)
√ adds a favicon with a publichPath set to /[hash]/ and replaces the hash (50ms)
√ adds a favicon with a publichPath set to [hash]/ and replaces the hash (56ms)
√ adds a favicon with inject enabled (43ms)
√ adds a favicon with xhtml enabled (47ms)
√ shows an error if the favicon could not be load (135ms)
√ adds a manifest (58ms)
√ does not add a manifest if already present (67ms)
√ works with webpack bannerplugin (99ms)
√ shows an error when a template fails to load (183ms)
√ should sort the chunks in auto mode (55ms)
√ should sort the chunks in custom (reverse alphabetical) order (58ms)
√ should sort manually by the chunks (71ms)
√ should add the webpack compilation object as a property of the templateParam object (44ms)
√ should allow to disable template parameters (44ms)
√ should allow to set specific template parameters (52ms)
√ should allow to set specific template parameters using a function (58ms)
√ should allow to set specific template parameters using a async function (68ms)
√ should not treat templateContent set to an empty string as missing (56ms)
√ allows you to inject the assets into the body of the given spaced closing tag template (57ms)
√ allows you to inject the assets into the head of the given spaced closing tag template (57ms)
√ should minify by default when mode is production (42ms)
√ should not minify by default when mode is development (40ms)
√ should minify in production if options.minify is true (47ms)
√ should minify in development if options.minify is true (45ms)
√ should not minify in production if options.minify is false (53ms)
√ should not minify in development if options.minify is false (62ms)
√ should allow custom minify options and not merge them with the defaults (79ms)
√ should allow to inject scripts with a defer attribute (68ms)
√ should allow to inject scripts with a defer attribute to the body (43ms)
√ should allow to inject scripts with a defer in front of styles (119ms)
√ should keep closing slashes from the template (127ms)
√ should allow to use headTags and bodyTags directly in string literals (84ms)
● HtmlWebpackPlugin › properly encodes file names in emitted URIs but keeps the querystring
: Timeout - Async callback was not invoked within the 30000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 30000ms timeout specified by jest.setTimeout.Error:
117 | });
118 |
> 119 | it('properly encodes file names in emitted URIs but keeps the querystring', done => {
| ^
120 | testHtmlPlugin({
121 | mode: 'production',
122 | entry: path.join(__dirname, 'fixtures/index.js'),
at new Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
at Suite.<anonymous> (spec/basic.spec.js:119:3)
● HtmlWebpackPlugin › allows you to specify a custom loader without injection
expect(received).toBeFalsy()
Received: [Error: EEXIST: file already exists, mkdir 'C:\Workspace\html-webpack-plugin\dist\basic-spec']
28 | outputFile = outputFile || 'index.html';
29 | webpack(webpackConfig, (err, stats) => {
> 30 | expect(err).toBeFalsy();
| ^
31 | const compilationErrors = (stats.compilation.errors || []).join('\n');
32 | if (expectErrors) {
33 | expect(compilationErrors).not.toBe('');
at spec/basic.spec.js:30:17
at finalCallback (node_modules/webpack/lib/Compiler.js:220:39)
at node_modules/webpack/lib/Compiler.js:242:21
at node_modules/webpack/lib/Compiler.js:430:22
at node_modules/neo-async/async.js:2830:7
at done (node_modules/neo-async/async.js:3517:9)
at writeOut (node_modules/webpack/lib/Compiler.js:332:23)
at node_modules/mkdirp/index.js:36:29
at node_modules/mkdirp/index.js:48:53
at callback (node_modules/graceful-fs/polyfills.js:295:20)
● HtmlWebpackPlugin › uses a custom loader from webpacks config
expect(received).toBe(expected) // Object.is equality
Expected: true
Received: false
49 | expect(outputFile.indexOf('[hash]') === -1).toBe(true);
50 | const outputFileExists = fs.existsSync(path.join(OUTPUT_DIR, outputFile));
> 51 | expect(outputFileExists).toBe(true);
| ^
52 | if (!outputFileExists) {
53 | return done();
54 | }
at spec/basic.spec.js:51:30
at finalCallback (node_modules/webpack/lib/Compiler.js:220:39)
at node_modules/webpack/lib/Compiler.js:269:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
at node_modules/webpack/lib/Compiler.js:267:22
at Compiler.emitRecords (node_modules/webpack/lib/Compiler.js:449:39)
at node_modules/webpack/lib/Compiler.js:261:10
at node_modules/webpack/lib/Compiler.js:435:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
at node_modules/webpack/lib/Compiler.js:432:27
at node_modules/neo-async/async.js:2818:7
at done (node_modules/neo-async/async.js:3522:9)
at node_modules/graceful-fs/graceful-fs.js:144:16
at node_modules/graceful-fs/graceful-fs.js:61:14
● HtmlWebpackPlugin › allows you to specify your own HTML template file
expect(received).toBeFalsy()
Received: [Error: ENOENT: no such file or directory, open 'C:\Workspace\html-webpack-plugin\dist\basic-spec\index.html']
28 | outputFile = outputFile || 'index.html';
29 | webpack(webpackConfig, (err, stats) => {
> 30 | expect(err).toBeFalsy();
| ^
31 | const compilationErrors = (stats.compilation.errors || []).join('\n');
32 | if (expectErrors) {
33 | expect(compilationErrors).not.toBe('');
at spec/basic.spec.js:30:17
at finalCallback (node_modules/webpack/lib/Compiler.js:220:39)
at node_modules/webpack/lib/Compiler.js:242:21
at node_modules/webpack/lib/Compiler.js:430:22
at node_modules/neo-async/async.js:2830:7
at done (node_modules/neo-async/async.js:3517:9)
at node_modules/graceful-fs/graceful-fs.js:144:16
at fs.js:1186:7
at node_modules/graceful-fs/graceful-fs.js:333:16
● HtmlWebpackPlugin › picks up src/index.ejs by default
expect(received).toContain(expected) // indexOf
Expected substring: "<script src=\"app_bundle.js"
Received string: ""
68 | }
69 | } else {
> 70 | expect(htmlContent).toContain(expectedResult.replace('%hash%', stats.hash));
| ^
71 | }
72 | }
73 | done();
at spec/basic.spec.js:70:29
at finalCallback (node_modules/webpack/lib/Compiler.js:220:39)
at node_modules/webpack/lib/Compiler.js:269:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
at node_modules/webpack/lib/Compiler.js:267:22
at Compiler.emitRecords (node_modules/webpack/lib/Compiler.js:449:39)
at node_modules/webpack/lib/Compiler.js:261:10
at node_modules/webpack/lib/Compiler.js:435:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
at node_modules/webpack/lib/Compiler.js:432:27
at node_modules/neo-async/async.js:2818:7
at done (node_modules/neo-async/async.js:3522:9)
at node_modules/graceful-fs/graceful-fs.js:144:16
at node_modules/graceful-fs/graceful-fs.js:61:14
PASS spec/example.spec.js
HtmlWebpackPlugin Examples
√ appcache example (768ms)
√ custom-template example (174ms)
√ default example (279ms)
√ favicon example (155ms)
√ html-loader example (115ms)
√ inline example (267ms)
√ pug-loader example (153ms)
√ javascript example (107ms)
√ javascript-advanced example (123ms)
√ sort manually example (156ms)
√ template-parameters example (122ms)
FAIL spec/caching.spec.js
HtmlWebpackPluginCaching
√ should compile nothing if no file was changed (316ms)
√ should not compile the webpack html file if only a javascript file was changed (143ms)
√ should compile the webpack html file even if only a javascript file was changed if caching is disabled (126ms)
√ should compile the webpack html if the template file was changed (135ms)
× should not slow down linear (10 plugins should not take 2.5 as much time as a 1 plugin) (242ms)
√ should keep watching the webpack html if only a js file was changed (955ms)
● HtmlWebpackPluginCaching › should not slow down linear (10 plugins should not take 2.5 as much time as a 1 plugin)
expect(received).toBeLessThan(expected)
Expected: < 250
Received: 268.5900203248198
238 | const speedComarision = multiCompileRunDurationInNs / singleCompileRunDurationInNs * 100;
239 |
> 240 | expect(speedComarision).toBeLessThan(250);
| ^
241 | done();
242 | });
243 | });
at meassureTime (spec/caching.spec.js:240:33)
PASS spec/hot.spec.js
HtmlWebpackPluginHMR
√ should not cause errors for the main compilation if hot-reload is active (447ms)
√ should not cause missing hot-reloaded code of the main compilation (197ms)
--------------------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------------------------------------------|----------|----------|----------|----------|-------------------|
All files | 91.39 | 79.05 | 93.01 | 91.34 | |
html-webpack-plugin | 89.04 | 79.52 | 91.36 | 88.97 | |
index.js | 89.04 | 79.52 | 91.36 | 88.97 |... 5,996,997,1007 |
html-webpack-plugin/examples/appcache | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/custom-template | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/default | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/favicon | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/html-loader | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/inline | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/javascript | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/javascript-advanced | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/pug-loader | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/sort-manually | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/examples/template-parameters | 100 | 100 | 100 | 100 | |
webpack.config.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/lib | 91.94 | 77.65 | 94.44 | 91.76 | |
cached-child-compiler.js | 90.79 | 79.41 | 100 | 90.54 |... 83,296,317,329 |
child-compiler.js | 90.38 | 58.82 | 84.62 | 90.2 | 59,66,81,127,128 |
chunksorter.js | 90 | 50 | 100 | 88.89 | 28 |
errors.js | 85.71 | 100 | 80 | 85.71 | 18,27 |
file-watcher-api.js | 100 | 50 | 100 | 100 | 11 |
hooks.js | 100 | 100 | 100 | 100 | |
html-tags.js | 100 | 81.25 | 100 | 100 | 31,37,63 |
loader.js | 100 | 100 | 100 | 100 | |
html-webpack-plugin/lib/webpack4 | 100 | 100 | 100 | 100 | |
file-watcher-api.js | 100 | 100 | 100 | 100 | |
--------------------------------------------------|----------|----------|----------|----------|-------------------|
Test Suites: 2 failed, 2 passed, 4 total
Tests: 6 failed, 128 passed, 134 total
Snapshots: 0 total
Time: 59.805s, estimated 64s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! html-webpack-plugin@4.3.0 test: `jest --runInBand --verbose --coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the html-webpack-plugin@4.3.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment