Occasionally I need to tweak my preprocessor.js to account for a new file type that shouldn't go through ReactTools.transform
. I'd like to debug the calls to process
to make sure I understand its arguments - however if I console.log
within the method I get this error:
Error: Attempted to send a message to the worker before the response from the last message was received! Worker processes can only handle one message at a time.
I am running Jest from Grunt via grunt-jest
. Gruntfile section:
jest: {
options: {
coverage: false,
testPathPattern: /__tests__\/.*/
}
},
Preprocessor file:
'use strict';
var ReactTools = require('react-tools');
module.exports = {
process: function(src, file) {
if (file.match(/node_modules/)) {
return src;
} else if (file.match(/css/)) {
return '';
} else if (file.match(/png/)) {
return '';
}
//console.log/setTimeout...console.log doesn't work
//console.log(file);
//setTimeout(function() {console.log(file);},0);
var transformed = ReactTools.transform(src, { harmony: true });
return transformed;
}
};
How can I debug the 'process' method?
(The problem I was trying to debug was requiring a css file in node_modules which was caught by the first if block and never got to the .match(/css/)
block, but the question still stands.)