Configuring Jest + Enzyme to run tests in PhpStorm? - phpstorm

I'm following the TypeScript create-react-app tutorial and I managed to get Jest + enzyme working through the command line, but I'd also like to be able to test single functions and whatnot inside of PhpStorm. However I keep getting the following error when running through PhpStorm:
Error: An error occurred while adding the reporter at path "/snap/phpstorm/36/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-reporter.js".Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
What should my test setup/configuration look like? I can't seem to find any examples in the PhpStorm Docs or otherwise. Thanks!

Related

Create React App Rewired application ignoring jest.config.js

I have a react application created using "create react app rewired". I've installed ts-jest and want to be able to customize Jest. I read the documentation from ts-jest and executed npx ts-jest config:init at the root level of my project to create the initial configuration file. To test that jest is indeed using that configuration file, I wrote the following line console.log(window); in a sample test file and modified the configuration such that testEnvironment is set to "node".
I am expecting the test to fail due to window being undefined, but I am getting the window object back. I tried renaming the file to jest.config.ts and I got the same result.
I did a global search across all the files to see if there's another configuration file somewhere that is overriding my configurations, but there was none found.
What am I doing wrong? I know jest comes pre-packaged with create-react-app (CRA). I would imagine that create-react-app-rewired would only include some wrapper above CRA so where is it getting its configurations from?
I've come to realize that create-react-app-rewired package had nothing to do with this issue since it is simply a wrapper package that exposes a configure-overrides.js file to allow developers to modify the webpack configurations managed by create-react-app.
The jest.config.ts or jest.config.js config file I created had no effect because create react app (CRA) will generate and use its own jest config file underneath the hood.
I discovered this by happenstance while researching on another issue. A comment by dstapleton92 on GitHub helped me draw this conclusion.
Create React App supports overriding SOME of the values via the "jest" property in package.json file. Upon inspecting the jest config factory function in CRA, testEnvironment property is hard coded to "jsdom" and the key is not exposed as part of the list of overridable properties.
This is why the attempts I made were not successful.

Fatal error (13): No program entry point with XDS Modula-2?

I'm using the current bundled binaries from https://github.com/excelsior-oss/xds (as of 12/6/2020) with just the most basic Hello World MOD file:
MODULE HelloWorld;
FROM STextIO IMPORT WriteLn, WriteString;
BEGIN
WriteString("Hello, World!");
WriteLn;
END HelloWorld.
xc HelloWorld.mod works fine for compiling it to object. However, I'm not clear on the exact syntax for xlink on a standalone MOD file. xlink HelloWorld.obj will at least get it to try with my object file, but as the error shows, it doesn't know the entrypoint. I've tried setting the entry point with the /ENTRY switch, but no luck doing it by module name. I've also tried setting the /SYS to console, but again, no luck there.
I feel there's some trivial linker option or program directive needed, but I'm just not finding it via Google...
To build a binary, use: xc =a =make HelloWorld.mod
The above is found in https://github.com/excelsior-oss/xds/blob/master/Sources/Doc/Comp/src/usage.tex .
It is unfortunate that XDS did not put PDFs of their documentation on github. I suggest building the documentation from their LaTeX files.
Edit: I since learnt that the Wayback Machine has archived the XDS documentation here: https://web.archive.org/web/20060705213825/http://www.excelsior-usa.com/xdsdoc.html

Babel helper-module-transforms runs into undefined is not a function

I am running mocha unit tests that are written in ES6. Using Babel to run the tests and running into a very bizarre error. This happens as soon as I import something from multiple test scripts. If ES6 Import is used from only one single test script everything works fine.
Here is a snippet of what the error looks like and I have a video that shows exactly how it can be reproduced.
/node_modules/#babel/helper-module-transforms/lib/normalize-and-load-metadata.js:37:52
TypeError: undefined is not a function
https://www.youtube.com/watch?v=jm0p1ttwFZc
Here is the git repo of the problem.
npm install
in /server
https://github.com/jiminssy/BabelProblem
This is because you are using https://www.npmjs.com/package/collections. It replaces many ES6-standard libraries with its own versions that do not conform to the standard behaviors that Babel is expecting and relies on to compile files.
Your option option would be to drop that library, or drop #babel/register. I'd recommend dropping the library since it seems to be extremely poorly designed.

C++ Builder - Project x.exe raised exception class ELUInvalidResLibrary with message 'Invalid resource

I'm using C++ Builder 2009 project which I'm trying to internationalize using korzh localizer plugin.
When I run my application and try to Initialize the language menu, I get an Exception of:
Project abc.exe raised exception class ELUInvalidResLibrary with message 'Invalid resource file format "C:\path\to\exe\abc.exe"'.
I find the resource reference to the executable seems a bit goofy. Any ideas?
Progress Update:
I have another project which is translating properly. So I referneced it. I noticed I was missing the abc_klr.res file in the project, so I added it and it got me past that exception on the LocalizerOnFly->Init(), but I get a similar exception when trying to change the language. The difference is the executable is no longer referenced and instead I get a "" as the resource reference... Below is a screen shot:
So my problem was fixed in two steps:
Add the resource file to the project then rebuild.
Clean the project and deploy directory of any translation related
files, then refresh the language files.
Things are groovy again.

Flash Builder - Internal Build Error / Classes Must Not Be Nested

I've been working on a Flash Builder project for about a week and occasionally encounter one of these two errors when I build:
An internal build error has occurred. See the error log for more information.
1131: Classes must not be nested.
A quick Project > Clean fixes things up. When I opened my project this morning and tried to build it, I received the internal build error again. This time, however, Project > Clean results in 5 separate "Classes must not be nested" errors, all pointing to my main class declaration.
Running Project > Clean again leads back to the internal build error. If I Clean again, I get the 5 class errors again, and so on.
I'm using Flash Builder 4.6, Flex 4.6, and AIR 3.5. I haven't made any changes to my codebase since yesterday. Any ideas what might be causing this?
I had the same problem with flashb uilder 4.6,
when i try to compile the app out of the blue it says
"flash builder internal build error has occurred see the error log for more information"
to resolve this you have to check the compiler arguments
when this happens you wont be able to go to compiler argumnts GUI, you have to edit it in .actionScriptProperties file
remove -local and local names save the file and try to compile you would not get the error
to put back the local you have to rephrase the local as follows
-locale=en_US,us_EN
What worked for me was to remove all swc references from the project's compiler settings, then re-insert them.