Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(filter): match any portion of a spec name #270

Merged
merged 1 commit into from May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adapter.js
Expand Up @@ -340,7 +340,7 @@ function getId (s) {

function getSpecsByName (specs, name) {
specs = specs.filter(function (s) {
return s.name === name
return s.name.indexOf(name) !== -1
})
if (specs.length === 0) {
throw new Error('No spec found with name: "' + name + '"')
Expand Down
5 changes: 5 additions & 0 deletions test/adapter.spec.js
Expand Up @@ -594,6 +594,11 @@ describe('jasmine adapter', function () {
var actualSpecs = getDebugSpecToRun(location, specs)
expect(actualSpecs).toEqual([mockSpecTest])
})
it('should match with param containing only a prefix', function () {
var location = { search: '?spec=te' }
var actualSpecs = getDebugSpecToRun(location, specs)
expect(actualSpecs).toEqual([mockSpecTest])
})
it('should throw with param spec not found', function () {
var location = { search: '?spec=oops' }
expect(function () {
Expand Down