// A launch configuration that compiles the extension and then opens it inside a new window
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Extension (vscode-codeql)",
      "type": "extensionHost",
      "request": "launch",
      "runtimeExecutable": "${execPath}",
      "args": [
        "--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
        // Add a reference to a workspace to open. Eg-
        // "${workspaceRoot}/../vscode-codeql-starter/vscode-codeql-starter.code-workspace"
        // "${workspaceRoot}/../codespaces-codeql/tutorial.code-workspace"
      ],
      "sourceMaps": true,
      "outFiles": [
        "${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
      ],
      "env": {
        // change to 'true' debug the IDE or Query servers
        "IDE_SERVER_JAVA_DEBUG": "false",
        "QUERY_SERVER_JAVA_DEBUG": "false",
        "CLI_SERVER_JAVA_DEBUG": "false",
        // Uncomment to set the JAVA_HOME for the codeql instance to use
        // "CODEQL_JAVA_HOME": "/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home"
      }
    },
    {
      "name": "Launch Unit Tests (vscode-codeql)",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "env": {
        "LANG": "en-US",
        "TZ": "UTC"
      },
      "args": [
        "--projects",
        "test/unit-tests"
      ],
      "stopOnEntry": false,
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    },
    {
      "name": "Launch Selected Unit Test (vscode-codeql)",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "env": {
        "LANG": "en-US",
        "TZ": "UTC"
      },
      "args": [
        "--projects",
        "test",
        "-i",
        "${relativeFile}",
        "-t",
        "${selectedText}"
      ],
      "stopOnEntry": false,
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    },
    {
      "name": "Launch Unit Tests - React (vscode-codeql)",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "args": [
        "--projects",
        "src/view"
      ],
      "stopOnEntry": false,
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    },
    {
      "name": "Launch Integration Tests - No Workspace (vscode-codeql)",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "args": [
        "--projects",
        "test/vscode-tests/no-workspace"
      ],
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "attachSimplePort": 9223,
    },
    {
      "name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "args": [
        "--projects",
        "test/vscode-tests/minimal-workspace"
      ],
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "attachSimplePort": 9223,
    },
    {
      "name": "Launch Integration Tests - With CLI",
      "type": "node",
      "request": "launch",
      "program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
      "showAsyncStacks": true,
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "args": [
        "--projects",
        "test/vscode-tests/cli-integration"
      ],
      "env": {
        // Optionally, set the version to use for the integration tests.
        // Use "nightly" to use the latest nightly build.
        // "CLI_VERSION": "2.7.0",

        // If CLI_VERSION is set to nightly, set this to the url of the nightly build.
        // "NIGHTLY_URL": "some url to grab the nightly build",

        // Optionally, add a path to the codeql executable to be used during these tests.
        // If not specified, one will be downloaded automatically.
        // This option overrides the CLI_VERSION option.
        // "CLI_PATH": "${workspaceRoot}/../semmle-code/target/intree/codeql/codeql",

        // Uncomment the last line and modify the path to a checked out
        // instance of the codeql repository so the libraries are
        // available in the workspace for the tests.
        // "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql",
      },
      "sourceMaps": true,
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "attachSimplePort": 9223,
    },
    {
      "name": "Launch Storybook",
      "type": "node",
      "request": "launch",
      "cwd": "${workspaceFolder}/extensions/ql-vscode",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run-script", "storybook"]
    }
  ]
}
