How does index.ts
in plugins ever bootstrap?
#17385
Replies: 5 comments 6 replies
-
@bahmutov , sorry to disturb you, if you ever have time, please look into this as I think you're the only guy who can give us a hint here |
Beta Was this translation helpful? Give feedback.
-
I would create a small public repo with code as a reproduction example
…Sent from my iPhone
On Jul 30, 2021, at 13:01, Nick ***@***.***> wrote:
First of all, thanks a lot for your response, I appreciate it very much :)
Secondly, actually the reproducible scenario is kinda simple, it's the mechanism behind it I'm eager to understand. So, the reproducible example for the first part of the question is just to rename your plugins/index.js into plugins/index.ts and add some types there. I don't quite get how it's compiled as I added DEBUG=cypress:* and saw preprocessor logs only after the plugins file was actually executed (test runner was opened and I clicked any spec). So I'm very eager to understand when and how the plugins/index.ts file is compiled as I never run tsc manually
Regarding my second question, the reproducible example would be to have something like this in your tsconfig.json:
"include": ["**/*.ts"] (this works, if I provide invalid inputs, this will failed when trying to run a spec) "noEmit": true (for some reason, Cypress tests are still compiled properly) "outDir": "./anydir" (ignored, even when "noEmit" is "false"
I don't get which tsconfig options influence Cypress ts => js compilation process and which don't. As far as I know, any type checkings and strict rules are ignored when Cypress compiles ts
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
No, I’m very pressed on time right now
…Sent from my iPhone
On Aug 3, 2021, at 11:59, Nick ***@***.***> wrote:
Hi again, Hleb, did you manage to have a look at the repo yet? Thanks in advance
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
I’m sorry but nowadays I only look at the things that I really need and not for support
…Sent from my iPhone
On Aug 24, 2021, at 15:12, Nick ***@***.***> wrote:
@bahmutov , to being with, sorry for disturbing you again,
Unfortunately, none except you ever responded here so I guess nobody else can really explain what's going on
If you ever happen to have several free mins you can devote to helping out, please check the repo: https://github.com/nikolayeasygenerator/typescript-cypress-example
The comments with the points I cannot understand are in two files only: cypress/plugins/index.ts and in the tsconfig file in the root
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Not sure if this is what you want but, "pluginsFile": "cypress/plugins/index.ts", This allow cypress to find the files even though its name or extension is not what it expected :). If this helps, my code start with that Be sure to send back the config at the end of this function. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Been working with Cypress with Typescript for quite some time and I've always been sure that the
index
file in theplugins
folder can be only of the.js
extension due to its nature. As I understand it, the code in this file is used to bootstrap the main Node process for Cypress and only afterwards does this process start compiling the TS internally for the browser to execute tests. So, my question is, the default pre-processor doesn't compileindex.ts
from theplugins
folder (I added debug logs and saw nothing until I ran a spec), what compiles it then? How come it's compiled properly if I never rantsc
?Also, one more point that I both googled and search in the
Issues
section is thetsconfig.json
file in thecypress
folder. As far as I understood, that file is completely ignored by Cypress during compilation so there's no way for me as a developer to adjust the compilation process? Or does it read only specific properties from the file?Thanks in advance for your explanations :)
Beta Was this translation helpful? Give feedback.
All reactions