qunitjs / js-reporters

📋 Common Reporter Interface (CRI) for JavaScript testing frameworks.
MIT License
60 stars 18 forks source link

Nested suite name #65

Closed flore77 closed 8 years ago

flore77 commented 8 years ago

Currently only tests have as suiteName a concatenated name of the nested suites.

Example:

describe('outer suite', function() {
  describe('inner suite', function() {
    it('test', function() {});
  });
});

emitted outer suite object:

{
  name: outer suite,
  ...
}

emitted inner suite object:

{
  name: inner suite
  ...
}

emitted test object:

{
  testName: test,
  suiteName: outer suite inner suite
  ...
}
jzaefferer commented 8 years ago

Its somewhat inconsistent, but not unreasonable. What do you suggest to do here?

flore77 commented 8 years ago

Yeah, it is a bit inconsistent.

I'm not sure I think we can add another property to represent the concatenated name, like:

// emitted outer suite object
{
name: outer suite,
fullName: outer suite,
...
}  

// emitted inner suite object
{
name: inner suite
fullName: outter suite > inner suite
...
}

// emitted test object
{
testName: test,
suiteName: inner suite
fullname: outer suite > inner suite > test
...
}

The fullname prop can be the concatenated name, and we should use a character to separate it, > or # or something.

Or it can be an array of names, like:

{
...
fullName: [outer suite, inner suite, test]
...
}
flore77 commented 8 years ago

I think it may be useful, because I have seen that also Karma is building a concatenated name. I don't now yet at what is using it, but if it creates it, it must be used at something.

flore77 commented 8 years ago

@jzaefferer we should also continue this one.

jzaefferer commented 8 years ago

Sure, but I'd like to finish the browserstack-runner PR, so that they can review it.

flore77 commented 8 years ago

@jzaefferer can I go for this ? I think also browserstack would benefit from this.

jzaefferer commented 8 years ago

Would you replace https://github.com/browserstack/browserstack-runner/pull/159/files#diff-885d5623bc9f0fada7aa1bcdcdde5574R30 with testName: test.fullName.join(" ")?

Alternative property name: canonicalName?

flore77 commented 8 years ago

Would you replace https://github.com/browserstack/browserstack-runner/pull/159/files#diff-885d5623bc9f0fada7aa1bcdcdde5574R30 with testName: test.fullName.join(" ")?

EDIT: Yes! So do we make the fullName property an array ?

Alternative property name: canonicalName?

Sure. But why this name ?

jzaefferer commented 8 years ago

Let's go with fullName as array.