diff --git a/spec/HtmlWebpackPluginSpec.js b/spec/HtmlWebpackPluginSpec.js index 1896fce..75ec141 100644 --- a/spec/HtmlWebpackPluginSpec.js +++ b/spec/HtmlWebpackPluginSpec.js @@ -8,7 +8,7 @@ var HtmlWebpackPlugin = require('../index.js'); var OUTPUT_DIR = path.join(__dirname, '../dist'); -function testHtmlPlugin(webpackConfig, expectedResults, outputFile, done, expectErrors) { +function testHtmlPlugin(webpackConfig, expectedResults, outputFile, done, expectErrors, expectWarnings) { outputFile = outputFile || 'index.html'; webpack(webpackConfig, function(err, stats) { expect(err).toBeFalsy(); @@ -18,6 +18,12 @@ function testHtmlPlugin(webpackConfig, expectedResults, outputFile, done, expect } else { expect(compilationErrors).toBe(''); } + var compilationWarnings = (stats.compilation.warnings || []).join('\n'); + if (expectWarnings) { + expect(compilationWarnings).not.toBe(''); + } else { + expect(compilationWarnings).toBe(''); + } var htmlContent = fs.readFileSync(path.join(OUTPUT_DIR, outputFile)).toString(); for (var i = 0; i < expectedResults.length; i++) { var expectedResult = expectedResults[i]; @@ -172,7 +178,7 @@ describe('HtmlWebpackPlugin', function() { }, plugins: [new HtmlWebpackPlugin({template: path.join(__dirname, 'fixtures/legacy.html')})] }, - ['