From 99f46f4c94884a9b309c74b99c6c7ea83090ccd1 Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Thu, 23 Jul 2020 15:41:28 +0200 Subject: [PATCH 1/5] Added fixtures for new test case --- fixtures/images/symfony-logo.svg | 1 + fixtures/js/import_svg.js | 1 + 2 files changed, 2 insertions(+) create mode 100644 fixtures/images/symfony-logo.svg create mode 100644 fixtures/js/import_svg.js diff --git a/fixtures/images/symfony-logo.svg b/fixtures/images/symfony-logo.svg new file mode 100644 index 00000000..f10824ae --- /dev/null +++ b/fixtures/images/symfony-logo.svg @@ -0,0 +1 @@ + diff --git a/fixtures/js/import_svg.js b/fixtures/js/import_svg.js new file mode 100644 index 00000000..30958c4c --- /dev/null +++ b/fixtures/js/import_svg.js @@ -0,0 +1 @@ +import '../images/symfony-logo.svg'; From c2bdf2e2aac1e121480623f58380f6413d996133 Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Thu, 23 Jul 2020 16:30:32 +0200 Subject: [PATCH 2/5] Updated existing test cases for the new fixtures --- test/functional.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/functional.js b/test/functional.js index 3d5dc6ce..dc6943cf 100644 --- a/test/functional.js +++ b/test/functional.js @@ -2124,6 +2124,7 @@ module.exports = { 'main.js', 'manifest.json', 'symfony_logo.png', + 'symfony-logo.svg', 'symfony_logo_alt.png', ]); @@ -2171,6 +2172,7 @@ module.exports = { expect(path.join(config.outputPath, 'assets')).to.be.a.directory() .with.files([ + 'symfony-logo.svg', 'symfony_logo.png', 'symfony_logo_alt.png', 'Roboto.woff2', @@ -2221,6 +2223,7 @@ module.exports = { expect(path.join(config.outputPath, 'images')).to.be.a.directory() .with.files([ + 'symfony-logo.579acd4f.svg', 'symfony_logo.91beba37.png', 'symfony_logo_alt.f880ba14.png', ]); @@ -2311,16 +2314,17 @@ module.exports = { expect(config.outputPath).to.be.a.directory() .with.files([ 'entrypoints.json', - 'runtime.518d4a5c.js', - 'main.78f7d83e.js', + 'runtime.d94b3b43.js', + 'main.31fd3788.js', 'manifest.json', + 'symfony-logo.579acd4f.svg', 'symfony_logo.91beba37.png', 'symfony_logo_alt.f880ba14.png', ]); webpackAssert.assertManifestPath( 'build/main.js', - '/build/main.78f7d83e.js' + '/build/main.31fd3788.js' ); } @@ -2407,6 +2411,7 @@ module.exports = { expect(path.join(config.outputPath, 'images')).to.be.a.directory() .with.files([ + 'symfony-logo.579acd4f.svg', 'symfony_logo.91beba37.png', 'symfony_logo_alt.f880ba14.png', ]); From ce31573524118cff8528f1074221a8069fbf7a54 Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Thu, 23 Jul 2020 16:44:58 +0200 Subject: [PATCH 3/5] Added assertions for new fixture file to existing test cases --- test/functional.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/functional.js b/test/functional.js index dc6943cf..5b3b1826 100644 --- a/test/functional.js +++ b/test/functional.js @@ -2133,6 +2133,11 @@ module.exports = { '/build/main.js' ); + webpackAssert.assertManifestPath( + 'build/symfony-logo.svg', + '/build/symfony-logo.svg' + ); + webpackAssert.assertManifestPath( 'build/symfony_logo.png', '/build/symfony_logo.png' @@ -2183,6 +2188,11 @@ module.exports = { '/build/main.js' ); + webpackAssert.assertManifestPath( + 'build/assets/symfony-logo.svg', + '/build/assets/symfony-logo.svg' + ); + webpackAssert.assertManifestPath( 'build/assets/symfony_logo.png', '/build/assets/symfony_logo.png' @@ -2238,6 +2248,11 @@ module.exports = { '/build/main.js' ); + webpackAssert.assertManifestPath( + 'build/images/symfony-logo.svg', + '/build/images/symfony-logo.579acd4f.svg' + ); + webpackAssert.assertManifestPath( 'build/images/symfony_logo.png', '/build/images/symfony_logo.91beba37.png' @@ -2333,6 +2348,11 @@ module.exports = { 'Roboto.woff2', ]); + webpackAssert.assertManifestPath( + 'build/symfony-logo.svg', + '/build/symfony-logo.579acd4f.svg' + ); + webpackAssert.assertManifestPath( 'build/symfony_logo.png', '/build/symfony_logo.91beba37.png' @@ -2426,6 +2446,11 @@ module.exports = { '/build/main.js' ); + webpackAssert.assertManifestPath( + 'build/images/symfony-logo.svg', + '/build/images/symfony-logo.579acd4f.svg' + ); + webpackAssert.assertManifestPath( 'build/images/symfony_logo.png', '/build/images/symfony_logo.91beba37.png' From 2582ddeda6994a3d0e357924187630cd23b085c1 Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Thu, 23 Jul 2020 16:56:27 +0200 Subject: [PATCH 4/5] Added failing test case --- test/functional.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/functional.js b/test/functional.js index 5b3b1826..46f49a01 100644 --- a/test/functional.js +++ b/test/functional.js @@ -81,6 +81,20 @@ describe('Functional tests using webpack', function() { }); describe('Basic scenarios.', () => { + it('Generates a correct manifest when images are imported from a js file', (done) => { + const config = createWebpackConfig('web/build', 'production'); + config.addEntry('svg', './js/import_svg'); + config.setPublicPath('/build'); + + testSetup.runWebpack(config, (webpackAssert) => { + webpackAssert.assertManifestPath( + 'build/images/symfony-logo.svg', + '/build/images/symfony-logo.579acd4f.svg' + ); + + done(); + }); + }); it('Builds a few simple entries file + manifest.json', (done) => { const config = createWebpackConfig('web/build', 'dev'); From 788589be4c58a1b7b535a3ce91f32bc9d816a9ac Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Thu, 23 Jul 2020 17:09:06 +0200 Subject: [PATCH 5/5] Modified version string to match the actual ones --- test/functional.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional.js b/test/functional.js index 46f49a01..c2b491ac 100644 --- a/test/functional.js +++ b/test/functional.js @@ -2343,8 +2343,8 @@ module.exports = { expect(config.outputPath).to.be.a.directory() .with.files([ 'entrypoints.json', - 'runtime.d94b3b43.js', - 'main.31fd3788.js', + 'runtime.518d4a5c.js', + 'main.78f7d83e.js', 'manifest.json', 'symfony-logo.579acd4f.svg', 'symfony_logo.91beba37.png',