I came from the git repo:
https://github.com/meteor/meteor/issues/7157
Brief explanation of the problem:
When running command meteor test
for unit-test, there will be error like Error: Cannot find module '../*.less'
. I indeed can import my style files with other way but still prefer a more “unit-test” style method.
My codes are like this:
//module.js:
import 'module.less'
export default <SomeComponent/>
//app.js:
import SomeComponent from 'module.js'
...
export default <App/>
and the test code is like:
import App from 'app.js'
//... test with component App ...
So the idea I had is to replace the imported module with style file imported(like module.js
above).
I tried something like dependency stub/mock with proxyquire, or simply babel-plugin-rewire and neither of then works. It might because of the imported chain or the module system is not that simple, which i am still confused about.
Any suggestion for doing this or explanation of why it is undoable?