/
cyberash-dev
/
var-auto-export-loader
Обзор
Документация
Войти
/
cyberash-dev
/
var-auto-export-loader
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/loader.test.js
26 строк
576 B
cyberash
init
18 ноя 2024, 18:11
18 ноя 2024, 18:11
eefc5d1
Код
Авторство
О чём код?
const loader = require("../src"); function getWindowExports(source) { return source.split("\n").filter((line) => line.startsWith("window.")); } describe("loader", () => { it("exports only var and functions", async () => { const result = await loader(` const test1 = 1; let test2 = 2; var test3 = 3; function test4() { var test5 = 5; } `); const windowExports = getWindowExports(result); expect(windowExports).toHaveLength(2); expect(windowExports).toEqual([ "window.test3 = test3;", "window.test4 = test4;", ]); }); });