Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private scenarioHierarchyTagsFor(feature: Feature): Tag[] {
const
directories = notEmpty(feature.location.path.directory().split()),
featuresIndex = directories.indexOf('features'),
hierarchy = [ ...directories.slice(featuresIndex + 1), feature.name.value ] as string[];
const [ featureName, capabilityName, themeName ]: string[] = hierarchy.reverse();
return notEmpty([
themeName && new ThemeTag(themeName),
capabilityName && new CapabilityTag(capabilityName),
feature && new FeatureTag(featureName),
]);
}
specStarted(result: SpecResult) {
const details = this.scenarioDetailsOf(result);
this.emit(
new SceneStarts(details, this.serenity.currentTime()),
new SceneTagged(details, new FeatureTag(this.currentFeatureName()), this.serenity.currentTime()),
new TestRunnerDetected(new Name('Jasmine'), this.serenity.currentTime()),
);
}
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises tags at multiple levels')))
.next(SceneTagged, event => expect(event.tag).to.equal(new ArbitraryTag('feature-tag')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a scenario failing due to an assertion error')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that fails with assertion error')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a failing scenario')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that fails with generic error')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises capabilities')))
;
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag(`focused suite, excludes other suites and specs`)))
.next(SceneFinished, event => expect(event.outcome).to.be.instanceof(ImplementationPending))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises capabilities and themes')))
;
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('a suite')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Jasmine')))