I'm trying to setup the skeleton-navigation project for Aurelia in a new ASP.NET 5 application. I've tried numerous things and believe I'm getting close, but am really getting caught up on the client-side tests.
I downloaded the skeleton project from the Aurelia repo on GitHub and unzipped it.
I utilized Scott Allen's suggestions for setting the jspm settings to place the jspm packages in the wwwroot folder as stated in this post.
I then updated the project structure to look like this:
sln
|->wwwroot
|->dist
|->jspm_modules
|->src
|->styles
|->test
|->config.js
|->index.html
|->index.js
|->build
|->Controllers
|->doc
|->node_modules
|->aurelia.protractor.js
|->aureliafile.js
|->gulpfile.js
|->karma.conf.js
|->package.json
|->project.json
|->protractor.conf.js
|->Startup.cs
I have two questions:
1. Where should the test folder from the Aurelia skeleton-navigation startup project live? On the one hand wwwroot makes a lot of sense because that is where the rest of the application specific javascript files will live. On the other hand though, those files shouldn't ever be served to a client, so to put them in wwwroot doesn't make a whole lot of sense.
2. Once they are residing in their proper place in the project structure, what files/values need to be updated to get the tests running appropriately? For the moment I placed them in the wwwroot directory. I updated the basePath in the karma.conf.js file to 'wwwroot'. When I perform the karma start command though it is giving me a 404 error trying to locate '/base/app-bundle.js'. That file exists at 'wwwroot/dist/app-bundle.js', but I can't figure out how to configure karma to find it there.
Any help would be greatly appreciated.
Building on @PWKad's answer:
You might also need to modify the paths
property of the jspm
config object passed to Karma to prepend each path with base/
so that Karma can pick them up.
For example, my src/App/wwwroot/config.js
file looks like this
paths: {
"*": "app/*",
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
}
and my karma.conf.js
looks like this
basePath: '',
urlRoot: '/',
jspm: {
config: 'src/app/wwwroot/config.js',
packages: 'src/app/wwwroot/jspm_packages',
loadFiles: 'tests/unit/**/*.js',
serveFiles: 'src/app/wwwroot/app/**/*.js',
paths: {
"app/*": 'base/src/app/wwwroot/app/*',
"test/*": 'base/test/*',
"github:*": 'base/src/app/wwwroot/jspm_packages/github/*',
"npm:*": 'base/src/app/wwwroot/jspm_packages/npm/*'
}
}
This project has working unit tests set up for this situation. It does use Typescript, but the concept is the same.