Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Njb/add typings #236

Closed
wants to merge 5 commits into from
Closed

Conversation

NickBolles
Copy link

@NickBolles NickBolles commented Dec 20, 2019

Add typescript typings, makes writing typescript tests much easier!

@NickBolles
Copy link
Author

@bahmutov could you take a look at this?

index.d.ts Outdated Show resolved Hide resolved
@NickBolles NickBolles requested a review from bahmutov April 9, 2020 00:42
@bahmutov
Copy link
Contributor

Hey @NickBolles I have added TS in https://github.com/bahmutov/cypress-vue-unit-test/releases/tag/v3.4.0 I think this should be enough for now

@bahmutov bahmutov closed this Jul 10, 2020
@NickBolles
Copy link
Author

NickBolles commented Jul 10, 2020

@bahmutov Sweet! I just tried it out and there are a few things missing.

First off, Cypress.vue isn't defined, unless that's changed recently, we should add this to the typings:

declare global {
  // eslint-disable-next-line no-redeclare
  namespace Cypress {
    interface Cypress {
      vue: Vue;
    }
  }
}

I'm also seeing this (which looks like it should be valid based off of the readme)
image

This probably means we need to update
This line
to be

type VueComponent = Vue.ComponentOptions<any> | Vue.VueConstructor<V>

@bahmutov bahmutov mentioned this pull request Jul 10, 2020
@bahmutov
Copy link
Contributor

@NickBolles I have added those 2 things in #354 Mind taking a look? I need a good Vue app with TS setup to really test it unfortunately

@NickBolles
Copy link
Author

@bahmutov that looks good. I can't figure out how to pull it (I thought yarn add github:buhmutov/cypress-vue-unit-test#extend-vue-type would do it, but I guess not?)

@bahmutov
Copy link
Contributor

bahmutov commented Jul 10, 2020 via email

@NickBolles
Copy link
Author

oops, that was just a miss-type into the comment though. I tried the correct spelling too :)

@bahmutov
Copy link
Contributor

@NickBolles I have released the new version and it solved my TypeScript typing for a project I scaffolded for #356

Speaking of which - @NickBolles how did you set up the WebPack / settings for transpile for TS? I have a fresh TS project and it keeps getting an error ...

@NickBolles
Copy link
Author

@bahmutov perfect.

I use nuxt, so I was messing with it in this comment, which builds a webpack processor in the ts-preporcessor file.

Since then I've packaged that up so that it's easier to do for Nuxt - cypress-nuxt

Because the rest of the webpack config is setup correctly, cypress-vue-unit-test just adds an entry point and it goes from that entry point.

@bahmutov
Copy link
Contributor

@NickBolles you should definitely add it to https://on.cypress.io/plugins#framework-tooling!

@NickBolles
Copy link
Author

NickBolles commented Jul 11, 2020

@bahmutov sweet! I submitted a PR here: cypress-io/cypress-documentation#2979

I also updated the documentation for the more recent version of cypress-vue-unit-test, let me know if you have any suggestions!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants