feat
This commit is contained in:
1 parent
8e28bca775
commit
1172a6bd3d
100 files changed
+8305
-6025
No files matched your search
@@ -8,14 +8,3 @@ const fixturesDir = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'fixt
|
||||
export function loadFixture(name: string): string {
|
||||
return readFileSync(resolve(fixturesDir, name), 'utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run generated code via `new Function()` and return a named global value.
|
||||
* Cleans up the global after retrieval.
|
||||
*/
|
||||
export function execAndGet<T>(code: string, globalKey: string): T {
|
||||
new Function(code)();
|
||||
const val = (globalThis as any)[globalKey] as T;
|
||||
delete (globalThis as any)[globalKey];
|
||||
return val;
|
||||
}
|
||||
Reference in new issue
Block a user