Instrumenting bundled code with TypeScript
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- cypress, typescript
- Ambito
- testing-qa
Direzione di ricerca
Riproduci il fallimento con DEBUG=code-coverage yarn cypress open e la configurazione @cypress/code-coverage/use-babelrc. Inizia dai file TypeScript indicati nei log, inclusi cypress/support/index.ts e cypress/tests/api/handle.spec.ts, quindi esamina la configurazione NYC segnalata. Il lavoro è completato quando i test TypeScript di Cypress sono strumentati e la loro coverage è inclusa per lib/api/handle.ts.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Logs and screenshots
Please provide debug logs by running Cypress from the terminal with DEBUG=code-coverage environment variable set, see the Debugging section of the README file.
nchiang@garchomp ~/repos/thavma (master) $ DEBUG=code-coverage yarn cypress open
code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'html', 'json' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false, all: true, extends: '@istanbuljs/nyc-config-typescript', include: [ 'pages/**', 'components/**', 'lib/**' ], exclude: [ 'pages/api/coverage.ts', '**/*.d.ts' ] } +0ms
Loaded env from /Users/nchiang/repos/thavma/.env.test.local
Loaded env from /Users/nchiang/repos/thavma/.env.local
Loaded env from /Users/nchiang/repos/thavma/.env.test
Loaded env from /Users/nchiang/repos/thavma/.env
GET /__/ 200 17.288 ms - -
GET /__cypress/runner/cypress_runner.css 200 18.783 ms - -
GET /__cypress/runner/cypress_runner.js 200 4.865 ms - -
GET /__cypress/runner/favicon.ico 200 1.298 ms - -
GET /__cypress/runner/fonts/fa-solid-900.woff2 200 1.584 ms - 76120
GET /__cypress/runner/fonts/mulish-latin-400-normal.woff2 200 1.354 ms - 31176
GET /__cypress/runner/fonts/mulish-latin-500-normal.woff2 200 1.916 ms - 31176
GET /__cypress/runner/fonts/open-sans-latin-400-normal.woff2 200 15.233 ms - 14380
GET /__cypress/iframes/__all 200 20.262 ms - -
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/support/index.ts
GET /__cypress/tests?p=cypress/support/index.ts 200 26.500 ms - 674
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/tests/api/handle.spec.ts
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/tests/api/users.spec.ts
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/tests/index.spec.ts
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/tests/join.spec.ts
GET /__cypress/tests?p=cypress/tests/api/handle.spec.ts 200 22.968 ms - 682
GET /__cypress/tests?p=cypress/tests/api/users.spec.ts 200 21.953 ms - 681
GET /__cypress/tests?p=cypress/tests/index.spec.ts 200 20.687 ms - 677
GET /__cypress/tests?p=cypress/tests/join.spec.ts 200 20.259 ms - 676
Versions
- What is this plugin's version? If this is NOT the latest released version can you try the latest version, please?
3.9.11 - If the plugin worked before in version X, but stopped after upgrading to version Y, please try the released versions between X and Y to see where the breaking change was.
- What is Cypress version?
Cypress package version: 8.7.0
Cypress binary version: 8.7.0
Electron version: 14.1.0
Bundled Node version: 14.17.0
- What is your operating system? MacOS Big Sur
- What is the shell? Bash
- What is the Node version?
16.13.0 - What is the NPM version?
8.1.0 - How do you instrument your application? Cypress does not instrument web application code, so you need to do it yourself. Yes! But I can't seem to instrument the bundled Cypress test code.
- When running tests, if you open the web application in regular browser, and open DevTools, do you see
window.__coverage__object? Can you paste a screenshot? - Is there
.nyc_outputfolder? Is there.nyc_output/out.jsonfile. Is it empty? Can you paste at least part of it so we can see the keys and file paths? - Do you have any custom NYC settings in
package.json(nycobject) or in other NYC config files
// nyc.config.js
/**
* Code coverage configuration for use with Cypress and Typescript.
* @see {@link https://docs.cypress.io/guides/tooling/code-coverage.html}
* @see {@link https://github.com/istanbuljs/nyc#selecting-files-for-coverage}
*/
module.exports = {
all: true,
extends: '@istanbuljs/nyc-config-typescript',
reporter: ['html', 'json'],
include: ['pages/**', 'components/**', 'lib/**'],
exclude: ['pages/api/coverage.ts', '**/*.d.ts'],
};
- Do you run Cypress tests in a Docker container? No.
Describe the bug
A clear and concise description of what the bug is.
I've been trying to follow your guide on achieving 100% code coverage by combining unit tests with E2E integration tests. But, all my application code is written in TypeScript and when I use the @cypress/code-coverage/use-babelrc package, I get the following error:
Error running @cypress/browserify-preprocessor:
You are attempting to preprocess a TypeScript file, but do not have TypeScript configured. Pass the 'typescript' option to enable TypeScript support.
The file: /Users/nchiang/repos/thavma/cypress/support/index.ts
Link to the repo
Bugs with a reproducible example, like an open source repo showing the bug, are the most likely to be resolved.
thavmaclub/thavma illustrates this issue; the test coverage reports that lib/api/handle.ts wasn't covered entirely, but I have unit tests just for that. However, those unit tests aren't included in the test coverage because they're not instrumented because of this bug.
Example
See #217 that is an excellent bug report example
- Lingua principale
- TypeScript
- Stelle
- 440
- Fork
- 114
- Merge medio
- 42m
- PR unite (30g)
- 19
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cypress-io/code-coverage
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 40/100
cypress-io/code-coverage#1018 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cypress-io/code-coverage#993 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
cypress-io/code-coverage#967 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
cypress-io/code-coverage#959 ·
I maintainer di solito rispondono entro 1 giorno
-
performance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
cypress-io/code-coverage#933 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cypress-io/code-coverage
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
hugomrdias/playwright-test#753 ·
I maintainer di solito rispondono entro 1 giorno
-
Review view: Daily/Weekly Review header buttons use the app-wide toolbar control styleForse già presa @colherdesopa l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
dongdongbh/Mindwtr#1515 ·
I maintainer di solito rispondono entro 1 giorno
-
pending-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
kirodotdev/Kiro#12301 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100