diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 9f8ee7e7..22635601 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -390,6 +390,32 @@ exports.push([module.id, \\"\\", \\"\\"]); exports[`loader should compile with empty css entry point: warnings 1`] = `Array []`; +exports[`loader should compile with empty options: errors 1`] = `Array []`; + +exports[`loader should compile with empty options: module (evaluated) 1`] = ` +Array [ + Array [ + 1, + "", + "", + ], +] +`; + +exports[`loader should compile with empty options: module 1`] = ` +"exports = module.exports = require(\\"../../lib/runtime/api.js\\")(false); +// imports + + +// module +exports.push([module.id, \\"\\", \\"\\"]); + +// exports +" +`; + +exports[`loader should compile with empty options: warnings 1`] = `Array []`; + exports[`loader should throw error on invalid css syntax: errors 1`] = ` Array [ "ModuleBuildError: Module build failed (from \`replaced original path\`): diff --git a/test/loader.test.js b/test/loader.test.js index 28a42a3a..36e13d06 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -47,6 +47,21 @@ describe('loader', () => { expect(stats.compilation.errors).toMatchSnapshot('errors'); }); + it('should compile with empty options', async () => { + const config = { loader: { options: {} } }; + const testId = './empty.css'; + const stats = await webpack(testId, config); + const { modules } = stats.toJson(); + const module = modules.find((m) => m.id === testId); + + expect(module.source).toMatchSnapshot('module'); + expect(evaluated(module.source, modules)).toMatchSnapshot( + 'module (evaluated)' + ); + expect(stats.compilation.warnings).toMatchSnapshot('warnings'); + expect(stats.compilation.errors).toMatchSnapshot('errors'); + }); + it('should throws error when no loader for assets', async () => { const config = { rules: [