Sha256: fb6a8397a37697c733ee933fa8123025a9f4e9485d73ecdb035ed971fb8a9f8f

Contents?: true

Size: 1.34 KB

Versions: 26

Compression:

Stored size: 1.34 KB

Contents

const moduleCache = new Map();

function wrapModule(module) {
  if (typeof module === "function") {
    const promise = new Promise((resolve, reject) => {
      if (typeof __vitest_mocker__ === "undefined")
        return module().then(resolve, reject);
      __vitest_mocker__.prepare().finally(() => {
        module().then(resolve, reject);
      });
    });
    moduleCache.set(promise, { promise, evaluated: false });
    return promise.finally(() => moduleCache.delete(promise));
  }
  return module;
}

window.__vitest_browser_runner__ = {
  wrapModule,
  wrapDynamicImport: wrapModule,
  moduleCache,
  config: { __VITEST_CONFIG__ },
  viteConfig: { __VITEST_VITE_CONFIG__ },
  files: { __VITEST_FILES__ },
  type: { __VITEST_TYPE__ },
  contextId: { __VITEST_CONTEXT_ID__ },
  testerId: { __VITEST_TESTER_ID__ },
  provider: { __VITEST_PROVIDER__ },
  providedContext: { __VITEST_PROVIDED_CONTEXT__ },
};

const config = __vitest_browser_runner__.config;

if (config.testNamePattern)
  config.testNamePattern = parseRegexp(config.testNamePattern);

function parseRegexp(input) {
  // Parse input
  const m = input.match(/(\/?)(.+)\1([a-z]*)/i);

  // match nothing
  if (!m) return /$^/;

  // Invalid flags
  if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3]))
    return RegExp(input);

  // Create the regular expression
  return new RegExp(m[2], m[3]);
}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/@vitest/browser/dist/client/esm-client-injector.js