UNPKG

happypack

Version:

webpack speed booster, makes you happy!

49 lines (38 loc) 1.14 kB
'use strict'; const HappyPlugin = require('../../HappyPlugin'); const TestUtils = require('../../HappyTestUtils'); const webpack = require('webpack'); const { assert, } = require('../../HappyTestUtils'); describe('[Integration] Loader RPCs - this.emitWarning()', function() { TestUtils.IntegrationSuite(this); it('works', function(done) { const loader = TestUtils.createLoader(function(s) { this.emitWarning('this is a warning'); return s; }); const compiler = webpack({ entry: TestUtils.createFile('a.js', '// a.js').getPath(), output: { path: TestUtils.tempDir('integration-[guid]') }, module: { loaders: [{ test: /.js$/, loader: TestUtils.HAPPY_LOADER_PATH }] }, plugins: [ new HappyPlugin({ loaders: [ loader.path ], }) ] }); compiler.run(function(err, rawStats) { if (err) return done(err); const stats = rawStats.toJson(); assert.equal(stats.warnings.length, 1); assert.match(stats.warnings[0], 'this is a warning'); done(); }); }); });