{"version":3,"sources":["jsdelivr-header.js","/npm/mocha-esm-loader@0.0.1/mocha-esm-loader.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCJS,SAAY,OAErB,MAAM,eAEF,WAAA,CAAY,EAAO,GAEf,EAAM,MAAM,KAAK,cAAe,OAAQ,SAAU,GAElD,KAAK,YAA2B,IAAX,EACf,QACA,EAEN,KAAK,SAAW,EACpB,CAEA,YAAM,CAAO,SACH,MAAK,EAAiB,EAChC,CAEA,OAAM,CAAiB,GACnB,EAAe,GAAgB,CAC3B,sBACA,sBACA,uBACA,uBACA,uBACA,wBAGJ,MAAM,QAAkB,KAAK,EAAc,CAAE,OAAQ,oBAC/C,EAAY,GAElB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAU,OAAQ,IAClC,IACI,EAAU,SAAW,OAAO,GAAG,QAAQ,IAAI,OAAO,EAAU,GAAG,QAAQ,cAAe,UAC1F,CAAE,MAAO,GACL,KAAK,SAAS,KAAK,EAAU,GACjC,CAGJ,OAAO,CACX,CAEA,WAAA,GACI,OAAO,KAAK,QAChB,iBAGW","file":"/npm/mocha-esm-loader@0.0.1/mocha-esm-loader.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/mocha-esm-loader@0.0.1/mocha-esm-loader.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// \n\nimport { glob } from 'glob';\n\nclass MochaEsmLoader {\n\n    constructor(mocha, logger) {\n        // this is required to load describe, it, and other globals. https://www.vinnie.work/blog/2021-09-18-why-so-hard-testing-with-es6-imports\n        mocha.suite.emit('pre-require', global, 'nofile', mocha);\n\n        this.logger = typeof logger === 'undefined'\n            ? console\n            : logger;\n\n        this.failures = [];\n    }\n\n    async import(fileMatchers) {\n        await this.#importSpecFiles(fileMatchers)\n    }\n\n    async #importSpecFiles(fileMatchers) {\n        fileMatchers = fileMatchers || [\n            './test/**/*.spec.js',\n            './test/**/*.test.js',\n            './test/**/*.spec.cjs',\n            './test/**/*.test.cjs',\n            './test/**/*.spec.mjs',\n            './test/**/*.test.mjs',\n        ];\n\n        const testFiles = await glob(fileMatchers, { ignore: 'node_modules/**' });\n        const specFiles = [];\n\n        for (let i = 0; i < testFiles.length; i++) {\n            try {\n                specFiles[i] = await import(`${process.env.PWD}/${testFiles[i].replace(/^([a-z]\\/*)/, './$1')}`);\n            } catch (e) {\n                this.failures.push(testFiles[i]);\n            }\n        }\n\n        return specFiles;\n    }\n\n    getFailures() {\n        return this.failures;\n    }\n}\n\nexport default MochaEsmLoader;\n"]}