Add inline tests for webpack 2

This commit is contained in:
Jan Nicklas 2016-03-23 11:13:38 +01:00
parent 29871bd0f5
commit def0703e71
13 changed files with 135 additions and 5 deletions

View File

@ -4,7 +4,6 @@
* You could do the same by going into each example and execute
* `webpack`
*/
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
var fs = require('fs');

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].e;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ e: {},
/******/ i: moduleId,
/******/ l: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.e, module, module.e, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ // Return the exports of the module
/******/ return module.e;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(0);
console.log('Hello World');
/***/ }
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,62 @@
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>Jade demo</title></head><body><style>body {
background: snow;
}</style><script>/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].e;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ e: {},
/******/ i: moduleId,
/******/ l: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.e, module, module.e, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ // Return the exports of the module
/******/ return module.e;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(0);
console.log('Hello World');
/***/ }
/******/ ]);</script></body></html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -1,9 +1,11 @@
var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = {
entry: './example.js',
output: {
path: __dirname + '/dist',
path: __dirname + '/dist/webpack-' + webpackMajorVersion,
publicPath: '',
filename: 'bundle.js'
},

View File

@ -82,8 +82,8 @@ module.exports.none = function (chunks) {
*/
module.exports.auto = module.exports.id;
// In webpack 2 the ids are fliped around.
// Therefore the id sort is broken
// In webpack 2 the ids have been flipped.
// Therefore the id sort doesn't work the same way as it did for webpack 1
// Luckily the dependency sort is working as expected
if (require('webpack/package.json').version.split('.')[0] === '2') {
module.exports.auto = module.exports.dependency;

View File

@ -11,7 +11,7 @@
"scripts": {
"prepublish": "npm run test",
"pretest": "semistandard",
"recompile": "node examples/rebuild.js",
"build-examples": "node examples/build-examples.js",
"test": "jasmine"
},
"repository": {

View File

@ -70,6 +70,10 @@ describe('HtmlWebpackPlugin Examples', function () {
runExample('html-loader', done);
});
it('inline example', function (done) {
runExample('inline', done);
});
it('jade-loader example', function (done) {
runExample('jade-loader', done);
});