Coverall module fails to parse string(s) - mocha.js

I'm testing my application with mocha along with istanbul.
For coverage and testing i'm using the following entries in my package.json
"test:integration": "cross-env NODE_ENV=test mocha --timeout 20000 src/api/tests/integration",
"coverage": "nyc report --reporter=text-lcov | coveralls",
The test passes, but when doing yarn coverage i'm getting an error
$ nyc report --reporter=text-lcov | coveralls
[error] "2018-08-04T21:25:57.261Z" 'error from lcovParse: ' 'Failed to parse string'
[error] "2018-08-04T21:25:57.263Z" 'input: ' ''
[error] "2018-08-04T21:25:57.263Z" 'error from convertLcovToCoveralls'
C:\Users\Mikk\Documents\GitHub\backend\node_modules\coveralls\bin\coveralls.js:18
throw err;
^
Failed to parse string
Any ideas? I even tried to reinstall the node modules, but that doesn't seem to fix anything.

I had the same set up in my package.json file and the same issues earlier today but I fixed it by refreshing my repo attached to Coveralls.io
After refreshing, I restarted build on Travis CI and it worked.
Ensure you have the following in your project root dir
.coveralls.yml -- It should contain repo_token if you're using a public repo

Related

An uncaught error was detected outside of a test

When I run all my component cypress tests locally on a Macbook pro on a react-vite project with around ~10 tests, I get the following error:
An uncaught error was detected outside of a test:
TypeError: The following error originated from your test code, not from Cypress.
> Failed to fetch dynamically imported module: http://localhost:5173/__cypress/src/cypress/support/component.ts
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
the error is not Consistant and doesn't show up on every run. It also throws on a random test every run. How can I solve this?
update: I think a possible lead could be that I import files on my project with the absolute paths pattern.
For example:
import {comp1, comp2} from 'components'
where as components is configured in my tsconfig.ts file
ok so after countless attempts to fix this and also encountering terminal freezes when I execute
cypress run.
I've gave up and created a bash script to run each of the tests in the code base separately:
set -x
#!/bin/bash
for file in $( find . -type f -name '*.spec.cy.tsx' );
do yarn cypress run --component --browser chrome --spec $file || exit 1
done
for now it seems to get the job done. Hope this helps anyone else that encounters this

Deploying KotlinJs React web app to Heroku, error extracting tar content of undefined failed

I have the following setup. Kotlin Multiplatform project with a Web App and Shared module. I also have included a build of a library that I had to modify myself as it wasn't working properly.
When trying to deploy to Heroku with these steps I get the following error
> Task :common:root:jsPackageJson
> Task :web-app:packageJson
> Task :web-app:testPackageJson
> Task :rootPackageJson
> Task :kotlinNpmInstall
warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > sockjs > uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > url > querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/LICENSE'"
> Task :firebase-kotlin-sdk:kotlinNpmInstall
error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/data/features/getcomputedstyle.js'"
> Task :firebase-kotlin-sdk:kotlinNpmInstall FAILED
> Task :kotlinNpmInstall FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase-kotlin-sdk:kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 20s
18 actionable tasks: 18 executed
! ERROR: Failed to run Gradle!
We're sorry this build is failing. If you can't find the issue in application
code, please submit a ticket so we can help: https://help.heroku.com
You can also try reverting to the previous version of the buildpack by running:
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
Thanks,
Heroku
! Push rejected, failed to compile Gradle app.
! Push failed
Tried running kotlinNpmInstall locally on both the library and the whole project and it works properly, with no failures.
While I do not know the exact cause, it seems that multiple yarn process are spawned that corrupt each other's packages.
This can be solved with the mutex option.
To add yarn options to a kotlin/js project you can add a .yarnrc file to the root of your project.
My .yarnrc's content:
--install.mutex network
This makes yarn use a predefined port on the network for its mutex.

Running only failed test cases in Cypress

While running Cypress scripts, some of the cases are getting failed. I want to run only those failed cases to run again.
How can I run only failed test cases in Cypress?
As long as its not integrated directly in Cypess, you can use a npm package like cypress-run
npm install cypress-run --save
Then edit then run command in the package.json and replace the command
cypress run by for example cypress-run --retries 4, this will retry the failed tests 4 times
Cypress has released version 5.0 which has support for retries, see https://docs.cypress.io/guides/guides/test-retries.html for more information
Just add this line in your cypress.json file.
{
"retries":2
}
It will retry your failed Test case for twice.

Specified query type "Query" not found in document when deploying to heroku

I am trying to deploy a typescript-graphql-postgres server onto heroku. The build was successful, however, when run I get the following from heroku logs:
UnhandledPromiseRejectionWarning: Error: Specified query type "Query"
not found in document. 2018-11-08T08:54:52.660051+00:00 app[web.1]: at
/app/node_modules/graphql/utilities/buildASTSchema.js:184:15
Anyone encountered and know the fix?
btw, when I run on my computer, the code works
Resolved. I need to copy graphql files into the relevant modules folders
below is what I added to my package.json for those who run into the same issue
"build": "rimraf dist && tsc && copyfiles -u 1 src/**/*.graphql dist",

Travis ci fails with mocha+coveralls

travis ci fails as the out put of reporter is empty string.
NODE_ENV=test YOURPACKAGE_COVERAGE=1 mocha --compilers coffee:coffee-script/register --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
It works fine in my local.
> mocha --compilers coffee:coffee-script/register --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
[error] "2015-04-26T12:41:57.904Z" 'error from lcovParse: ' 'Failed to parse string'
[error] "2015-04-26T12:41:57.906Z" 'input: ' ''
[error] "2015-04-26T12:41:57.906Z" 'error from convertLcovToCoveralls'
You need to tell Travis CI to install the latest node before execution:
language: node_js
node_js:
- "node"
It is because some tools is working only with latest version of node. I had the sample problem until i change version of node in my .travis.yaml:
node_js:
- "6"

Resources