Closed
Description
Logs and screenshots
Warning: Multiple attempts to register the following task(s): resetCoverage, combineCoverage, coverageReport. Only the last attempt will be registered.
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: helloWorld.spec.js (1 of 1)
HelloWorld component
√ works (101ms)
code-coverage parsed sent coverage +0ms
code-coverage wrote coverage file C:\Users\user\Desktop\code\unit-test-3\.nyc_output\out.json +6ms
code-coverage parsed sent coverage +26ms
code-coverage wrote coverage file C:\Users\user\Desktop\code\unit-test-3\.nyc_output\out.json +8ms
code-coverage NYC file C:\Users\user\Desktop\code\unit-test-3\.nyc_output\out.json has 1 key(s) +0ms
code-coverage 1 key C:\Users\user\Desktop\code\unit-test-3\src\helloWorld.spec.js file path C:\Users\user\Desktop\code\unit-test-3\src\helloWorld.spec.js +0ms
code-coverage in file C:\Users\user\Desktop\code\unit-test-3\.nyc_output\out.json all files are not found? false +0ms
code-coverage NYC file C:\Users\user\Desktop\code\unit-test-3\.nyc_output\out.json has 1 key(s) +2ms
code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'lcov', 'clover', 'json', 'json-summary' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false, exclude: 'src/serviceWorker.js' } +1ms
NYC options: {
'report-dir': './coverage',
reporter: [ 'lcov', 'clover', 'json', 'json-summary', [length]: 4 ],
extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', [length]: 6 ],
excludeAfterRemap: false,
exclude: 'src/serviceWorker.js'
}
1) "after all" hook: generateReport for "works"
1 passing (584ms)
1 failing
1) HelloWorld component
"after all" hook: generateReport for "works":
CypressError: `cy.task('coverageReport')` failed with the following error:
> Expected "exclude" to by an array
Because this error occurred during a `after all` hook we are skipping all of the remaining tests.
at http://localhost:63477/__cypress/runner/cypress_runner.js:147082:19
at tryCatcher (http://localhost:63477/__cypress/runner/cypress_runner.js:10384:23)
at Promise._settlePromiseFromHandler (http://localhost:63477/__cypress/runner/cypress_runner.js:8319:31)
at Promise._settlePromise (http://localhost:63477/__cypress/runner/cypress_runner.js:8376:18)
at Promise._settlePromise0 (http://localhost:63477/__cypress/runner/cypress_runner.js:8421:10)
at Promise._settlePromises (http://localhost:63477/__cypress/runner/cypress_runner.js:8497:18)
at _drainQueueStep (http://localhost:63477/__cypress/runner/cypress_runner.js:5091:12)
at _drainQueue (http://localhost:63477/__cypress/runner/cypress_runner.js:5084:9)
at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost:63477/__cypress/runner/cypress_runner.js:5100:5)
at Async.drainQueues (http://localhost:63477/__cypress/runner/cypress_runner.js:4970:14)
From Your Spec Code:
at Context.generateReport (http://localhost:63477/__cypress/tests?p=cypress\support\index.js:433:8)
From Node.js Internals:
Error: Expected "exclude" to by an array
at coverageReport (C:\Users\user\Desktop\code\unit-test-3\node_modules\@cypress\code-coverage\task.js:173:13)
at invoke (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\child\task.js:41:14)
at C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\util.js:48:16
at tryCatcher (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
at Function.Promise.attempt.Promise.try (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\method.js:39:29)
at Object.wrapChildPromise (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\util.js:47:28)
at Object.wrap (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\child\task.js:47:8)
at execute (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:142:12)
at EventEmitter.<anonymous> (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:235:5)
at EventEmitter.emit (events.js:210:5)
at process.<anonymous> (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\lib\plugins\util.js:25:29)
at process.emit (events.js:210:5)
at process.emit (C:\Users\user\AppData\Local\Cypress\Cache\4.7.0\Cypress\resources\app\packages\server\node_modules\source-map-support\source-map-support.js:495:21)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
Versions
- What is this plugin's version?
"@cypress/code-coverage": "^3.7.6",
- What is Cypress version?
"cypress": "^4.7.0",
- What is your operating system?
window 10 Pro 64bit
- What is the shell?
bash
- What is the Node version?
v10.16.0
- What is the NPM version? npm: 6.9.0, yarn: 1.22.4
- How do you instrument your application?
"@cypress/instrument-cra": "^1.1.1"
- 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?
{C:\Users\user\Desktop\code\unit-test-3\src\App.tsx: {…}, C:\Users\user\Desktop\code\unit-test-3\src\index.tsx: {…}}
C:\Users\user\Desktop\code\unit-test-3\src\App.tsx:
b: {}
branchMap: {}
f: {0: 1}
fnMap:
0: {name: "App", decl: {…}, loc: {…}, line: 5}
__proto__: Object
hash: "e10cab4a9b8d8a4feca501b94e14cffbcf38e6bc"
path: "C:\Users\user\Desktop\code\unit-test-3\src\App.tsx"
s: {0: 1}
statementMap: {0: {…}}
_coverageSchema: "43e27e138ebf9cfc5966b082cf9a028302ed4184"
__proto__: Object
C:\Users\user\Desktop\code\unit-test-3\src\index.tsx:
b: {}
branchMap: {}
f: {}
fnMap: {}
hash: "288c160e67cc5ba6a3d1acff539a694e465041a0"
path: "C:\Users\user\Desktop\code\unit-test-3\src\index.tsx"
s: {0: 1}
statementMap: {0: {…}}
_coverageSchema: "43e27e138ebf9cfc5966b082cf9a028302ed4184"
__proto__: Object
__proto__: Object
- Is there
.nyc_output
folder? Is there.nyc_output/out.json
file. Is it empty? Can you paste at least part of it so we can see the keys and file paths?
{
"C:\\Users\\user\\Desktop\\code\\unit-test-3\\src\\helloWorld.spec.js": {
"path": "C:\\Users\\user\\Desktop\\code\\unit-test-3\\src\\helloWorld.spec.js",
"statementMap": {
"0": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 6,
"column": 1
}
},
"1": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 29
}
},
"2": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 14,
"column": 3
}
},
"3": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 13,
"column": 5
}
},
"4": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 26
}
},
"5": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 57
}
}
},
"fnMap": {
"0": {
"name": "(anonymous_0)",
"decl": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 20
}
},
"loc": {
"start": {
"line": 4,
"column": 30
},
"end": {
"line": 6,
"column": 1
}
},
"line": 4
},
"1": {
"name": "(anonymous_1)",
"decl": {
"start": {
"line": 8,
"column": 33
},
"end": {
"line": 8,
"column": 34
}
},
"loc": {
"start": {
"line": 8,
"column": 39
},
"end": {
"line": 14,
"column": 1
}
},
"line": 8
},
"2": {
"name": "(anonymous_2)",
"decl": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 15
}
},
"loc": {
"start": {
"line": 9,
"column": 20
},
"end": {
"line": 13,
"column": 3
}
},
"line": 9
}
},
"branchMap": {},
"s": {
"0": 10,
"1": 10,
"2": 10,
"3": 10,
"4": 10,
"5": 10,
"6": 5
},
"f": {
"0": 10,
"1": 10,
"2": 10,
"3": 5
},
"b": {
"0": [
0,
8
]
},
"_coverageSchema": "43e27e138ebf9cfc5966b082cf9a028302ed4184",
"hash": "096ff8945ca6aa9e2370d7bf2712b022a7248fca"
}
}
- Do you have any custom NYC settings in
package.json
(nyc
object) or in other NYC config files
"nyc": {
"exclude": "src/serviceWorker.js"
}
- Do you run Cypress tests in a Docker container?
No
Describe the bug
When I type yarn npx cypress run --spec "src/helloWorld.spec.js"
an error occurs like above.
Link to the repo
https://github.com/qkreltms/cypress-react-typescript-example