test: commonjs can be required

This commit is contained in:
AJ ONeal 2024-08-29 17:00:20 -06:00
parent cef7e822eb
commit b47f4eeb31
No known key found for this signature in database
GPG Key ID: F1D692A76F70CF98
1 changed files with 21 additions and 0 deletions

21
tests/commonjs.cjs Normal file
View File

@ -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`);