Closed MichaelrMentele closed 2 years ago
Hello,
I have the same kind of problem, using jasmine-query with gulp
package.json
...
"devDependencies": {
[...]
"gulp": "^3.9.0",
[...]
"jasmine": "^2.5.2",
"jasmine-core": "^2.5.2",
"jasmine-jquery": "^2.1.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
[...]
}
karma.conf.js
module.exports = function(config) {
'use strict';
config.set({
autoWatch: true,
basePath: GLOBAL.dirname,
frameworks: [
'jasmine',
],
files: [
{ pattern: 'app/sources/locales/**/*.json', watched: false, served: true, included: false },
// BOWER
// bower:js
'bower_components/jquery/dist/jquery.js',
'bower_components/jquery-ui/jquery-ui.js',
'bower_components/i18next/i18next.js',
// endbower
// NPM
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
// EXTERNAL
'https://www.gstatic.com/charts/loader.js',
// JS
'app/sources/js/plugins.js',
'app/sources/js/main.js',
// TEST
'app/test/mock/**/*.js',
'app/test/spec/**/*.js',
// fixtures
{ pattern: 'app/test/mock/**/*.json', watched: true, served: true, included: false }
],
proxies: {
'/locales/': GLOBAL.dirname + '/app/sources/locales/'
},
exclude: [],
port: 8080,
browsers: [
'PhantomJS',
],
plugins: [
//'karma-chrome-launcher',
'karma-phantomjs-launcher',
//'karma-coverage',
'karma-jasmine',
],
singleRun: false,
colors: true,
logLevel: config.LOG_INFO,
//reporters: ['progress', 'coverage'],
//reporters: ['progress'],
});
};
I solved my problem in... reading the doc !
Note: If you are running your test with Karma, remember that your files are served from a base/ directory, so your path should be configured to: jasmine.getFixtures().fixturesPath = 'base/my/new/path';.
I just add base/
to my path:
jasmine.getJSONFixtures().fixturesPath = 'base/' + myCustomPath;
I have JSON fixtures in this path: spec/javascripts/fixtures/json/
I have html fixtures in: spec/javascripts/fixtures and those load just fine. However, when I try to use the JSON api eg: loadJSONFixtures(...) getJSONFixtures(...)
or any other of the available API methods to get JSON fixtures; it causes an internal server error in the jasmine server.