codeceptjs / codeceptjs/CodeceptJS

[feature-request] export cucumber-related types

Đang mở
#2,926 3 bình luận 3 reaction 1 người được giao Được @zaxovaiko nhận Xem trên GitHub
enhancement good first issue typescript
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### What are you trying to achieve?

export `DataTable` and other cucumber-related types such that we can use it in step definitions

#### What do you get instead?

I need to manually define it on our own
```ts
interface OwnTableDefinition {
/**
* obtain an object that allows you to get a simple version of the table parsed by column or row
*/
parse(): {
/**
* returns the table as a 2-D array
*/
raw(): string[][],
/**
* returns the table as a 2-D array, without the first row
*/
rows(): string[][],
/**
* returns an array of objects where each row is converted to an object (column header is the key)
*/
hashes(): { [colName: string]: string }[],
};
rows: { [id: number]: { cells: { value: string }[] } };
}
```
```ts
Given('I have products in my cart', (table: OwnTableDefinition) => {
table.parse()
})
```

### Details

* CodeceptJS version: 3.0.7
* NodeJS Version: 12.20.1
* Operating System: MacOS

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

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

Đánh giá

Issue này chưa được đánh giá.

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.