Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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\`):
Expand Down
15 changes: 15 additions & 0 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down