将实习生与 systemjs 一起使用
Using intern with systemjs
我目前正在考虑将实习生整合到更大的技术堆栈中,但似乎陷入困境。
大多数情况下,我关注 this article on how to test TypeScript with Intern.
我使用 nodejs 和 angular 以及转换为 ES5 的打字稿进行开发。模块格式是systemjs(不幸的是,在这种环境下是必须的)。
实习生文档中提到了测试其他模块类型,但我不确定如何根据我的需要进行调整。
如果我尝试手动绕过 systemjs require($module)
,实习生会不断通知我缺少所需的模块(模块的依赖项)。
我当前的 tsconfig-options:
"compilerOptions": {
"module": "System",
"target": "ES5",
"sourceMap": true,
"noEmitOnError": false,
"outDir": "src/scripts/js"
}
我几乎没有改动 intern 的示例配置,尽管我在官方 angular 示例测试中添加了 angular-模块。
任何提示或帮助将不胜感激
看看loaders configuration。它展示了如何使用 RequireJS 而不是 Dojo 加载器。如果 SystemJS 提供相同的 API (AMD),您应该也可以将其换入。
注意:这有点自我推销,但确实回答了问题。
SystemJS 的 AMD 支持不适用于 Intern/Dojo 的 AMD 加载程序插件。为此,我编写了 intern-systemjs-loader,一个适配器,它使用与 SystemJS 兼容的解决方案覆盖了一些 AMD 插件。
您可以 npm install
它并在 loaders configuration 中引用它。我正在使用它来避免我的 ES2015+ 代码的转译步骤,包括使用 ES2017 的 async/await.
编写异步测试
我目前正在考虑将实习生整合到更大的技术堆栈中,但似乎陷入困境。 大多数情况下,我关注 this article on how to test TypeScript with Intern.
我使用 nodejs 和 angular 以及转换为 ES5 的打字稿进行开发。模块格式是systemjs(不幸的是,在这种环境下是必须的)。
实习生文档中提到了测试其他模块类型,但我不确定如何根据我的需要进行调整。
如果我尝试手动绕过 systemjs require($module)
,实习生会不断通知我缺少所需的模块(模块的依赖项)。
我当前的 tsconfig-options:
"compilerOptions": {
"module": "System",
"target": "ES5",
"sourceMap": true,
"noEmitOnError": false,
"outDir": "src/scripts/js"
}
我几乎没有改动 intern 的示例配置,尽管我在官方 angular 示例测试中添加了 angular-模块。 任何提示或帮助将不胜感激
看看loaders configuration。它展示了如何使用 RequireJS 而不是 Dojo 加载器。如果 SystemJS 提供相同的 API (AMD),您应该也可以将其换入。
注意:这有点自我推销,但确实回答了问题。
SystemJS 的 AMD 支持不适用于 Intern/Dojo 的 AMD 加载程序插件。为此,我编写了 intern-systemjs-loader,一个适配器,它使用与 SystemJS 兼容的解决方案覆盖了一些 AMD 插件。
您可以 npm install
它并在 loaders configuration 中引用它。我正在使用它来避免我的 ES2015+ 代码的转译步骤,包括使用 ES2017 的 async/await.