Skip to content

Commit ded4c4b

Browse files
authored
fix(filter): match any portion of a spec name (#270)
jasmine tests are named suite-name + spec-name. The links printed by karma-jasmine-html-reporter include links for suite-name (only). To support running the suite, allow the filter to match any part of the test name. Fixes #256
1 parent 0ae10e1 commit ded4c4b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ function getId (s) {
350350

351351
function getSpecsByName (specs, name) {
352352
specs = specs.filter(function (s) {
353-
return s.name === name
353+
return s.name.indexOf(name) !== -1
354354
})
355355
if (specs.length === 0) {
356356
throw new Error('No spec found with name: "' + name + '"')

test/adapter.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,11 @@ describe('jasmine adapter', function () {
612612
var actualSpecs = getDebugSpecToRun(location, specs)
613613
expect(actualSpecs).toEqual([mockSpecTest])
614614
})
615+
it('should match with param containing only a prefix', function () {
616+
var location = { search: '?spec=te' }
617+
var actualSpecs = getDebugSpecToRun(location, specs)
618+
expect(actualSpecs).toEqual([mockSpecTest])
619+
})
615620
it('should throw with param spec not found', function () {
616621
var location = { search: '?spec=oops' }
617622
expect(function () {

0 commit comments

Comments
 (0)