NativeScript / NativeScript/nativescript-cli
test init messes up project
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 1.1k
- 派生
- 204
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 8
描述
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.0.8 version and is up to date.
✔ Component @nativescript/core has 7.0.3 version and is up to date.
✔ Component @nativescript/ios has 7.0.0 version and is up to date.
✖ Component @nativescript/android is not installed.
Describe the bug
Trying to run unit tests fails with the following error:
Error: Cannot use import statement outside a module
at Errors.failWithOptions (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:157:27)
at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:130:21)
at DevicesService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:425:30)
at Generator.throw (<anonymous>)
at rejected (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:12:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
name: 'Exception',
errorCode: 127,
suggestCommandHelp: false,
proxyAuthenticationRequired: false,
printOnStdout: undefined
}
To Reproduce
tns create demo-test --tsc
tns test init #select mocha
tns test ios
Expected behavior
Tests to run.
Sample project
Additional context
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 tns create demo-test --tsc、tns test init 和 tns test ios 重现失败,然后检查 lib/common/mobile/mobile-core/devices-service.js 中报告的 CLI 路径。跟踪 Mocha 测试设置的初始化方式,并确定必须进行哪些更改,才能让生成的 TypeScript 项目在没有导入错误的情况下运行其 iOS 测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- cli, testing
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100