Expose spec path as an array of names
This is in addition to the existing concatenated name. It's meant to support tools like IDE integrations that want to be able to filter a run to an exact set of suites/specs.
This commit is contained in:
+12
-13
@@ -250,9 +250,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
resultCallback: (result, next) => {
|
||||
this.specResultCallback_(spec, result, next);
|
||||
},
|
||||
getSpecName: function(spec) {
|
||||
return getSpecName(spec, suite);
|
||||
},
|
||||
getPath: spec => this.getSpecPath_(spec, suite),
|
||||
onStart: (spec, next) => this.specStarted_(spec, suite, next),
|
||||
description: description,
|
||||
userContext: function() {
|
||||
@@ -269,6 +267,17 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
getSpecPath_(spec, suite) {
|
||||
const path = [spec.description];
|
||||
|
||||
while (suite && suite !== this.topSuite) {
|
||||
path.unshift(suite.description);
|
||||
suite = suite.parentSuite;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
unfocusAncestor_() {
|
||||
const focusedAncestor = findFocusedAncestor(
|
||||
this.currentDeclarationSuite_
|
||||
@@ -332,15 +341,5 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
};
|
||||
}
|
||||
|
||||
function getSpecName(spec, suite) {
|
||||
const fullName = [spec.description],
|
||||
suiteFullName = suite.getFullName();
|
||||
|
||||
if (suiteFullName !== '') {
|
||||
fullName.unshift(suiteFullName);
|
||||
}
|
||||
return fullName.join(' ');
|
||||
}
|
||||
|
||||
return SuiteBuilder;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user