{"record":{"id":"aa575cadac370acd","repo":"vitest-dev/vitest","slug":"provider-this-provider-name-does-not-support-co","errorCode":null,"errorMessage":"Provider ${this.provider.name} does not support command \"${name}\".","messagePattern":"Provider (.+?) does not support command \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/node/project.ts","lineNumber":89,"sourceCode":"      throw new Error(\n        `Invalid command name \"${name}\". Only alphanumeric characters, $ and _ are allowed.`,\n      )\n    }\n    this.commands[name] = cb\n  }\n\n  public triggerCommand = (<K extends keyof BrowserCommand>(\n    name: K,\n    context: BrowserCommandContext,\n    ...args: Parameters<BrowserCommands[K]>\n  ): ReturnType<BrowserCommands[K]> => {\n    if (name in this.commands) {\n      return this.commands[name](context, ...args)\n    }\n    if (name in this.parent.commands) {\n      return this.parent.commands[name](context, ...args)\n    }\n    throw new Error(`Provider ${this.provider.name} does not support command \"${name}\".`)\n  }) as any\n\n  wrapSerializedConfig(): SerializedConfig {\n    const config = wrapConfig(this.project.serializedConfig)\n    config.env ??= {}\n    config.env.VITEST_BROWSER_DEBUG = process.env.VITEST_BROWSER_DEBUG || ''\n    return config\n  }\n\n  async initBrowserProvider(project: TestProject): Promise<void> {\n    if (this.provider) {\n      return\n    }\n    this.provider = await getBrowserProvider(project.config.browser, project)\n    if (this.provider.initScripts) {\n      this.parent.initScripts = this.provider.initScripts\n      // make sure the script can be imported\n      const allow = this.parent.vite.config.server.fs.allow","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/browser/src/node/project.ts#L71-L107","documentation":"triggerCommand looks up the command name first in this.commands (project-browser-scoped commands) then in this.parent.commands (parent-wide builtins and user commands). If neither map contains the name, the provider is considered not to support it and the error names the provider so the user knows which provider was active.","triggerScenarios":"Calling a browser command from a test (e.g. browser.commands.foo()) that was never registered via registerCommand or via config.browser.commands; a typo in the command name; a command registered on a different project than the one running the test.","commonSituations":"Removing a plugin that registered a command but leaving calls to it in tests; renaming a command without updating call sites; running a test under a different project/instance whose commands set does not include the command.","solutions":["Check the exact command name spelling at the call site against the registration; commands are case-sensitive.","Ensure the plugin or config.browser.commands entry that registers the command is loaded for the project running the test.","If using a custom command, register it in setup files that run before the test, on the correct project.","Confirm the provider you selected actually exposes the command (some commands are provider-specific)."],"exampleFix":"// before\nbrowser.commands.takescreenshot() // typo, not registered\n// after\nbrowser.commands.takeScreenshot()","handlingStrategy":"type-guard","validationCode":"function commandAvailable(commands: Record<string, unknown>, name: string): boolean {\n  return Object.prototype.hasOwnProperty.call(commands, name)\n}","typeGuard":"function isRegistered(commands: Record<string, Function>, name: string): name is keyof typeof commands {\n  return name in commands\n}","tryCatchPattern":null,"preventionTips":["Keep command names consistent between registration and call sites.","Ensure the registering plugin/setup file is loaded for the project running the test.","Use TypeScript keyof types so a renamed command produces a compile error."],"tags":["browser-command","lookup","provider","runtime"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}