mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
refactor common test helpers into test/
This way we can share them with multiple tests
This commit is contained in:
committed by
David Lechner
parent
8ba4143fa7
commit
31c3e2b52e
+15
@@ -0,0 +1,15 @@
|
||||
const Environment = require('jest-environment-jsdom');
|
||||
|
||||
/**
|
||||
* A custom environment to set the TextEncoder
|
||||
* Thanks https://stackoverflow.com/a/57713960/1976323
|
||||
*/
|
||||
module.exports = class CustomTestEnvironment extends Environment {
|
||||
async setup() {
|
||||
await super.setup();
|
||||
if (typeof TextEncoder === 'undefined') {
|
||||
const { TextEncoder } = require('util');
|
||||
this.global.TextEncoder = TextEncoder;
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user