MCPcopy Create free account
hub / github.com/jantimon/html-webpack-plugin / runExample

Function runExample

spec/ExampleSpec.js:25–50  ·  view source on GitHub ↗
(exampleName, done)

Source from the content-addressed store, hash-verified

23jasmine.getEnv().defaultTimeoutInterval = 30000;
24
25function runExample (exampleName, done) {
26 var examplePath = path.resolve(__dirname, '..', 'examples', exampleName);
27 var exampleOutput = path.join(OUTPUT_DIR, exampleName);
28 var fixturePath = path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion);
29 // Clear old results
30 rimraf(exampleOutput, function () {
31 var options = require(path.join(examplePath, 'webpack.config.js'));
32 options.context = examplePath;
33 options.output.path = exampleOutput;
34 webpack(options, function (err) {
35 var dircompare = require('dir-compare');
36 var res = dircompare.compareSync(fixturePath, exampleOutput, {compareSize: true});
37
38 res.diffSet.filter(function (diff) {
39 return diff.state === 'distinct';
40 }).forEach(function (diff) {
41 expect(fs.readFileSync(path.join(diff.path1, diff.name1)).toString())
42 .toBe(fs.readFileSync(path.join(diff.path2, diff.name2)).toString());
43 });
44
45 expect(err).toBeFalsy();
46 expect(res.same).toBe(true);
47 done();
48 });
49 });
50}
51
52describe('HtmlWebpackPlugin Examples', function () {
53 it('appcache example', function (done) {

Callers 1

ExampleSpec.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected