test init messes up project

Đang mở
#5,396 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
cli, testing

Hướng nghiên cứu

Tái hiện lỗi bằng tns create demo-test --tsc, tns test inittns test ios, sau đó kiểm tra đường dẫn CLI được báo cáo trong lib/common/mobile/mobile-core/devices-service.js. Theo dõi cách thiết lập bài kiểm thử Mocha được khởi tạo và xác định cần thay đổi gì để dự án TypeScript được tạo có thể chạy các bài kiểm thử iOS mà không gặp lỗi import.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
204
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NativeScript/nativescript-cli

Tất cả issue của NativeScript/nativescript-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.