Skip to content

Commit

Permalink
test: ensure empty options are working (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Nov 27, 2018
1 parent 81ff67a commit cb559f2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/__snapshots__/loader.test.js.snap
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
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

0 comments on commit cb559f2

Please sign in to comment.