Categories
Mastering Development

Angular Native-script, Component is part of the declaration of 2 modules even though declared in one place only

So this persistent problem in Angular Nativesript environment where I have declared component in only auth.module.tns.ts files. The error: Error: Type LoginComponent is part of the declarations of 2 modules: AuthModule and AuthModule! Please consider moving LoginComponent to a higher module that imports AuthModule and AuthModule. You can also create a new NgModule that exports […]

Categories
Mastering Development

How to setup jest with node_modules that use es6

I have a very simple test: describe(‘sanity’, () => { it(‘sanity’, () => { expect(true).toBeTruthy() }) }) And I’m receiving the following error: FAIL spec/javascript/sanity_test.js ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it’s not plain […]

Categories
Development

Routes defined in Angular 8 sub-module not evaluated during app startup

Since upgrading to Angular 8, my SPA is behaving a bit differently when loading the whole app with a given hash. When loading #/public/signup, the app will redirect to #/trips/home. My app is modularized, and app.route.ts only defines: const routes: Routes = [ { path: ”, pathMatch: ‘full’, redirectTo: ‘trips/home’ }, { path: ‘**’, redirectTo: […]

Categories
Development Linux Ubuntu

MySQL GUI Client in 2020

I’ve recently switched to Ubuntu from Mac, and I’m trying to find a GUI that is stable so I can connect to my MySQL via SSH tunnel. I’ve not had much luck so far. MySQL Workbench just randomly closes upon connection, and DBeaver ( which looks awesome ) doesn’t seem to work with my SSH […]

Categories
Development

How to pass javascript Buffer to C program or NAPI?

I have JavaScript in which i have created a buffer . i am reading file and storing file data in the buffer.i have to pass buffer data to NAPI/ c program. I have created node module . for using JavaScript buffer in the c program/ NAPI i need *uint8_t . I have tried to use […]

Categories
Development

Jest.js and Create-react-app: I get ” SyntaxError: Cannot use import statement outside a module” when running test

My code App.test.js import moment from “moment-timezone”; let result = moment().format(); describe(“anything”,()=>{ it(“should return a fail..or at least something”,()=>{ expect(result).toBe(“wrong”) }) }) I run: npx jest I get: npx jest FAIL src/App.test.js ● Test suite failed to run /home/wktdev/Desktop/thing/workflow_magic_guest_app/src/App.test.js:1 ({“Object.<anonymous>”:function(module,exports,require,__dirname,__filename,global,jest){import moment from “moment-timezone”; ^^^^^^ SyntaxError: Cannot use import statement outside a module at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17) […]

Categories
Angular Development

How to pass angular component to Nebular dialog service

I’m trying to create a web dialog on Agnular6 using Nebular components. There are two ways to do this, the first one is to pass <ng-template> reference, like: openAddDialog = (dialogTemplate: TemplateRef<any>) => { this.dialogServiceRef = this.dialogService.open(dialogTemplate); } and it’s working well. But what I need is to pass a component as a parameter like: […]

Categories
Development

What all derived variables can be formed from macro economic variables?

What all derived variables can be formed from macro economic variables so that I can use them in my model? The variables I have are ‘CPI_Inflation’, ‘Exports’, ‘Fixed_Invstment’, ‘GDP’, ‘Govt_Growth’, ‘Imports’, ‘Industrial_Production’, ‘Merchandise_Exports’, ‘Merchandise_Imports’, ‘Nominal_Retail_Sales’, ‘Private_Consumption’, ‘Real_Retail_Sales’, ‘WPI_Inflation’. data: These are against sales predictions(have sales data for different Half years and want to predict for […]

Categories
Development

Jest cannot load svg file

In my app I use React and TypeScript. I tried to run jest tests I get following error: C:\Users\e-KDKK\workspace\konrad\mikskarpety\src\images\icons\Sock.svg:1 ({“Object.<anonymous>”:function(module,exports,require,__dirname,__filename,global,jest){<svg xmlns=”http://www.w3.org/2000/svg” width=”18.725″ height=”23.947″ viewBox=”0 0 18.725 23.947″> ^ SyntaxError: Unexpected token < 1 | import React, { FC } from ‘react’; 2 | > 3 | import SockIcon from ‘../../images/icons/Sock.svg’; | ^ 4 | 5 […]

Categories
Development

Error setting up jest and enzyme manually without CRA

The app I’m working on doesn’t use CRA and I’m trying to add Jest and Enzyme. I followed the docs here and added the usual setupTests.js file, the example tests in the Jest docs are working just fine, but after I added Enzyme, I keep getting errors related to CSS and imports. Here’s a simple […]