Closed
Description
Current behavior:
Return value of Cypress.env()
is garbled when cypress.env.json
includes multibyte string.
Desired behavior:
Return value of Cypress.env()
is not garbled.
On cypress 3.4.1, I got desired behavior.
Steps to reproduce: (app code and test code)
- Create following files
// cypress/integration/garbled_test.js
const myenv = Cypress.env()
describe('garbled test', function() {
it('garbled test', function() {
expect(myenv.alphabet).to.equal('aiueo')
expect(myenv.multibyte).to.equal('あいうえお')
})
})
cypress.env.json
{
"alphabet": "aiueo",
"multibyte": "あいうえお"
}
あいうえお
is Japanese characters.
- Execute
$ npx cypress open
and selectgarbled_test.js
Versions
- Cypress 3.5.0
- macOS Mojave
Activity
jennifer-shehane commentedon Oct 24, 2019
Thank you so much for providing a full reproducible example. I also see this behavior with the code provided. I can also confirm that this is a regression introduced in 3.5.0
3.4.1
3.5.0
I have confirmed that this also takes place when setting the Environment Variable in the following ways:
cypress.env.json
env
object incypress.json
CYPRESS_multibyte=あいうえお cypress open
in terminal--env multibyte=あいうえお
in terminalThe env var shows up correctly in the configuration panel in the Desktop GUI.
[-]Cypress.env() return value is garbled in 3.5.0[/-][+]Cypress.env() return value is garbled when multibyte string in 3.5.0[/+]bahmutov commentedon Oct 24, 2019
I have added a failing test in branch
unicode-env-variables
see cypress-io/cypress-example-recipes#353bahmutov commentedon Oct 24, 2019
The env variables are incorrectly encoded in the runner block, which comes from runner/static/index.html
bahmutov commentedon Oct 24, 2019
Added logging env variables on the server side
cypress-bot commentedon Oct 24, 2019
The code for this is done in cypress-io/cypress#5451, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
cypress-bot commentedon Nov 5, 2019
Released in
3.6.0
.