babel-tape-runner icon indicating copy to clipboard operation
babel-tape-runner copied to clipboard

Json loader

Open niedomnie opened this issue 8 years ago • 2 comments

How to integrate babel-type-runner with json-loader to be able to run test on sources which are loaded through json-loader (like webpack does)? Maybe there is a way to mock this somehow?

in sources import config from "!json!../../cfg/config.json"; when I run test through babel-type-runner Error: Cannot find module '!json!../../cfg/config.json'

niedomnie avatar Nov 24 '16 13:11 niedomnie

@niedomnie you can import .json files like you do with .js files. Node has supported this for a long time.

brigand avatar Nov 24 '16 13:11 brigand

@brigand Problem is that this is on browser side - so I cannot use require and NodeJS does not serve me that feature.

niedomnie avatar Nov 24 '16 13:11 niedomnie