How can I fix my mocha Javascript tests for Raven/Sentry? - sentry

Half of the time that I run my tests (npm test) I get the following stack trace and it's very misleading. Any idea how I could solve this?
/node_modules/raven/lib/client.js:217
kwargs.user = extend({}, this._globalContext.user, domainContext.user, kwargs.user);
^
TypeError: Cannot read property 'user' of undefined
at Raven.process (..node_modules/raven/lib/client.js:217:50)
at ..node_modules/raven/lib/client.js:375:12
at ..node_modules/raven/lib/parsers.js:55:5
at ..node_modules/raven/lib/utils.js:259:5
at ..node_modules/raven/lib/utils.js:169:35
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

After upgrading to #sentry/node things got much better and my tests have now been passing consistently.

Related

TypeError: _jsxDEV is not a function when running User Journey exercise in Cypress tutorial

I'm running in to an issue when trying to complete this section of the Cypress Real World Testing course.
TypeError
TypeError: _jsxDEV is not a function
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
_createMdxContent
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/next-mdx-remote/dist/index.js (55:35)
MDXContent
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/next-mdx-remote/dist/index.js (55:35)
processChild
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/react-dom/cjs/react-dom-server.node.development.js (3353:14)
resolve
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/react-dom/cjs/react-dom-server.node.development.js (3270:5)
ReactDOMServerRenderer.render
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/react-dom/cjs/react-dom-server.node.development.js (3753:22)
ReactDOMServerRenderer.read
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/react-dom/cjs/react-dom-server.node.development.js (3690:29)
Object.renderToString
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/react-dom/cjs/react-dom-server.node.development.js (4298:27)
renderDocument
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/next/dist/server/render.js (736:47)
Object.renderToHTML
file:///Users/kylerchavez/Documents/GitHub/cypress-realworld-testing-course-app/node_modules/next/dist/server/render.js (819:34)
process.processTicksAndRejections
node:internal/process/task_queues (95:5)
I've tried deleting node-modules and running npm install again and I've poked around trying to figure out where that function is getting called and can't seem to find it. Any advice?

Integrating Cypress with cucumber is failing

I created a simple Cypress project to automate a website and it was working. Now I am trying to convert it into a cucumber Project and when executing the test cases, I am getting below error:
Running: Features/shopping.feature (1 of 1)
[BABEL] Note: The code generator has deoptimised the styling of C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\lodash\lodash.js as it exceeds the max of 500KB.
1) An uncaught error was detected outside of a test
0 passing (941ms)
1 failing
1) An uncaught error was detected outside of a test:
TypeError: The following error originated from your test code, not from Cypress.
> (0 , _typeof4.default) is not a function
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.
at _typeof2 (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:303:63)
at _typeof (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:317:39)
at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:23486:2332)
at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32935:14)
at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:4)
at Object.254.C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\#babel\runtime/helpers/interopRequireDefault (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:17)
at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)
at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:316)
at Object.169.babel-runtime/helpers/classCallCheck (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:9432:15)
at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)
This is how my Project Structure looks like:
I am unable to understand the reason of the issue.
Please suggest.
Please remember you need a stepDefinitions folder at least. And then, in the package.json file you should declare the Cypress Cucumber Preprocessor Style pattern.
Something like this:
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
Or:
"cypress-cucumber-preprocessor": {
"commonPath": "common",
"stepDefinitions": "step_definitions"
}
Depending on what you choose.

Cannot run in production mode

