MCPcopy Index your code
hub / github.com/nodejs/node / setupGlobalSetupTeardownFunctions

Function setupGlobalSetupTeardownFunctions

lib/internal/test_runner/utils.js:707–726  ·  view source on GitHub ↗
(globalSetupPath, cwd)

Source from the content-addressed store, hash-verified

705}
706
707async function setupGlobalSetupTeardownFunctions(globalSetupPath, cwd) {
708 let globalSetupFunction;
709 let globalTeardownFunction;
710 if (globalSetupPath) {
711 validatePath(globalSetupPath, 'options.globalSetupPath');
712 const fileURL = pathToFileURL(resolve(cwd, globalSetupPath));
713 const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
714 const globalSetupModule = await cascadedLoader
715 .import(fileURL, pathToFileURL(cwd + sep).href, kEmptyObject);
716 if (globalSetupModule.globalSetup) {
717 validateFunction(globalSetupModule.globalSetup, 'globalSetupModule.globalSetup');
718 globalSetupFunction = globalSetupModule.globalSetup;
719 }
720 if (globalSetupModule.globalTeardown) {
721 validateFunction(globalSetupModule.globalTeardown, 'globalSetupModule.globalTeardown');
722 globalTeardownFunction = globalSetupModule.globalTeardown;
723 }
724 }
725 return { __proto__: null, globalSetupFunction, globalTeardownFunction };
726}
727
728module.exports = {
729 convertStringToRegExp,

Callers 1

runBootstrapFunction · 0.85

Calls 4

importMethod · 0.80
pathToFileURLFunction · 0.50
resolveFunction · 0.50
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…