'preact build' does not finish - preact

I am new to preact and react. Whenever I build my preact pwa using 'preact build', as per the output the build never reaches 100%. It only goes upto 91% but looking at the built code it seems the build is 100% completed (I have deployed the build and it is working). Can someone please put a light on this?

As long as everything works as expected you can just ignore that. Seems like it's a small bug in the UI and nothing more. It may or may not be changed in the future 😉

Related

Javascript module imports takes too long

I've created up a nodejs mono-repo project using tuborepo and the kitchen-sink template.
Here I have some applications, the code that I am going to release, and some packages, basically are shared functions and logic that the applications may or may not use.
It worked well, until some days ago, when I've found a strage behavior in some of my apps.
I have to make some changes to an application, so I've opened up Visual Studio Code, I've run yarn dev, and I was ready to code, but when I've started the application that need to update, I've noticed that it won't start, usually it takes some time, like 5 seconds at most, but this time it was taking up to 30-40 seconds util the node process exited.
I've tried with another application that is very similar but differs in some way, and I've encountered the same issue, so I've decided to create and empty test suite check if everything was still working fine, and it did, I mean the node process was not crashing and I've had the output I expected.
Then I've started to import from the packages the modules I needed, and I've noticed that a particular one causes this weird problem.
This module depends on other packages, and its main purpose is to serve up classes and functions that may be use from the application.
The problem is: when use the import ... from ... from the application code, the process hangs, then sometimes it can start properly so the code is executed, sometimes the node process exits, without an error message and with a status code of 0.
I've tried to use the process.on("uncaughtException") and process.on("unhandledException") but neither of them are ever fired, segault-handler doesn't help either since it does not report anything.
I've checked the code of this module, and it does not execute some functions or perform logic while it is importing, so I don't think it has to do with slow running functions.
I have only one theory, circular dependencies so a js file to includes another js file which itself includes the first one? but I don't think so since the code used to work just fine.
I've to use a backup of the code I have when It worked, but still, I do have the same error
I was wondering guys if you could please give me some hints to fix the bug, or if you had a similar issue explain how to solve.

Testcafe - sending false errors/dies after running 100+ tests in a row

I am creating an automation testing platform, and I wrote a code which executes around 300+ tests in a row.
I am currently running the tests on my local machine. After around 10-20 tests the testcafe either stops working or giving false error or starts slowing down and not navigating to the right page therefore can't find any of the selectors I tell it to look for.
I know this to be false errors since when I only run these tests on their own testcafe is not doing that anymore and the tests pass successfully with no errors at all.
Any idea whats going on? Is this a problem with my local machine?
The cause of the issue is unclear. Please create a separate issue using the following link https://github.com/DevExpress/testcafe/issues/new?assignees=&labels=TYPE%3A+bug&template=bug_report.yaml and share an example that demonstrates the issue.
OK I found the issue in my code. I took a lot of screenshots per test and didn't clear them after each run which inflated my memory causing node and testcafe to crash.
Thanks for all the help

Hot Reload for Angular

With Angular, Typescript, and Node, I'm always waiting for a long compile before being able to test any changes. Is there any concept of a better way to test small changes without the long compile I'm always waiting on? With Flutter & Dart, you are suppose to be able to do a hot reload and see changes right away. Does Angular offer anything in this category?
Thanks in advance for your response.
It depend's on your pc... but, if you are using Angular 11, you can run with Hot Module Replacement: ng serve --hmr
Adding the watch flag '-w' reduced my update times from 90 seconds to 5 seconds.

Changes to JavaScript files do not take effect instantly. Possible issue with gulp browserify task

When I make changes to a JavaScript file it often takes up to 10 seconds of constantly refreshing the page before the changes take effect. I know that Chrome caches a lot, and I have used a couple of techniques to work around this:
I have set the Cache-control header to 'no-cache, no-store', added a query string based on the current time to every javascript file (and I have confirmed that this actually changes every time I refresh), and I have enabled the "Disable cache" option in the dev tools. However, the JavaScript files still don't load instantly...
Edit:
After some more testing I have discovered that the gulp browserify task in my node.js app (that builds client-side JavaScript bundles) not updates the builds before 5-10 seconds after gulp has restarted. This is however weird since gulp outputs "Finished 'browserify' after 3.24 ms". This explains why the JavaScript files don't refresh in the browser, but I'm not able to figure out why they are not refreshed immediately.
Have anyone experienced this before?
The task finishes before browserify is done because it's not set up correctly, probably you're not returning the stream.
Browserify takes a while to build files, definitely not a few milliseconds, so while gulp reports it as done, browserify is still working on it and saves the file 5-10 seconds later.
Look into gulp-starter to see how it uses watchify to considerably speed up compilation time during development.
Open Developer Console -> Go to Network Tab -> Click on Disable Cache checkbox on the top..
I've been struggling with this issue for most of today. Tried everything from disabling cache in Chrome dev-tools, to rebooting everything from gulp to browser to laptop (I had a feeling it was a cache/memory thing as Gulp had been working perfectly for a long time before today)
Finally decided to uninstall and reinstall my global Gulp package. Not only does the problem seem to have been solved but starting the Gulp watchify process seems much faster now as well. I'd suggest giving this a try

How to debug tests with karma.js + require.js

I have a setup basically described here - http://karma-runner.github.io/0.8/plus/RequireJS.html
Problem is that I can't see source files of my tests in Chrome dev tools. So I can't debug it. Adding debugger; works but it is very uncomfortable, almost unusable since I can't browse any other file except the one with debugger; currently fired
Seems like karma load files, parse them, wrap each test and then unload files before run.
ng-boilerplate has a grunt build that will put all your plain js files into a build directory for testing and debugging.
Take a look at the Gruntfile and karma/karma-unit.tpl.js for how this is done.
Running grunt watch will leave your browser in a state where you can debug all your tests. Just click the debug button, set your break point(s) and reload the page.
Suddenly, you are debugging any or all your js files.
If you need to debug your test deeply, this is generally an indicator of badly organized code or badly made unit test. If you follow a TDD workflow, taking small step will help you prevent any major issue with your code. I warmly recommend you watch this video: http://blog.testdouble.com/posts/2013-10-03-javascript-testing-tactics.html?utm_source=javascriptweekly&utm_medium=email (it doesn't use Karma, but you should watch it for the workflow/the principles presented)
Then, if you really want to debug your test code, nothing beat the browser. As so, you should set up your test in a manner it can be runned both in Karma and the browser. We implemented this for QUnit, Jasmine and Mocha on the Backbone-Boilerplate. Feel free to base yourself on these settings to set up your own environment.

Resources