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

Cast variable to string #4

Merged
merged 1 commit into from
Oct 3, 2022
Merged

Conversation

gregor-RW
Copy link
Contributor

@gregor-RW gregor-RW commented Oct 3, 2022

Using env approach:
CYPRESS_TESTRAIL_PROJECT_ID=55
Throws an error:

$ node_modules/.bin/cypress run 
...
Your configFile threw an error from: /var/www/cypress.config.js

The error was thrown while executing your e2e.setupNodeEvents() function:

TypeError: projectId.replace is not a function
    at ConfigService.getProjectId (/var/www/node_modules/cypress-testrail/src/services/ConfigService.js:137:31)
    at new Reporter (/var/www/node_modules/cypress-testrail/src/Reporter.js:25:40)

Using console.log we get the numeric value which is the reason for the error. The following changes cast the value into string so .replace() is a valid function.

Using env approach:
CYPRESS_TESTRAIL_PROJECT_ID=55
Throws an error:
$ node_modules/.bin/cypress run 
...
Your configFile threw an error from: /var/www/cypress.config.js

The error was thrown while executing your e2e.setupNodeEvents() function:

TypeError: projectId.replace is not a function
    at ConfigService.getProjectId (/var/www/node_modules/cypress-testrail/src/services/ConfigService.js:137:31)
    at new Reporter (/var/www/node_modules/cypress-testrail/src/Reporter.js:25:40)

Using console.log we get the numeric value which is the reason for the error. The following changes cast the value into string so .replace() is a valid function.
@boxblinkracer
Copy link
Owner

Hi

oh thank you for this
ill merge it

in the meantime (just saw the mail)
I've also restructured the unit tests and added tests for this too :)

thank you for your help

@boxblinkracer boxblinkracer merged commit 9e2802f into boxblinkracer:master Oct 3, 2022
AdityaHirapara added a commit to AdityaHirapara/cypress-testrail that referenced this pull request Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants