I have this JSON file :
{
"Address": [{
"street": "rue de la paix",
"zipcode": "3049"
}, {
"street": "champs de mars",
"zipcode": "2303"
}]
}
Which is valid. I'm trying to read that file in one of my Jasmine specifications. When I ajax it I get my file contents and everything works fine.
But, when I launch my test maven
in console log I get error Uncaught SyntaxError: Unexpected token : in the second line, just after the "Address".
And if I remove the ":" the error disappears but I can no longer read the file (which is very understandable).
Code of maven goal is defined as follows:
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<specRunnerTemplate>REQUIRE_JS</specRunnerTemplate>
<preloadSources>
<source>jsonResources/testjson.json</source>
</preloadSources>
<specIncludes>
<include>**/*.spec.js</include>
</specIncludes>
</configuration>
</plugin>
Had anyone had a similar problem ?
Obviously maven
doesn't like json
file referenced as source. Because it is parsed as javascript code
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.