I'm having the strangest issue and hope someone else has seen this and maybe even has a fix.
Previously, I had in my grunt.js file a set of parameters to use in my protractor tests. Simple example below:
params: {
userId: "abc",
someData: ["abc"]
}
And this worked no problem. Then as my data grew I felt externalizing it to another file would be better, so I did and loaded the file with grunt.file.readJSON.
params: grunt.file.readJSON('my/external/file.json');
And the contents of the file:
{
"userId": "abc",
"someData": ["abc"]
}
Checking against params.userId
works perfectly. However if I check the length of params.someData
I get a length of 3 instead of 1. The array is changed. However, if I make one more change to someData as such:
{
"userId": "abc",
"someData": ["abc", "def"]
}
Then the array shows two elements as expected. Any ideas? How can I preserve the single element array with a string?