jasmine / IdeaJasmine

12 stars 5 forks source link

Escape Jasmine's --filter argument #20

Open koteq opened 2 years ago

koteq commented 2 years ago

Jasmine's --filter= CLI argument isn't properly escaped for Regex.

For example

describe("Utils", () => {
      describe("myFunction()", () => {
          it("works", () => {  // <-- I'm trying to run tests only for this block
              expect(true).toBeTrue();
          });
      });

    // other utils
});

Produces this command, which doesn't correctly filter

node \
    ~/p/node_modules/jasmine/bin/jasmine.js \
    "--reporter=intellij_reporter.js" \
    ~/p/tests/utils.ts \
    --filter=Utils.myFunction().works

It looks like the filter argument is directly passed to Jasmin.execute() and it's expected to be a Regex string.