{
  "doc": {
    "id": "app/references/module-api",
    "title": "Module API: How to run Cypress via Node.js",
    "description": "Require Cypress as a node module from your application under test and run Cypress via Node.js.",
    "section": "app",
    "source_path": "/llm/markdown/app/references/module-api.md",
    "version": "e6988a974973e9090ce70406c38cb2b9e0eac9fa",
    "updated_at": "2026-05-15T15:50:22.536Z",
    "headings": [
      {
        "id": "app/references/module-api#module-api",
        "text": "Module API",
        "level": 1
      },
      {
        "id": "app/references/module-api#cypress-run",
        "text": "cypress.run()",
        "level": 2
      },
      {
        "id": "app/references/module-api#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "app/references/module-api#examples",
        "text": "Examples",
        "level": 3
      },
      {
        "id": "app/references/module-api#run-a-single-spec-file",
        "text": "Run a single spec file",
        "level": 4
      },
      {
        "id": "app/references/module-api#run-specs-using-wildcard",
        "text": "Run specs using wildcard",
        "level": 4
      },
      {
        "id": "app/references/module-api#programmatically-control-which-browser-to-run",
        "text": "Programmatically control which browser to run",
        "level": 4
      },
      {
        "id": "app/references/module-api#use-modern-syntax",
        "text": "Use modern syntax",
        "level": 4
      },
      {
        "id": "app/references/module-api#results",
        "text": "Results",
        "level": 3
      },
      {
        "id": "app/references/module-api#handling-errors",
        "text": "Handling errors",
        "level": 3
      },
      {
        "id": "app/references/module-api#cypress-open",
        "text": "cypress.open()",
        "level": 2
      },
      {
        "id": "app/references/module-api#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "app/references/module-api#example",
        "text": "Example",
        "level": 3
      },
      {
        "id": "app/references/module-api#cypress-cli",
        "text": "cypress.cli",
        "level": 2
      },
      {
        "id": "app/references/module-api#parserunarguments",
        "text": "parseRunArguments()",
        "level": 3
      },
      {
        "id": "app/references/module-api#history",
        "text": "History",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "app/references/module-api#cypress-run",
      "doc_id": "app/references/module-api",
      "heading": "cypress.run()",
      "heading_level": 2,
      "content_markdown": "## `cypress.run()`\n\nRuns Cypress tests via Node.js and resolve with all test results. See the [Cypress Module API recipe](https://github.com/cypress-io/cypress-example-recipes#fundamentals).\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress.run({  reporter: 'junit',  browser: 'chrome',  config: {    baseUrl: 'http://localhost:8080',    video: true,  },  env: {    apiKey: 'secret-key-12345',  },  expose: {    apiVersion: 'v2',  },})\n```\n\nYou can then run Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-run-tests.js\n```\n\n### Options\n\nJust like the [Command Line options](/llm/markdown/app/references/command-line.md) for `cypress run`, you can pass options that modify how Cypress runs.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `autoCancelAfterFailures` | _number_ | _false_ | Specify the number of failures to cancel a run being recorded to the Cloud or `false` to disable auto-cancellation. |\n| `browser` | _string_ | Specify different browser to run tests in, either by name or by filesystem path |\n| `ciBuildId` | _string_ | Specify a unique identifier for a run to enable [grouping](/llm/markdown/cloud/features/smart-orchestration/parallelization.md#Grouping-test-runs) or [parallelization](/llm/markdown/cloud/features/smart-orchestration/parallelization.md) |\n| `config` | _object_ | Specify [configuration](/llm/markdown/app/references/configuration.md) |\n| `configFile` | _string_ | Path to the [configuration file](/llm/markdown/app/references/configuration.md#Configuration-File) to be used. |\n| `env` | _object_ | Specify secret [environment variables](/llm/markdown/app/guides/environment-variables.md) |\n| `expose` | _object_ | Specify public [exposed variables](/llm/markdown/api/cypress-api/expose.md) |\n| `group` | _string_ | [Group](/llm/markdown/cloud/features/smart-orchestration/parallelization.md#Grouping-test-runs) recorded tests together under a single run |\n| `headed` | _boolean_ | Displays the browser instead of running headlessly |\n| `headless` | _boolean_ | Hide the browser instead of running headed (default during `cypress run`) |\n| `key` | _string_ | Specify your secret record key |\n| `exit` | _boolean_ | Whether to close Cypress after all tests run |\n| `parallel` | _boolean_ | Run recorded specs in [parallel](/llm/markdown/cloud/features/smart-orchestration/parallelization.md) across multiple machines |\n| `port` | _number_ | Override default port |\n| `posixExitCodes` | _boolean_ | Exit with a POSIX-compliant exit code rather than the number of failed tests. |\n| `project` | _string_ | Path to a specific project |\n| `quiet` | _boolean_ | If passed, Cypress output will not be printed to `stdout`. Only output from the configured [Mocha reporter](/llm/markdown/app/tooling/reporters.md) will print. |\n| `record` | _boolean_ | Whether to record the test run |\n| `reporter` | _string_ | Specify a [Mocha reporter](/llm/markdown/app/tooling/reporters.md) |\n| `reporterOptions` | _object_ | Specify [Mocha reporter](/llm/markdown/app/tooling/reporters.md) options |\n| `runnerUi` | _boolean_ | Whether to display the Cypress Runner UI. Defaults to `false` when [Test Replay](/llm/markdown/cloud/features/test-replay.md) is enabled. Otherwise defaults to `true`. |\n| `slowTestThreshold` | _number_ | Time, in milliseconds, to consider a test \"slow\" during `cypress run`. A slow test will display in orange text in the default reporter. |\n| `spec` | _string_ | Specify the specs to run, see examples below |\n| `tag` | _string_ | Identify a run with a tag or tags |\n| `testingType` | _string_ | Specify the type of tests to execute; either `e2e` or `component`. Defaults to `e2e` |\n\n### Examples\n\n#### Run a single spec file\n\nHere is an example of programmatically running a spec file. Note that the file path is relative to the current working directory.\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress  .run({    // the path is relative to the current working directory    spec: './cypress/e2e/examples/actions.cy.js',  })  .then((results) => {    console.log(results)  })  .catch((err) => {    console.error(err)  })\n```\n\nYou can then run Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-run-tests.js\n```\n\n#### Run specs using wildcard\n\nYou can pass a wildcard pattern to run all matching spec files\n\n```\nconst cypress = require('cypress')cypress.run({  // the wildcard path is relative to the current working directory  spec: './cypress/e2e/**/api*.js',})\n```\n\n#### Programmatically control which browser to run\n\nYou can pass a browser option to specify which browser to run tests in so that you can programmatically control which specs to run in each browser.\n\n```\n// run 'node cypress-chrome.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/chrome-test*.js',  browser: 'chrome',})\n```\n\n```\n// run 'node cypress-firefox.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/firefox-test*.js',  browser: 'firefox',})\n```\n\n#### Use modern syntax\n\nIf your Node version allows you can use the modern `async / await` syntax to wait for the Promise returned by the `cypress.run` method.\n\n```\nconst cypress = require('cypress');(async () => {  const results = await cypress.run()  // use the results object})()\n```\n\n### Results\n\n`cypress.run()` returns a `Promise` that resolves with an object containing the tests results. A typical run could return something like this:\n\n```\n{  \"cypressVersion\": \"3.0.2\",  \"endedTestsAt\": \"2018-07-11T17:53:35.675Z\",  \"browserName\": \"electron\",  \"browserPath\": \"path/to/browser\",  \"browserVersion\": \"59.0.3071.115\",  \"config\": {...},  \"osName\": \"darwin\",  \"osVersion\": \"14.5.0\",  \"runs\": [{    \"error\": null,    \"reporter\": \"spec\",    \"reporterStats\": {...},    \"spec\": {...},    \"stats\": {      \"suites\": 1,      \"tests\": 1,      \"passes\": 0,      \"pending\": 0,      \"skipped\": 0,      \"failures\": 1,      \"startedAt\": \"2020-08-05T08:38:37.589Z\",      \"endedAt\": \"2018-07-11T17:53:35.675Z\",      \"duration\": 1171    },    \"screenshots\": [{      \"name\": null,      \"takenAt\": \"2020-08-05T08:52:20.432Z\",      \"path\": \"User/janelane/my-app/cypress/screenshots/cy.js/test (failed).png\",      \"height\": 720,      \"width\": 1280    }],    \"tests\": [{      \"title\": [ \"test\" ],      \"state\": \"failed\",      \"displayError\": \"AssertionError: expected true to be false\\n' +      '    at Context.eval (...cypress/e2e/cy.js:5:21\",      \"attempts\": [{        \"state\": \"failed\",      }],    }],    \"video\": \"User/janelane/my-app/cypress/videos/abc123.mp4\"  }],  \"runUrl\": \"https://cloud.cypress.io/projects/def456/runs/12\",  \"startedTestsAt\": \"2018-07-11T17:53:35.463Z\",  \"totalDuration\": 212,  \"totalFailed\": 1,  \"totalPassed\": 0,  \"totalPending\": 0,  \"totalSkipped\": 0,  \"totalSuites\": 1,  \"totalTests\": 1,}\n```\n\nYou can find the TypeScript definition for the results object in the [`cypress/cli/types` folder](https://github.com/cypress-io/cypress/tree/develop/cli/types).\n\n### Handling errors\n\nEven when tests fail or a spec errors, the `Promise` resolves with the test results. If a spec errors, the error message will be in the `runs` array under the `error` field. The `Promise` is only rejected if Cypress cannot run for some reason (for example if a binary has not been installed or it cannot find a module dependency). In that case, the `Promise` will be rejected with a detailed error.\n\nThere is a third option - Cypress could run, but the tests could not start for some reason. In that case the resolved value is an object with two fields\n\n```\n{  \"failures\": 1,    // non-zero number  \"message\": \"...\"  // error message}\n```\n\nIn order to handle these possible errors, you can add a `catch` to `cypress.run()`:\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress.run({...}).then(result => {  if (result.failures) {    console.error('Could not execute tests')    console.error(result.message)    process.exit(result.failures)  }  // exit with the number of failed tests as exit code  process.exit(result.totalFailed)}).catch(err => {  console.error(err.message)  process.exit(1)})\n```\n",
      "section": "app",
      "anchors": [
        "cypress-run"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 1371
    },
    {
      "id": "app/references/module-api#options",
      "doc_id": "app/references/module-api",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\nJust like the [Command Line options](/llm/markdown/app/references/command-line.md) for `cypress run`, you can pass options that modify how Cypress runs.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `autoCancelAfterFailures` | _number_ | _false_ | Specify the number of failures to cancel a run being recorded to the Cloud or `false` to disable auto-cancellation. |\n| `browser` | _string_ | Specify different browser to run tests in, either by name or by filesystem path |\n| `ciBuildId` | _string_ | Specify a unique identifier for a run to enable [grouping](/llm/markdown/cloud/features/smart-orchestration/parallelization.md#Grouping-test-runs) or [parallelization](/llm/markdown/cloud/features/smart-orchestration/parallelization.md) |\n| `config` | _object_ | Specify [configuration](/llm/markdown/app/references/configuration.md) |\n| `configFile` | _string_ | Path to the [configuration file](/llm/markdown/app/references/configuration.md#Configuration-File) to be used. |\n| `env` | _object_ | Specify secret [environment variables](/llm/markdown/app/guides/environment-variables.md) |\n| `expose` | _object_ | Specify public [exposed variables](/llm/markdown/api/cypress-api/expose.md) |\n| `group` | _string_ | [Group](/llm/markdown/cloud/features/smart-orchestration/parallelization.md#Grouping-test-runs) recorded tests together under a single run |\n| `headed` | _boolean_ | Displays the browser instead of running headlessly |\n| `headless` | _boolean_ | Hide the browser instead of running headed (default during `cypress run`) |\n| `key` | _string_ | Specify your secret record key |\n| `exit` | _boolean_ | Whether to close Cypress after all tests run |\n| `parallel` | _boolean_ | Run recorded specs in [parallel](/llm/markdown/cloud/features/smart-orchestration/parallelization.md) across multiple machines |\n| `port` | _number_ | Override default port |\n| `posixExitCodes` | _boolean_ | Exit with a POSIX-compliant exit code rather than the number of failed tests. |\n| `project` | _string_ | Path to a specific project |\n| `quiet` | _boolean_ | If passed, Cypress output will not be printed to `stdout`. Only output from the configured [Mocha reporter](/llm/markdown/app/tooling/reporters.md) will print. |\n| `record` | _boolean_ | Whether to record the test run |\n| `reporter` | _string_ | Specify a [Mocha reporter](/llm/markdown/app/tooling/reporters.md) |\n| `reporterOptions` | _object_ | Specify [Mocha reporter](/llm/markdown/app/tooling/reporters.md) options |\n| `runnerUi` | _boolean_ | Whether to display the Cypress Runner UI. Defaults to `false` when [Test Replay](/llm/markdown/cloud/features/test-replay.md) is enabled. Otherwise defaults to `true`. |\n| `slowTestThreshold` | _number_ | Time, in milliseconds, to consider a test \"slow\" during `cypress run`. A slow test will display in orange text in the default reporter. |\n| `spec` | _string_ | Specify the specs to run, see examples below |\n| `tag` | _string_ | Identify a run with a tag or tags |\n| `testingType` | _string_ | Specify the type of tests to execute; either `e2e` or `component`. Defaults to `e2e` |\n",
      "section": "app",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 563
    },
    {
      "id": "app/references/module-api#examples",
      "doc_id": "app/references/module-api",
      "heading": "Examples",
      "heading_level": 3,
      "content_markdown": "### Examples\n\n#### Run a single spec file\n\nHere is an example of programmatically running a spec file. Note that the file path is relative to the current working directory.\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress  .run({    // the path is relative to the current working directory    spec: './cypress/e2e/examples/actions.cy.js',  })  .then((results) => {    console.log(results)  })  .catch((err) => {    console.error(err)  })\n```\n\nYou can then run Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-run-tests.js\n```\n\n#### Run specs using wildcard\n\nYou can pass a wildcard pattern to run all matching spec files\n\n```\nconst cypress = require('cypress')cypress.run({  // the wildcard path is relative to the current working directory  spec: './cypress/e2e/**/api*.js',})\n```\n\n#### Programmatically control which browser to run\n\nYou can pass a browser option to specify which browser to run tests in so that you can programmatically control which specs to run in each browser.\n\n```\n// run 'node cypress-chrome.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/chrome-test*.js',  browser: 'chrome',})\n```\n\n```\n// run 'node cypress-firefox.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/firefox-test*.js',  browser: 'firefox',})\n```\n\n#### Use modern syntax\n\nIf your Node version allows you can use the modern `async / await` syntax to wait for the Promise returned by the `cypress.run` method.\n\n```\nconst cypress = require('cypress');(async () => {  const results = await cypress.run()  // use the results object})()\n```\n",
      "section": "app",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 299
    },
    {
      "id": "app/references/module-api#run-a-single-spec-file",
      "doc_id": "app/references/module-api",
      "heading": "Run a single spec file",
      "heading_level": 4,
      "content_markdown": "#### Run a single spec file\n\nHere is an example of programmatically running a spec file. Note that the file path is relative to the current working directory.\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress  .run({    // the path is relative to the current working directory    spec: './cypress/e2e/examples/actions.cy.js',  })  .then((results) => {    console.log(results)  })  .catch((err) => {    console.error(err)  })\n```\n\nYou can then run Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-run-tests.js\n```\n",
      "section": "app",
      "anchors": [
        "run-a-single-spec-file"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 105
    },
    {
      "id": "app/references/module-api#run-specs-using-wildcard",
      "doc_id": "app/references/module-api",
      "heading": "Run specs using wildcard",
      "heading_level": 4,
      "content_markdown": "#### Run specs using wildcard\n\nYou can pass a wildcard pattern to run all matching spec files\n\n```\nconst cypress = require('cypress')cypress.run({  // the wildcard path is relative to the current working directory  spec: './cypress/e2e/**/api*.js',})\n```\n",
      "section": "app",
      "anchors": [
        "run-specs-using-wildcard"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 48
    },
    {
      "id": "app/references/module-api#programmatically-control-which-browser-to-run",
      "doc_id": "app/references/module-api",
      "heading": "Programmatically control which browser to run",
      "heading_level": 4,
      "content_markdown": "#### Programmatically control which browser to run\n\nYou can pass a browser option to specify which browser to run tests in so that you can programmatically control which specs to run in each browser.\n\n```\n// run 'node cypress-chrome.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/chrome-test*.js',  browser: 'chrome',})\n```\n\n```\n// run 'node cypress-firefox.js'const cypress = require('cypress')cypress.run({  spec: './cypress/e2e/**/firefox-test*.js',  browser: 'firefox',})\n```\n",
      "section": "app",
      "anchors": [
        "programmatically-control-which-browser-to-run"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 80
    },
    {
      "id": "app/references/module-api#use-modern-syntax",
      "doc_id": "app/references/module-api",
      "heading": "Use modern syntax",
      "heading_level": 4,
      "content_markdown": "#### Use modern syntax\n\nIf your Node version allows you can use the modern `async / await` syntax to wait for the Promise returned by the `cypress.run` method.\n\n```\nconst cypress = require('cypress');(async () => {  const results = await cypress.run()  // use the results object})()\n```\n",
      "section": "app",
      "anchors": [
        "use-modern-syntax"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 63
    },
    {
      "id": "app/references/module-api#results",
      "doc_id": "app/references/module-api",
      "heading": "Results",
      "heading_level": 3,
      "content_markdown": "### Results\n\n`cypress.run()` returns a `Promise` that resolves with an object containing the tests results. A typical run could return something like this:\n\n```\n{  \"cypressVersion\": \"3.0.2\",  \"endedTestsAt\": \"2018-07-11T17:53:35.675Z\",  \"browserName\": \"electron\",  \"browserPath\": \"path/to/browser\",  \"browserVersion\": \"59.0.3071.115\",  \"config\": {...},  \"osName\": \"darwin\",  \"osVersion\": \"14.5.0\",  \"runs\": [{    \"error\": null,    \"reporter\": \"spec\",    \"reporterStats\": {...},    \"spec\": {...},    \"stats\": {      \"suites\": 1,      \"tests\": 1,      \"passes\": 0,      \"pending\": 0,      \"skipped\": 0,      \"failures\": 1,      \"startedAt\": \"2020-08-05T08:38:37.589Z\",      \"endedAt\": \"2018-07-11T17:53:35.675Z\",      \"duration\": 1171    },    \"screenshots\": [{      \"name\": null,      \"takenAt\": \"2020-08-05T08:52:20.432Z\",      \"path\": \"User/janelane/my-app/cypress/screenshots/cy.js/test (failed).png\",      \"height\": 720,      \"width\": 1280    }],    \"tests\": [{      \"title\": [ \"test\" ],      \"state\": \"failed\",      \"displayError\": \"AssertionError: expected true to be false\\n' +      '    at Context.eval (...cypress/e2e/cy.js:5:21\",      \"attempts\": [{        \"state\": \"failed\",      }],    }],    \"video\": \"User/janelane/my-app/cypress/videos/abc123.mp4\"  }],  \"runUrl\": \"https://cloud.cypress.io/projects/def456/runs/12\",  \"startedTestsAt\": \"2018-07-11T17:53:35.463Z\",  \"totalDuration\": 212,  \"totalFailed\": 1,  \"totalPassed\": 0,  \"totalPending\": 0,  \"totalSkipped\": 0,  \"totalSuites\": 1,  \"totalTests\": 1,}\n```\n\nYou can find the TypeScript definition for the results object in the [`cypress/cli/types` folder](https://github.com/cypress-io/cypress/tree/develop/cli/types).\n",
      "section": "app",
      "anchors": [
        "results"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 197
    },
    {
      "id": "app/references/module-api#handling-errors",
      "doc_id": "app/references/module-api",
      "heading": "Handling errors",
      "heading_level": 3,
      "content_markdown": "### Handling errors\n\nEven when tests fail or a spec errors, the `Promise` resolves with the test results. If a spec errors, the error message will be in the `runs` array under the `error` field. The `Promise` is only rejected if Cypress cannot run for some reason (for example if a binary has not been installed or it cannot find a module dependency). In that case, the `Promise` will be rejected with a detailed error.\n\nThere is a third option - Cypress could run, but the tests could not start for some reason. In that case the resolved value is an object with two fields\n\n```\n{  \"failures\": 1,    // non-zero number  \"message\": \"...\"  // error message}\n```\n\nIn order to handle these possible errors, you can add a `catch` to `cypress.run()`:\n\n```\n// e2e-run-tests.jsconst cypress = require('cypress')cypress.run({...}).then(result => {  if (result.failures) {    console.error('Could not execute tests')    console.error(result.message)    process.exit(result.failures)  }  // exit with the number of failed tests as exit code  process.exit(result.totalFailed)}).catch(err => {  console.error(err.message)  process.exit(1)})\n```\n",
      "section": "app",
      "anchors": [
        "handling-errors"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 223
    },
    {
      "id": "app/references/module-api#cypress-open",
      "doc_id": "app/references/module-api",
      "heading": "cypress.open()",
      "heading_level": 2,
      "content_markdown": "## `cypress.open()`\n\nOpen Cypress tests via Node.js.\n\n```\n// e2e-open-tests.jsconst cypress = require('cypress')cypress.open({  config: {    baseUrl: 'http://localhost:8080',  },  env: {    apiKey: 'secret-key-12345',  },  expose: {    apiVersion: 'v2',  },})\n```\n\nYou can then open Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-open-tests.js\n```\n\n### Options\n\nJust like the [Command Line options](/llm/markdown/app/references/command-line.md), you can pass options that modify how Cypress runs.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `browser` | _string_ | Specify a filesystem path to a custom browser |\n| `config` | _object_ | Specify [configuration](/llm/markdown/app/references/configuration.md) |\n| `configFile` | _string_ | Path to the [configuration file](/llm/markdown/app/references/configuration.md#Configuration-File) to be used. |\n| `detached` | _boolean_ | Open Cypress in detached mode |\n| `env` | _object_ | Specify secret [environment variables](/llm/markdown/app/guides/environment-variables.md) |\n| `expose` | _object_ | Specify public [exposed variables](/llm/markdown/api/cypress-api/expose.md) |\n| `global` | _boolean_ | Run in global mode |\n| `port` | _number_ | Override default port |\n| `project` | _string_ | Path to a specific project |\n| `testingType` | _string_ | Specify the type of tests to execute; either `e2e` or `component`. Defaults to `e2e` |\n\n### Example\n\n```\n// e2e-open-tests.jsconst cypress = require('cypress')cypress.open({})\n```\n\nYou can then open Cypress by running the following in your terminal or an npm script:\n\n```\nnode e2e-open-tests.js\n```\n",
      "section": "app",
      "anchors": [
        "cypress-open"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 301
    },
    {
      "id": "app/references/module-api#options",
      "doc_id": "app/references/module-api",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\nJust like the [Command Line options](/llm/markdown/app/references/command-line.md), you can pass options that modify how Cypress runs.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `browser` | _string_ | Specify a filesystem path to a custom browser |\n| `config` | _object_ | Specify [configuration](/llm/markdown/app/references/configuration.md) |\n| `configFile` | _string_ | Path to the [configuration file](/llm/markdown/app/references/configuration.md#Configuration-File) to be used. |\n| `detached` | _boolean_ | Open Cypress in detached mode |\n| `env` | _object_ | Specify secret [environment variables](/llm/markdown/app/guides/environment-variables.md) |\n| `expose` | _object_ | Specify public [exposed variables](/llm/markdown/api/cypress-api/expose.md) |\n| `global` | _boolean_ | Run in global mode |\n| `port` | _number_ | Override default port |\n| `project` | _string_ | Path to a specific project |\n| `testingType` | _string_ | Specify the type of tests to execute; either `e2e` or `component`. Defaults to `e2e` |\n",
      "section": "app",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 197
    },
    {
      "id": "app/references/module-api#cypress-cli",
      "doc_id": "app/references/module-api",
      "heading": "cypress.cli",
      "heading_level": 2,
      "content_markdown": "## `cypress.cli`\n\n### `parseRunArguments()`\n\nIf you are writing a tool that wraps around the `cypress.run()` command, you might want to parse user-supplied command line arguments using the same logic as `cypress run` uses. In that case, you can use the included `parseRunArguments` function.\n\n```\n// wrapper.jsconst cypress = require('cypress')const runOptions = await cypress.cli.parseRunArguments(process.argv.slice(2))const results = await cypress.run(runOptions)// process the \"cypress.run()\" results\n```\n\nAn example use running from your terminal could be:\n\n```\nnode ./wrapper cypress run --browser chrome --config ...\n```\n\n**Note:** the arguments passed to `parseRunArguments` should start with `cypress run`.\n",
      "section": "app",
      "anchors": [
        "cypress-cli"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 123
    },
    {
      "id": "app/references/module-api#parserunarguments",
      "doc_id": "app/references/module-api",
      "heading": "parseRunArguments()",
      "heading_level": 3,
      "content_markdown": "### `parseRunArguments()`\n\nIf you are writing a tool that wraps around the `cypress.run()` command, you might want to parse user-supplied command line arguments using the same logic as `cypress run` uses. In that case, you can use the included `parseRunArguments` function.\n\n```\n// wrapper.jsconst cypress = require('cypress')const runOptions = await cypress.cli.parseRunArguments(process.argv.slice(2))const results = await cypress.run(runOptions)// process the \"cypress.run()\" results\n```\n\nAn example use running from your terminal could be:\n\n```\nnode ./wrapper cypress run --browser chrome --config ...\n```\n\n**Note:** the arguments passed to `parseRunArguments` should start with `cypress run`.\n",
      "section": "app",
      "anchors": [
        "parserunarguments"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 120
    },
    {
      "id": "app/references/module-api#history",
      "doc_id": "app/references/module-api",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [15.10.0](/llm/markdown/app/references/changelog.md#15-10-0) | Added `expose` configuration option. |\n| [15.4.0](/llm/markdown/app/references/changelog.md#15-4-0) | Added `posixExitCodes` to run options. |\n| [12.6.0](/llm/markdown/app/references/changelog.md#12-6-0) | Added `autoCancelAfterFailures` to run options. |\n| [10.0.0](/llm/markdown/app/references/changelog.md#10-0-0) | `slowTestThreshold` is now scoped to each testing type. |\n| [8.7.0](/llm/markdown/app/references/changelog.md#8-7-0) | Added `slowTestThreshold` configuration option. |\n| [7.3.0](/llm/markdown/app/references/changelog.md#7-3-0) | Added `testingType` configuration option. |\n| [5.0.0](/llm/markdown/app/references/changelog.md#5-0-0) | Test results returned from `cypress.run()` changed. |\n| [4.11.0](/llm/markdown/app/references/changelog.md#4-11-0) | Added `cypress.cli` with `parseRunArguments` function. |\n| [4.9.0](/llm/markdown/app/references/changelog.md#4-9-0) | Added `quiet` option to `cypress.run()` |\n",
      "section": "app",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/app/references/module-api.json",
      "token_estimate": 125
    }
  ]
}