Doesn't support env variables on test title
dialex opened this issue · 3 comments
dialex commented
If you have a test like this:
describe(`${Cypress.env("SITE")} website`, function() { // <== this is the problem
it("is alive #fail-fast", function() {
cy.request(Cypress.config("baseUrl"))
.its("status")
.should("equal", 200)
})
Your library will fail because you have ${Cypress.env(...)}
of the test title (describe
or it
).
$ cypress run --env grep=something
====================================================================================================
(...)
Running: _fail-fast/ping.spec.js... (1 of 8)
Just tests tagged with: something
The following error was thrown by a plugin. We've stopped running your tests because a plugin crashed.
TypeError: Cannot read property 'includes' of undefined
at testName.some.part (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/cypress-select-tests/grep.js:33:34)
at Array.some (<anonymous>:null:null)
at foundTests.filter.testName (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/cypress-select-tests/grep.js:33:16)
at Array.filter (<anonymous>:null:null)
at pickTests (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/cypress-select-tests/grep.js:32:23)
at process (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/cypress-select-tests/src/itify.js:28:26)
at Stream.onend (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/cypress-select-tests/src/itify.js:52:18)
at _end (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/through/index.js:74:5)
at DestroyableTransform.onend (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/readable-stream/lib/_stream_readable.js:577:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at DestroyableTransform.emit (events.js:208:7)
at endReadableNT (/Users/dnunes/Git/Org/E2E-tests-project/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
I think this should either be fixed or documented, because it took me a couple of hours to figure it out, and others might step on the same issue.
bahmutov commented
Sure, seems like an interesting edge case, maybe place a guard there and open a pull request? It should not crash at least.
dialex commented
I don't enough JS to write the necessary code to fix this. I'll just leave the issue here so that people are warned about it. Maybe someone will come that can fix it.
MaxNamazov commented
This should be fixed by #61. No crashes now