class ResourceLoader {
constructor(url) {
this.address = url;
}
...
RawToText(argv) {
return argv;
});
...
}
export default {
ResourceLoader,
};
import ResourceLoader from './ResourceLoader';
describe('Helpers::ResourceLoader', () => {
/* Default setup */
const domain = 'host.com';
const instanceResourceLoader = new ResourceLoader(`https://${domain}`);
...
/* Tasks */
it('Replace links from address', () => {
expect(instanceResourceLoader.RawToText('test str'))
.to.equal('test str');
});
});
PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
{
"message": "TypeError: undefined is not a constructor (evaluating 'new _ResourceLoader.ResourceLoader('https://' + domain)')\nat webpack:///src/Helpers/ResourceLoader.spec.js:26:2 <- index.js:13550",
"str": "TypeError: undefined is not a constructor (evaluating 'new _ResourceLoader.ResourceLoader('https://' + domain)')\nat webpack:///src/Helpers/ResourceLoader.spec.js:26:2 <- index.js:13550"
}
// This is a karma config file. For more details see
// http://karma-runner.github.io/0.13/config/configuration-file.html
// we are also using it with karma-webpack
// https://github.com/webpack/karma-webpack
const webpackConfig = require('../../../build/webpack.test.conf');
module.exports = function karmaConfig(config) {
config.set({
// to run in additional browsers:
// 1. install corresponding karma launcher
// http://karma-runner.github.io/0.13/config/browsers.html
// 2. add it to the `browsers` array below.
browsers: ['PhantomJS'],
frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'],
reporters: ['spec', 'coverage'],
files: [
'../../../node_modules/babel-polyfill/dist/polyfill.js',
'../../../node_modules/whatwg-fetch/fetch.js',
'./index.js'
],
preprocessors: {
'./index.js': ['webpack', 'sourcemap'],
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true,
},
coverageReporter: {
dir: '../../../test/coverage',
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' },
],
},
});
};