I have recently started working on a project with a Maven build structure that looks something like the following:
|- module-1/
| |- sub-module-1/
| |- sub-module-2/
| | ...
| |- web-client/
| | |- src/main/resources
| | | |- js/
| | | |- plugins/
| | |- pom.xml
| |- pom.xml
|- module-2/
| ...
|- module-n/
| |- sub-module-1/
| |- sub-module-2/
| | ...
| |- web-client/
| | |- src/main/resources
| | | |- js
| | |- karma.conf.js
| | |- pom.xml
| |- pom.xml
where the components of module-n are built on top of module-1 (among others). I am currently trying to use Karma to set up an environment for testing the web client (JavaScript) code base; however I am having some difficulties with the process.
With the current structure, I am able to launch and view the web client in module-n in my browser, which includes all the dependencies from module-1 (and others). However, when I run karma start
with the below configuration file, it fails with various 'There is no timestamp for /base/xyz.js'
and 404 errors.
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'requirejs'],
files: [
{pattern: 'src/main/resources/plugins/**/**', included: false},
{pattern: 'src/main/resources/js/main.js', included: false},
{pattern: 'src/main/resources/js/**/*.js', included: false},
{pattern: 'src/main/resources/tests/test-main.js', included: true},
{pattern: 'src/main/resources/tests/**/*spec.js', included: false}
],
exclude: [],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome', 'PhantomJS'],
singleRun: false
});
};
Additionally, debugging karma.files
shows that none of the module-1 files were loaded.
As I am pretty new to both Karma and the Maven build system, I am wondering is there a way to set up Karma to load the dependencies from module-1?