Add test case for handling subdirectories in the output path

This commit is contained in:
Charles Blaxland 2014-08-13 09:19:22 +10:00
parent c10e9336e4
commit 42e8dfa651
2 changed files with 24 additions and 1 deletions

View File

@ -10,7 +10,6 @@ HtmlWebpackPlugin.prototype.apply = function(compiler) {
var self = this;
compiler.plugin('done', function(stats) {
var webpackStatsJson = stats.toJson();
console.log(JSON.stringify(webpackStatsJson, null, 2));
var templateParams = {};
templateParams.webpack = webpackStatsJson;
templateParams.htmlWebpackPlugin = self.htmlWebpackPluginJson(compiler, webpackStatsJson);

View File

@ -106,4 +106,28 @@ describe('HtmlWebpackPlugin', function() {
}, ['<script src="http://cdn.example.com/assets/index_bundle.js"'], done);
});
it('handles subdirectories in the webpack output bundles', function(done) {
testHtmlPlugin({
devtool: 'sourcemap',
entry: path.join(__dirname, 'fixtures', 'index.js'),
output: {
path: OUTPUT_DIR,
filename: path.join('assets', 'index_bundle.js')
},
plugins: [new HtmlWebpackPlugin()]
}, ['<script src="assets/index_bundle.js"'], done);
testHtmlPlugin({
devtool: 'sourcemap',
entry: path.join(__dirname, 'fixtures', 'index.js'),
output: {
path: OUTPUT_DIR,
filename: path.join('assets', 'index_bundle.js'),
publicPath: 'http://cdn.example.com/'
},
plugins: [new HtmlWebpackPlugin()]
}, ['<script src="http://cdn.example.com/assets/index_bundle.js"'], done);
});
});