I have a donejs application and its running ok in development mode donejs develop, but when I run it in production mode:
donejs build
donejs deploy (to firebase)
NODE_ENV=production donejs start
it will not start and show an error (see CODE A)
This file: file:my-app/dist/bundles/my-app/index.js:704 corresponds to JQuery 3.x and its not a dependency of the project itself but a dependency of can-connect-feathers (https://github.com/canjs/can-connect-feathers). In fact in index.js there is also included JQuery 2.x what makes me think there might be some sort of incompatibility among them.
I already tried changing the project's dependency to JQuery 3.x but didn't help. Actually it will make even donejs develop fail (see CODE B).
I also tried the following:
cd my-app/node_modules/steal
npm install
but didn't help, another error appears and finally tried cd my-app/node_modules/can && npm install but that end up in multiple errors.
I'm using:
donejs#0.9.2
node#4.6.2
npm#2.15.11
can-connect-feathers#1.2.1
CODE A
NODE_ENV=production donejs start
my-app#0.0.0 start my-app
done-serve --proxy http://localhost:3030 --port 8080
done-serve starting on http://localhost:8080
Potentially unhandled rejection [5] TypeError: Error loading "package.json!npm" at file:my-app/package.json
Error loading "bundles/my-app/index" at file:my-app/dist/bundles/my-app/index.js
Error evaluating file:my-app/dist/bundles/my-app/index.js
Cannot read property 'createElement' of undefined
at i (file:my-app/dist/bundles/my-app/index.js:704:20)
at file:my-app/dist/bundles/my-app/index.js:1039:2881
at file:my-app/dist/bundles/my-app/index.js:1039:3580
at file:my-app/dist/bundles/my-app/index.js:268:21
at file:my-app/dist/bundles/my-app/index.js:268:27
at Object.exports.runInThisContext (vm.js:54:17)
at doEval (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:2059:10)
at __eval (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:1976:7)
at Loader.exec [as __exec] (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:339:5)
at Loader.loader.instantiate (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:1517:16)
CODE B
donejs develop
my-app#0.0.0 develop my-app
done-serve --develop --proxy http://localhost:3030 --port 8080
done-serve starting on http://localhost:8080
Potentially unhandled rejection [8] Error: Error loading "my-app#0.0.0#index.stache!done-autorender#0.8.0#autorender" at <unknown>
Error loading "can#2.3.27#util/jquery/jquery" at file:my-app/node_modules/can/util/jquery/jquery.js
Error loading "can#2.3.27#util/jquery/jquery" from "done-autorender#0.8.0#autorender" at file:my-app/node_modules/done-autorender/src/autorender.js
Did not find ./node_modules/can/node_modules/jquery/package.json
at FetchTask.utils.extend.next (file:my-app/node_modules/steal/ext/npm-crawl.js:532:11)
at file:my-app/node_modules/steal/ext/npm-crawl.js:556:33
at tryCatchReject (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1183:30)
at runContinuation1 (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1142:4)
at Fulfilled.when (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:930:4)
at Pending.run (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:821:13)
at Scheduler._drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:97:19)
at Scheduler.drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:62:9)
at nextTickCallbackWith0Args (node.js:436:9)
at process._tickCallback (node.js:365:13)
Potentially unhandled rejection [16] Error: Error loading "can#2.3.27#util/jquery/jquery" at file:my-app/node_modules/can/util/jquery/jquery.js
Error loading "can#2.3.27#util/jquery/jquery" from "my-app#0.0.0#index.stache!done-autorender#0.8.0#autorender" at file:my-app/src/index.stache
Did not find ./node_modules/can/node_modules/jquery/package.json
at FetchTask.utils.extend.next (file:my-app/node_modules/steal/ext/npm-crawl.js:532:11)
at file:my-app/node_modules/steal/ext/npm-crawl.js:556:33
at tryCatchReject (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1183:30)
at runContinuation1 (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1142:4)
at Fulfilled.when (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:930:4)
at Pending.run (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:821:13)
at Scheduler._drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:97:19)
at Scheduler.drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:62:9)
at nextTickCallbackWith0Args (node.js:436:9)
at process._tickCallback (node.js:365:13)
If the double jQuery installation is the issue, it should be resolved by version 2.0.0, which is exactly the same as the 1.0 version, but requires that you pass in a jQuery package as the jquery option. So, in addition to whatever else you had in your can-connect-feathers config, you'll need to provide the jquery option:
import $ from 'jquery'
import Feathers from 'can-connect-feathers';
new Feathers({
jquery: $
});

Can't run react-native example in windows

I'm trying to run the getting started example in windows for android but after running
react-native run-android
I get the following error:
TypeError: Object doesn't support property or method 'isNative'
at CallSiteToString (X:\code\react_native\AwesomeProject\node_modules\source-map-support\source-map-support.js:195:3)
at Anonymous function (X:\code\react_native\AwesomeProject\node_modules\source-map-support\source-map-support.js:304:5)
at Array.prototype.map (native code)
at prepareStackTrace (X:\code\react_native\AwesomeProject\node_modules\source-map-support\source-map-support.js:303:3)
at stackGetter (Unknown script code:208:9)
at socketErrorListener (_http_client.js:303:3)
at emitOne (events.js:96:5)
at emit (events.js:188:7)
at emitErrorNT (net.js:1265:3)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
maybe you have a problem with your code ! what is 'isNative' in your code ?
it's better to to copy your code and paste it here.
Figured it out. In case anyone else faces this problem it seems I had both a regular node installation and a node (chakra) installation and the chakra one was causing problems with react-native. After uninstalling node(chakra), react-native runs fine.

'protractor exited with code: 3 Use --force to continue' in protractor

I'm using protractor with jasmine framework to run my automation scripts. The test is failing with the following error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Warning: Tests failed, protractor exited with code: 3 Use --force to continue.
while trying to get attribute value of an element.
But, I'm able to perform clicks and verifyElementPresent kind of actions for the same web element..
Could any one please help me out of this how to overcome this error.
Thanks in advance..

Resources