私はスケルトンプラグインを使用してaureliaプラグインを作成しましたhttps://github.com/aurelia/skeleton-plugin私は今、そのためのユニットテストを書いています。 私は、プロジェクトに追加されたカスタム要素iveに対してユニットテストを実行するために戸惑っています。私はsrcフォルダにこれを追加aurelia/skeleton-plugin custum要素のcant runテスト
<template>
<div class="firstName">${firstName}</div>
</template>
VM
import {bindable} from 'aurelia-framework';
export class MyComponent {
@bindable firstName;
}
に:私はhttp://aurelia.io/hub.html#/doc/article/aurelia/testing/latest/testing-components/3
テンプレートから 'カスタム要素をテスト' の例で開始しました。
私のテストコードは、私がオーレリア・ブートストラッパーとアウレリア・テストは、それが実行して取得するために設置JSPM
import {StageComponent} from 'aurelia-testing';
import {bootstrap} from 'aurelia-bootstrapper';
describe('MyComponent',() => {
let component;
beforeEach(() => {
component = StageComponent
.withResources('my-component')
.inView('<my-component first-name.bind="firstName"></my-component>')
.boundTo({ firstName: 'Bob' });
});
it('should render first name', done => {
component.create(bootstrap).then(() => {
const nameElement = document.querySelector('.firstName');
expect(nameElement.innerHTML).toBe('Bob');
done();
}).catch(e => { console.log(e.toString()) });
});
afterEach(() => {
component.dispose();
});
});
です。 イムは今
Error{stack: '(SystemJS) XHR error (404 Not Found) loading http://localhost:9876/base/my-component.js
がそう、それは私のコンポーネントを見つけるカルマカントのように見えるエラーを取得します。私はkarma.configファイルとjspm loadFiles:['test/setup.js'、 'test/unit/**/*。js']を確認しました。 に同様の問題が発生していますか?
更新.withResources( '私の成分').withResourcesに( 'SRC/(localhost:9876/base/src/my-component.html)をロードしています。 – user4912152