From b47f4eeb313903b9899b555cd06b41e200ccc694 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 29 Aug 2024 17:00:20 -0600 Subject: [PATCH] test: commonjs can be required --- tests/commonjs.cjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/commonjs.cjs diff --git a/tests/commonjs.cjs b/tests/commonjs.cjs new file mode 100644 index 0000000..c400d45 --- /dev/null +++ b/tests/commonjs.cjs @@ -0,0 +1,21 @@ +"use strict"; + +let AJQueryDefault = require("../"); +let AJQueryExplicit = require("../ajquery.cjs"); + +if (!AJQueryDefault.$) { + throw new Error("did not export $ correctly"); +} +if (!AJQueryDefault.$$) { + throw new Error("did not export $$ correctly"); +} + +if (AJQueryDefault.$ !== AJQueryExplicit.$) { + throw new Error("exported $s do not match"); +} + +if (AJQueryDefault.$$ !== AJQueryExplicit.$$) { + throw new Error("exported $$s do not match"); +} + +console.log(`\x1b[34mPASS\x1b[33m`);