microsoft / vscode-test-cli

Command-line runner for VS Code tests
MIT License
19 stars 7 forks source link

Question: Is it possible to clear out user-data #41

Closed roco1234 closed 3 months ago

roco1234 commented 3 months ago

Is it possible to clear out user-data on every test run without having to teardown in mocha?

connor4312 commented 3 months ago

I recommend running with --profile-temp which will create an empty temporary profile for the window.

roco1234 commented 3 months ago

@connor4312 these are the launchArgs I use. The user-data workspace state is not being cleared out after every test run.

[ "--disable-extensions", "--disable-gpu-sandbox", "--disable-updates", "--disable-workspace-trust", "--new-window", "--no-sandbox", "--profile-temp", "--skip-release-notes", "--skip-welcome" ]

connor4312 commented 3 months ago

What state specifically are you expecting to be cleared?

roco1234 commented 3 months ago

@connor4312 workspaceState and workspaceStorage. I've seen examples of --user-data-dir launchArg with os.tmpdir(). But I was wondering if there is a way to clear down the directory easily.

Using mocha rootHooks in the config causes a DataCloneError

export default defineConfig([
  {
    label,
    files,
    workspaceFolder,
    launchArgs,
    mocha: {
      timeout: 200_000,
      color: true,
      rootHooks: {
        afterEach: () => {
           //anything here will cause an error
        }
      }
    }
  },