【发布时间】:2016-01-13 14:51:17
【问题描述】:
根据system.js documentation,应该可以用wildcards为system.js配置paths。但是,我一直无法让它工作。我有一个带有茉莉花单元测试的 specRunner,我按照angular2 testing tutorial 插入了一个脚本部分,以便显示规范。但是,当我想导入 *.spec.js 以引入所有测试时,这需要我手动导入 每个规范。这是我的 SpecRunner.html,显示了哪些代码有效,哪些无效。
<script>
// Configure systemjs to use the .js extension for imports from the src/js folder
System.config({
packages: {
'src/js': {defaultExtension: 'js'}
}
});
// Import spec files: Does NOT work
System.paths['specs'] = 'src/js/*.spec';
Promise.all([
System.import('specs')
])
// Import spec files: Does work
System.paths['specs'] = 'src/js/greeter.spec';
Promise.all([
System.import('specs'),
])
// Import spec files: Does work
Promise.all([
System.import('src/js/greeter.spec')
])
</script>
谁能告诉我是否可以使用通配符为 system.js 配置路径?
【问题讨论】:
标签: javascript jasmine angular systemjs