mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-24 09:28:21 +08:00
Make the tests happier
Here we just override the workers because we're not expecting to be able to test them this way. The code paths involved shouldn't be touched.
This commit is contained in:
parent
f65773ef95
commit
65f591b69b
2
__mocks__/empty.js
Normal file
2
__mocks__/empty.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Yes, this is empty.
|
||||||
|
module.exports = {};
|
@ -185,7 +185,10 @@
|
|||||||
],
|
],
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"\\.(gif|png|svg|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js",
|
"\\.(gif|png|svg|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js",
|
||||||
"\\$webapp/i18n/languages.json": "<rootDir>/__mocks__/languages.json"
|
"\\$webapp/i18n/languages.json": "<rootDir>/__mocks__/languages.json",
|
||||||
|
"decoderWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js",
|
||||||
|
"decoderWorker\\.min\\.wasm": "<rootDir>/__mocks__/empty.js",
|
||||||
|
"waveWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js"
|
||||||
},
|
},
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"/node_modules/(?!matrix-js-sdk).+$"
|
"/node_modules/(?!matrix-js-sdk).+$"
|
||||||
|
@ -14,11 +14,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import wavEncoderPath from 'opus-recorder/dist/waveWorker.min.js';
|
|
||||||
import decoderPath from 'opus-recorder/dist/decoderWorker.min.js';
|
|
||||||
import {SAMPLE_RATE} from "./VoiceRecording";
|
import {SAMPLE_RATE} from "./VoiceRecording";
|
||||||
|
|
||||||
// @ts-ignore - we know that this is not a module. We're looking for a path.
|
// @ts-ignore - we know that this is not a module. We're looking for a path.
|
||||||
import decoderWasmPath from 'opus-recorder/dist/decoderWorker.min.wasm';
|
import decoderWasmPath from 'opus-recorder/dist/decoderWorker.min.wasm';
|
||||||
|
import wavEncoderPath from 'opus-recorder/dist/waveWorker.min.js';
|
||||||
|
import decoderPath from 'opus-recorder/dist/decoderWorker.min.js';
|
||||||
|
|
||||||
export function createAudioContext(opts?: AudioContextOptions): AudioContext {
|
export function createAudioContext(opts?: AudioContextOptions): AudioContext {
|
||||||
if (window.AudioContext) {
|
if (window.AudioContext) {
|
||||||
|
Loading…
Reference in New Issue
Block a user