Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Commit

Permalink
fix: add types to package json, closes #139
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 10, 2021
1 parent d188897 commit 702b59b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ cy.xpath('//body').within(() => {

This explanation was shamelessly copied from [teamcapybara/capybara][capybara-xpath-trap].

## TypeScript and IntelliSense support

To properly load the types for `cy.xpath` command, add to your spec file the following comment.

```js
/// <reference types="cypress-xpath" />
```

![cypress-xpath intellisense](./images/cypress-xpath-reference.gif)

If using TypeScript, add `cypress-xpath` to the list of types to be loaded in `tsconfig.json`

```json
{
"compilerOptions": {
"types": ["cypress", "cypress-xpath"]
}
}
```

For more, see [Intelligent Code Completion](https://on.cypress.io/intellisense)

## Roadmap

- [x] wrap returned DOM nodes in jQuery [#2](https://github.com/cypress-io/cypress-xpath/issues/2)
Expand All @@ -94,6 +116,11 @@ This explanation was shamelessly copied from [teamcapybara/capybara][capybara-xp

This project is licensed under the terms of the [MIT license](/LICENSE.md).

## Additional info

- [Writing a Custom Cypress Command](https://glebbahmutov.com/blog/writing-custom-cypress-command/)
- [How to Publish Custom Cypress Command on NPM](https://glebbahmutov.com/blog/publishing-cypress-command/)

[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
[renovate-app]: https://renovateapp.com/
[capybara-xpath-trap]: https://github.com/teamcapybara/capybara/tree/3.18.0#beware-the-xpath--trap
Binary file added images/cypress-xpath-reference.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"files": [
"src"
],
"types": "src",
"author": "Gleb Bahmutov <[email protected]>",
"license": "MIT",
"bugs": {
Expand Down

0 comments on commit 702b59b

Please sign in to comment.