I had the same problem lately and the solution was through Mocha compilers.
create a file, let's call it 'css-null-compiler.js' and it has:
function noop() {
return null;
}
require.extensions['.styl'] = noop;
// you can add whatever you wanna handle
require.extensions['.scss'] = noop;
require.extensions['.png'] = noop;
// ..etc
when you run mocha from the command line, pass this file as a compiler
mocha /your/test.spec.js --compilers css:css-null-compiler.js
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…