Detox Primitive ReferenceError: Element is not defined - jestjs

potentially related issues
#795
Description
I am new to using Detox but it appears to me that primitives are not being properly set as jest globals following the setup and usage guides I could find in the documentation. I get the code in the console ReferenceError: element is not defined. Maybe there is a way to improve the logging to clarify these config errors for good
Repo to reproduce:
https://github.com/Kielan/OnyxWalletReactNative
Detox v8.1.6^
Node v8.9.4,
React Native v0.56.0
Device iphone 7 sim release and debug
Device and verbose Detox logs
ReferenceError: element is not defined
14 | })
15 |
> 16 | it(':ios: shows splash screen and then login', async () => {
| ^
17 | await expect(element(by.label('animateLoginLabel'))).toBeVisible()

Related

How do I make Gatsby + netlify website work on my machine?

I deployed an app with netlify + gatsby default options and then I cloned that repo, so I can edit the style. The problem is that it doesn't work on my machine, the following error persists:
2 problems (0 errors, 2 warnings)
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
$black: #2b2523;
^
Invalid CSS after "...black: #2b2523;": expected 1 selector or at-rule,
was ".navbar .navbar-men"
in /Users/micazev/Documents/ecominimalismo.com/src/components/all.sass
(line 11, column 17)
File: src/components/all.sass
failed Building development bundle - 22.833s
ERROR Failed to compile with 1 errors 14:39:49
⠀
error in ./src/components/all.sass
⠀
Module build failed (from
./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from
./node_modules/sass-loader/dist/cjs.js):
$black: #2b2523;
^
Invalid CSS after "...black: #2b2523;": expected 1 selector or at-rule,
was ".navbar .navbar-men"
in /Users/micazev/Documents/ecominimalismo.com/src/components/all.sass
(line 11, column 17)
at /Users/micazev/Documents/ecominimalismo.com/node_modules/webpack/lib/Norm
alModule.js:316:20
at /Users/micazev/Documents/ecominimalismo.com/node_modules/loader-runner/li
b/LoaderRunner.js:367:11
at /Users/micazev/Documents/ecominimalismo.com/node_modules/loader-runner/li
b/LoaderRunner.js:233:18
at context.callback (/Users/micazev/Documents/ecominimalismo.com/node_module
s/loader-runner/lib/LoaderRunner.js:111:13)
at Object.callback (/Users/micazev/Documents/ecominimalismo.com/node_modules
/sass-loader/dist/index.js:89:7)
at Object.done [as callback] (/Users/micazev/Documents/ecominimalismo.com/no
de_modules/neo-async/async.js:8069:18)
at options.error (/Users/micazev/Documents/ecominimalismo.com/node_modules/n
ode-sass/lib/index.js:294:32)
# ./src/components/Layout.js 17:0-20
# ./src/templates/blog-post.js
# ./src/cms/preview-templates/BlogPostPreview.js
# ./src/cms/cms.js
# multi ./node_modules/gatsby-plugin-netlify-cms/cms.js
./node_modules/gatsby-plugin-netlify-cms/cms-identity.js ./src/cms/cms.js
My repo is: https://github.com/micazev/ecominimalismo.com
I don't know what other info I could give. Please, help.
According to some threads about that starter, there's a bug about the Sass loaders that causes this issue. You have many solutions provided in this GitHub thread:
Add options to the gatsby-plugin-sass:
{
resolve: 'gatsby-plugin-sass',
options: {
indentedSyntax: true
}
}
This will allow the loader to understand the indented syntax of Sass.
Changing the extension from .sass to .scss, changing also all the references in the project: you'll need to add semicolons (;) and braces ({}) when needed.
Obviously, the second one is easier and safer.

Hello Folks: I am having problem in starting sails app in nodejs. can anyone put forth their insights on that?

I tried running the latest version of node and postgresql, but was having problem i deprecated node to 13.12.0 and sails-postgresql to 1.0.2 as mentioned in one of the blog. still the error is coming. Stack trace is as below:
sails lift
info: Starting app...
(node:10460) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
info: Initializing apianalytics hook... (requests to monitored routes will be logged!)
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
error:
error: Error: Sails is taking too long to load.
Troubleshooting tips:
-• Were you still reading/responding to an interactive prompt?
(Whoops, sorry! Please lift again and try to respond a bit more quickly.)
-• Do you have a lot of stuff in assets/? Grunt might still be running.
(Try increasing the hook timeout. Currently it is 40000.
e.g. sails lift --hookTimeout=80000)
-• Is blueprints a custom or 3rd party hook?
(If initialize() is using a callback, make sure it's being called.)
at Timeout.tooLong [as _onTimeout] (C:\Users\dearm\OneDrive\Desktop\my work\sails-logrocket\myapp\node_modules\sails\lib\app\private\loadHooks.js:191:21)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Make sure you've installed dependencies with npm install.
error: • Check that this app was built for a compatible version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)
complete code is here https://github.com/mannawar/sails_app
Try using Node version 10 and sails-postgresql version 2.0.0

what is the cause of this error message "Error: Cannot find module '../models'" from nodejs+elasrticsearch github repo

I'm trying to setup node.js and Elasticsearch together in a docker container,
I've been following this post to the letter,until to the section of launching the application
when I type
docker-compose up
I keep getting this node.js error that is saying models module is not found
tqd-node | { Error: Cannot find module '../models'
this is the first few lines of the error message
tqd-elasticsearch is up-to-date
Starting tqd-node ... done
Attaching to tqd-elasticsearch, tqd-node
tqd-elasticsearch | WARNING: no logs are available with the 'none' log driver
tqd-node |
tqd-node | > nodejselastic#1.0.0 start /usr/src/app
tqd-node | > pm2-runtime start ./src/main.js --name node_app
tqd-node |
tqd-node | 2019-12-14T23:09:56: PM2 log: Launching in no daemon mode
tqd-node | 2019-12-14T23:09:56: PM2 log: App [node_app:0] starting in -fork mode-
tqd-node | 2019-12-14T23:09:56: PM2 log: App [node_app:0] online
tqd-node | { Error: Cannot find module '../models'
tqd-node | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
tqd-node | at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:51:29)
so I downloaded the full code from this GitHub repository(the-quotes-database)
but I still got the same error
I did try to change the path in controller file here
const model = require("../models");
I thought maybe it needs the full c:// path, but that didn't change the error message.
when I do hover over models in VSC editor it shows that it is the correct path.
so my question is : is this a bug in the repo or is the issue with my windows docker configuration?
I successfully managed to create simple python containers with docker,
so I'm not sure what is the root cause of this error and how to fix it.
update: I will answer here in case anyone finds a similar issue.
I installed docker and downloaded the files and repeated the steps on my Ubuntu laptop and it worked!
so the downloaded files were not prepared to work on Windows, it is not a bug in the repo if you have Linux.

Jest tests are not working when run in CLI

I'm having strange issue with testing on nestjs.
When I'm running npm run test, most of the tests fails. Some variables are becoming undefined, nest cannot resolve dependencies etc.
But when I'm running ALL TESTS from WebStorm panel, everything works fine.
https://gist.github.com/hejkerooo/5a56ee2a7d78ce41cb390d1ece648933
Nest can't resolve dependencies of the TrendService (?). Please make sure that the argument at index [0] is available in the _RootTestModule context.
at Injector.lookupComponentInExports (node_modules/#nestjs/core/injector/injector.js:180:19)
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at mapper (node_modules/jest-jasmine2/build/queueRunner.js:25:45)
TypeError: Cannot read property 'clear' of undefined
17 | beforeEach(async () => {
18 | jest.restoreAllMocks();
> 19 | await trendsRepository.clear();
| ^
20 | });
21 |
22 | afterAll(async () => {
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
(node:2633) UnhandledPromiseRejectionWarning: TypeError: Caught error after test environment was torn down
The issue has been resolved - just used jest.setTimeout to 50000, works fine.
I assume it's a temporary fix, but will dig into it.

Can't find variable: loadFixtures

I am using karma, jasmine and phantomjs for my project and when I am executing start karma; I am getting following error:
PhantomJS 1.9.7 (Linux) View:: Login guestRegistration Should call the guestRegistration event when btn-grey is clicked FAILED
ReferenceError: Can't find variable: loadFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:84
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:89
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the checkElementToValidate event when username is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:112
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the checkElementToValidate event when username is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:123
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the addLoginInputPlaceholder event when login-input is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:133
PhantomJS 1.9.7 (Linux) View:: Login Check for focus event Should call the addLoginInputPlaceholder event when login-input is focussed FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:146
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:154
PhantomJS 1.9.7 (Linux) View:: Login Check whether sendFormdata() triggers submit form Should trigger the submit:form method atleast once FAILED
ReferenceError: Can't find variable: sinon
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:231
PhantomJS 1.9.7 (Linux) ERROR
SyntaxError: Unable to parse JSON string
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/js/controllers/common/base.controller.js:107
PhantomJS 1.9.7 (Linux): Executed 21 of 38 (6 FAILED) ERROR (2.36 secs / 1.854 secs)
The error is can't find variable loadFixture. Can anyone tell me what is the reason behind this error?
It seems like you're using jasmine-jquery. First make sure you install it with npm. Can you also make sure that your karma.conf.js has a similar entry:
frameworks: ['jasmine-jquery', 'jasmine']
The order of the frameworks matters.

Resources