mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 10:16:01 +00:00
Hook require to prevent tests failures when loading images
This commit is contained in:
parent
7cc3918b8d
commit
b2daaa2159
@ -55,6 +55,7 @@
|
||||
:output-to "target/test/test.js"
|
||||
:output-dir "target/test"
|
||||
:optimizations :none
|
||||
:preamble ["js/hook-require.js"]
|
||||
:target :nodejs}}
|
||||
{:id "protocol"
|
||||
:source-paths ["src" "test/cljs"]
|
||||
|
14
resources/js/hook-require.js
Normal file
14
resources/js/hook-require.js
Normal file
@ -0,0 +1,14 @@
|
||||
const m = require('module');
|
||||
const originalLoader = m._load;
|
||||
|
||||
/*
|
||||
Hook `require` so that RN abuse of require does not break when running tests in nodejs.
|
||||
*/
|
||||
|
||||
m._load = function hookedLoader(request, parent, isMain) {
|
||||
if (request.match(/.jpeg|.jpg|.png$/)) {
|
||||
return { uri: request };
|
||||
}
|
||||
|
||||
return originalLoader(request, parent, isMain);
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
(ns status-im.utils.ethereum.tokens)
|
||||
|
||||
(def ethereum {})
|
||||
|
||||
(def all {})
|
Loading…
x
Reference in New Issue
Block a user