ReferenceError: json2html is not defined in jest test using ts-jest - jestjs

I am trying to use node-jsdom2html module from within jest test, but I am getting this error:
ReferenceError: json2html is not defined
1 | import generateReport from "../report-generator";
> 2 | import * as jsontohtml from '../../node_modules/node-json2html/node.json2html'
| ^
3 | import {
4 | fullConfig,
5 | fullResult,
at Object.<anonymous> (node_modules/node-json2html/node.json2html.js:18:18)
at Object.<anonymous> (src/__tests__/index.spec.ts:2:1)
I did a demo repository with the code I am trying to execute and I am facing the error:
https://github.com/cunhabruno/jest-bug-node-json2html/blob/main/__tests__/demo.spec.ts

Related

Pushing Results to KiwiTCMS using RobotFramework Ride Issue

I am trying to get Robotframework(Ride) work with KiwiTCMS.
I am making the connection to the KIWI server (local) but I am getting these errors that I am not sure where(In RIDE? or the .conf file?) to fix:
[ ERROR ] Calling method 'start_suite' of listener 'zealand.listener.KiwiTCMS' failed: ENVIRONFILE Version value not defined, missing one of TCMS_PRODUCT_VERSION, TRAVIS_COMMIT, TRAVIS_PULL_REQUEST_SHA or GIT_COMMIT
[ ERROR ] Calling method 'end_test' of listener 'zealand.listener.KiwiTCMS' failed: TypeError: 'NoneType' object is not subscriptable
TestKiwiRide | PASS |
------------------------------------------------------------------------------
KiwiTest.TestKiwi | PASS |
1 test, 1 passed, 0 failed
==============================================================================
KiwiTest | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: C:\Users\hendri\Documents\KiwiTest\output.xml
Log: C:\Users\hendri\Documents\KiwiTest\log.html
Report: C:\Users\hendri\Documents\KiwiTest\report.html
(kiwi-env) C:\Users\hendri\Documents\KiwiTest>
Please assit?
Details goes into the bat file you use to call the test cases
check here : https://kiwitcms.readthedocs.io/en/stable/plugins/automation-frameworks.html
In plugin configuration section, you have to passe configuration as environment variables. e.g.
export TCMS_PLAN_ID=*PLAN_ID*

ImportError: cannot import name 'test' from 'lib'

as you can see in the picture down below, I created a TEST package, with two sub-packages(test1, test2), this is the structure of the package:
\test
| __pycache__.py # ki importit lib fell main tcrea
| __init__.py
| lib.py
| \test1
| | __init__.py
| | test1.py
| \test2
| | __init__.py
| | test2.py
I wanted to import lib inside test1.py
I have tried the next code( as I sawed in the tutorials):
import lib
lib.test()
# from lib import test
# test()
# from ..lib import test
# test()
I tried to execute the code with vs code cmd from the TEST package then I entered to test1 sub-package(cd .\test1) to try but it didn't work.
I got those errors:
THANKS FOR HELP!!

pywinatuo - Access Database Match Error for the same property - Code works on a small database not on a large one

I am trying to run some access queries using pywinauto. The error Constantly changes.
After checking the control properties i found that the query name does exist. However the the code throws an error stating match not found.
import os
import subprocess
access_file = r'C:\Ren'
filename='test.accdb'
accessPath = 'C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.exe'
subprocess.Popen([accessPath,access_open])
dlg=Desktop(backend='uia').window(title_re='Access*')
sleep(10)
dlg.Navigation_Pane.Queries.Query1.invoke()
dlg.Yes.invoke()
print(dlg.print_control_identifiers())
This code works on a smaller database. I Tried it 1st on a large database and got errors so i created a test database with few tables and queries. It works fine.
When i change dlg.Navigation_Pane.Queries.delete_reports.invoke()
and change the path to the actual database. I get a MatchError: Could not find 'Queries'.
This is the control properties.
GroupBox - 'Queries' (L4, T2979, R429, B5581)
| | | | ['Queries', 'QueriesGroupBox', 'GroupBox8', 'Queries0', 'Queries1']
| | | | child_window(title="Queries", control_type="Group")
Button - 'delete report' (L4, T3271, R429, B3301)
| | | | | ['Button147', 'delete reportButton', 'delete report']
| | | | | child_window(title="delete report", control_type="Button")
I am unable to understand why does it one work on one database and does not on the other.
Regards,
Ren.

Can't import .lhs script in Haskell

I have two files, S5.hs and S6.lhs, in the same folder, and I want to import the S6.lhs script in S5.hs, but when i type import S6, i get:
Could not find module `S6'
Use -v to see a list of the files searched for.
|
1 | import S6
| ^^^^^^^^^^
Failed, no modules loaded.
When I lauch it from the folder, I get following message(the first line of the S6 file is import Data.Array):
File name does not match module name:
Saw: `Main'
Expected: `S6'
|
1 | import Data.List
| ^
Why is this happening?
Looks like you need to specify at the top of the S6.lhs file that you want this file to be treated as the S6 module, as opposed to the default module name of Main. You would do that with module S6 where or module S6 (export, list) where.

You may need an appropriate loader to handle this file - .net core & Angular

I keep getting the following error web running a production build of a .net core angular 4 application. Those are 2 node packages I installed and looks like their is some issue with webpack reading those files only for production builds. Any thoughts?
ERROR in ./$$_gendir/~/ngx-mydatepicker/dist/ngx-my-date-picker.component.ngfactory.ts
Module parse failed: d:\a\1\s\Vacant2\$$_gendir\node_modules\ngx-mydatepicker\dist\ngx-my-date-picker.component.ngfactory.ts Unexpected token (14:28)
You may need an appropriate loader to handle this file type.
| import * as i3 from 'ngx-mydatepicker/dist/directives/ngx-my-date-picker.focus.directive';
| import * as i4 from 'ngx-mydatepicker/dist/services/ngx-my-date-picker.util.service';
| const styles_NgxMyDatePicker:any[] = ['.ngxmdp .headertodaybtn,.ngxmdp .monthcell,.ngxmdp .weekdaytitle{overflow:hidden;white-space:nowrap}.ngxmdp *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Arial,Helvetica,sans-serif;padding:0;margin:0}.ngxmdp .selector{position:absolute;padding:0;border:1px solid #CCC;border-radius:4px;z-index:100000;animation:selectorfadein 60ms}.ngxmdp .selector:focus{border:1px solid #ADD8E6;outline:0}#keyframes selectorfadein{from{opacity:0}to{opacity:1}}.ngxmdp .selectorarrow{background:#FAFAFA;padding:0}.ngxmdp .selectorarrow:after,.ngxmdp .selectorarrow:before{bottom:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute}.ngxmdp .selectorarrow:after{border-color:rgba(250,250,250,0);border-bottom-color:#FAFAFA;border-width:10px;margin-left:-10px}.ngxmdp .selectorarrow:before{border-color:rgba(204,204,204,0);border-bottom-color:#CCC;border-width:11px;margin-left:-11px}.ngxmdp .selectorarrow:focus:before{bord...
| export const RenderType_NgxMyDatePicker:i0.RendererType2 = i0.ɵcrt({encapsulation:2,
| styles:styles_NgxMyDatePicker,data:{}});
# ./$$_gendir/ClientApp/app/app.module.server.ngfactory.ts 10:0-115
# ./ClientApp/boot.server.ts
ERROR in ./$$_gendir/~/ngx-loading/ngx-loading.ngfactory.ts
Module parse failed: d:\a\1\s\Vacant2\$$_gendir\node_modules\ngx-loading\ngx-loading.ngfactory.ts Unexpected token (12:35)
You may need an appropriate loader to handle this file type.
| import * as i1 from 'ngx-loading';
| import * as i2 from '#angular/common';
| export const LoadingModuleNgFactory:i0.NgModuleFactory<i1.LoadingModule> = i0.ɵcmf(i1.LoadingModule,
| ([] as any[]),(_l:any) => {
| return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver,
# ./$$_gendir/ClientApp/app/components/app/app.component.ngfactory.ts 9:0-94
# ./$$_gendir/ClientApp/app/app.module.server.ngfactory.ts
# ./ClientApp/boot.server.ts
I found the solution here https://github.com/aspnet/JavaScriptServices/issues/1168#issuecomment-320026397
Just needed to remove include: /ClientApp/ from myh webpack.config.js.

Resources