<commit_before>it("should require existing module with supplied error callback", function(done) {
	require.ensure(['./file'], function(){
		var file = require('./file');
		file.should.be.eql("file");
		done();
	}, function(error) {});
});

it("should call error callback on missing module", function(done) {
	require.ensure(['./missingModule'], function(){
		require('./missingModule');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('Cannot find module "./missingModule"');
		done();
	});
});

it("should call error callback on missing module in context", function(done) {
	(function(module) {
		require.ensure([], function(){
			require('./' + module);
		}, function(error) {
			error.should.be.instanceOf(Error);
			error.message.should.be.eql("Cannot find module './missingModule'.");
			done();
		});
	})('missingModule');
});

it("should call error callback on exception thrown in loading module", function(done) {
	require.ensure(['./throwing'], function(){
		require('./throwing');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('message');
		done();
	});
});

it("should not call error callback on exception thrown in require callback", function(done) {
	require.ensure(['./throwing'], function() {
    require('./throwing');
		throw new Error('message');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('message');
		done();
	});
});<commit_msg>Add test for simulated chunk load error, as requested from code review (required a change to HotModuleReplacement.runtime.js to allow temporarily switching of the chunk loader function to work)<commit_after>it("should require existing module with supplied error callback", function(done) {
	require.ensure(['./file'], function(){
		var file = require('./file');
		file.should.be.eql("file");
		done();
	}, function(error) {});
});

it("should call error callback on missing module", function(done) {
	require.ensure(['./missingModule'], function(){
		require('./missingModule');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('Cannot find module "./missingModule"');
		done();
	});
});

it("should call error callback on missing module in context", function(done) {
	(function(module) {
		require.ensure([], function(){
			require('./' + module);
		}, function(error) {
			error.should.be.instanceOf(Error);
			error.message.should.be.eql("Cannot find module './missingModule'.");
			done();
		});
	})('missingModule');
});

it("should call error callback on exception thrown in loading module", function(done) {
	require.ensure(['./throwing'], function(){
		require('./throwing');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('message');
		done();
	});
});

it("should not call error callback on exception thrown in require callback", function(done) {
	require.ensure(['./throwing'], function() {
    require('./throwing');
		throw new Error('message');
	}, function(error) {
		error.should.be.instanceOf(Error);
		error.message.should.be.eql('message');
		done();
	});
});

it("should call error callback when there is an error loading the chunk", function(done) {
	var temp = __webpack_require__.e;
	__webpack_require__.e = function() { return Promise.reject('fake chunk load error'); };
	require.ensure(['./file'], function(){
		var file = require('./file');
	}, function(error) {
		error.should.be.eql('fake chunk load error');
		done();
	});
	__webpack_require__.e = temp;
});
{'fraction_non_alphanumeric': 0.18630214205186021, 'fraction_numerical': 0.0, 'mean_word_length': 4.837171052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4108536', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1035, 'n_words': 259}