title: how to specify a set of tests to karma programmatically?
body: <p>so the thing is. I am building an Angular Test Explorer. I am able to see all the tests and run them all together by using the karma module like this:</p>
  
  <pre><code>  public async runWithModule(): Promise&lt;void&gt; {
      return new Promise&lt;void&gt;(resolve =&gt; {
        karma.runner.run({ port: 9876 }, (exitCode: number) =&gt; {
          global.console.log("karma run done with ", exitCode);
          resolve();
        });
      });
    }
  </code></pre>
  
  <p>I am also able to run specific set of tests creating a shell and passing --grep</p>
  
  <pre><code>const command = `karma run -- --grep="${tests}"`;
  const exec = require("child_process").exec;
  exec(command, {
    cwd: this.angularProjectRootPath + "/node_modules/karma/bin/",
  });
  </code></pre>
  
  <p>unfortunately the method for running a set of tests works different depending on the OS as the shell its different. This is giving me some problems.</p>
  
  <p>I was wondering if anybody cant point me out how is that angular cli is doing karma run and specifying a set of tests when you do a regular ng test.</p>
  
  <p>I asked in the karma repository and support without any answer so that's why I am asking here, I also tried finding that part of the code in the repository of the angular devkit. I have found where they do the karma.server but could not find the part I need.</p>