error: Grunt :: [BABEL] Note: The code generator has deoptimised the styling of "../js/all.min.js" as it exceeds the max of "500KB". in Sail.js? - sails.js

Why am I getting
error: Grunt :: [BABEL] Note: The code generator has deoptimised the styling of ".tmp/public/js/#fortawesome/fontawesome-free/js/all.min.js" as it exceeds the max of "500KB".
in Sail.js app at production mode? Please suggest me how to fix it?
Error Screenshot

After many research I found that earlier babel compress max size was : 100kb. Now they have increased it to max : 500kb. But still I have that error, to fix it we have to insert a small code snippet.
In Sails JS App v.1.x - Goto
task->config->babel.js
and insert this code : compact: false
inside :
dist: {
options: {
presets: [require('sails-hook-grunt/accessible/babel-preset-env')],
compact: false
},
...
....
}

Related

Keep getting 'Unexpected identifier' when running tests

I am trying to copy a tutorial for a Wordle solving bot but its just not going well. whenever I try to run a test on the code it doesn't work at certain points, I'll either get 'Uncaught SyntaxError: Unexpected identifier'. I'm doing this on UIlicious.
Here's what I've got so far:
I.goTo("https://www.powerlanguage.co.uk/wordle/")
I.click("reject")
I.see("Guess the Wordle")
I.click('/html/body', 40, 80)
let guessWord = null
for(Let r=0 ; r<6 ; ++r) {
guessWord = solver.suggestWord(gameState)
I.type(guessWord);
I.pressEnter()
I.wait(2)
}
let rowList = document.querySelector("game-app").shadowRoot. //
querySelector("game-theme-manager"). //
querySelector("#board").querySelectorAll("game-row");
you are probably referring to the article I wrote here : https://uilicious.com/blog/automate-wordle-via-uilicious/
This test script, is designed specifically to use uilicious.com, so you will need to edit and run it through the platform.
You can do so via the snippet here : https://snippet.uilicious.com/test/public/N5qZKraAaBsAgFuSN8wxCL
If you have syntax error there, do let me know with a snippet link - and I will try to help you respectively.
Also the snippet you provided so far, excludes the "solver" class which was initialised much further down.

A plugin for Protractor to measure e2e coverage

I am using this plugin to generate a coverage report. However, it is not working. I am getting error:
Failure during setup: Cannot read property 'outdir' of undefined
TypeError: Cannot read property 'outdir' of undefined
Do you know how to resolve this and generate the report?
Here is a good solution.
Specify in your protractor.conf.js a custom script.
plugins: [
{
path: 'scripts/protractor-e2e-coverage-custom.js'
}
];
In the custom script, set the default value.
const coverage = require('protractor-e2e-coverage');
const path = require('path');
coverage.outdir = path.resolve(process.cwd(), 'test/e2e-stats/report');
var coveragePlugin = new coverage.CoveragePlugin();

Running Protractor cucumber in parallel with consolidated report

This may sound duplicate but it is not.
I know that I can use the below configuration in config file and start multiple instance of the chrome driver that would run the features in parallel that share the step definitions.
capabilities: {
'browserName': 'chrome',
'shardTestFiles': true,
'maxInstances': 0
},
Q1. But my question is around why the chromedriver doesn't exit when a scenario fails?(That happens only when I use value of maxInstance > 0 ).
The chromedriver exit with exitcode- 3 and exitcode- 1.
Q2. Is anyone able to sort out the reporting issue? How can I generate the report when all the features have finished?
Any sort of help will be appreciated?
Thanks
In order to generate the consolidated html report after parallel run,I have used afterLaunch parameter in the protractor.conf.js file and have used https://github.com/gkushang/cucumber-html-reporter. Below is the code-
afterLaunch: function afterLaunch () {
var cucumberHtmlReporter = require('cucumber-html-reporter');
var jsonReportFolder = '/path/to/all/json/reports';
var cucumberhtmlReport = path.join(jsonReportFolder, cucumber.html');
var options = {
theme: 'bootstrap',
jsonDir: jsonReportFolder,
output: cucumberhtmlReport,
reportSuiteAsScenarios: true,
launchReport: true
};
cucumberHtmlReporter.generate(options);
}
The existing behavior is correct.Do not use 'maxInstances': 0
The default value is 1 and any value>1 is the right way to do it. The error that you are seeing is because thats how the source code - taskScheduler
They are handling shard tests in this taskScheduler exports and logic of maxinstances is as below
this.maxInstance = capabilities.maxInstances || 1;
/**
* Get maximum number of concurrent tasks required/permitted.
*
* #return {number}
*/
count += Math.min(queue.maxInstance, queue.specLists.length);
So if you have maxInstances 0, It will cause problems and your code will never exit cleanly. Also I dont think your code will run in parallel
What I would suggest is
Check your protractor version and update to latest
Change your config file to - 'maxInstances': 3 //anything greater than 1. 1 is default

How to set language on highcharts.client.Chart

HOW does one set the language on org.moxieapps.gwt.highcharts.client.Chart
setting the Highcharts.options (in Java) as:
Highcharts.Options options = new Highcharts.Options();
options.setGlobal(new Global().setUseUTC(false));
String[] cat = new String[] {"Jan.", "Fev.", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Set.", "Out.", "Nov.", "Dez."} ;
options.setLang(new Lang().setMonths(cat));
Highcharts.setOptions(options);
has NO effect. Remains in English.
trying to set:
chart.getXAxis()
.setCategories("Jan.", "Fev.", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Set.", "Out.", "Nov.", "Dez.");
fails:
--> Chromium fails:
V8 error: Allocation failed - process out of memory (invalid array length). Current memory usage: 890 MB
--> Firefox complains of a script error
Fails even using documented example of:
chart.getXAxis().setCategories(....)
HELP please!
Lol!
I needed to
options.setLang(new Lang().setShortMonths(cat));
!!!

CKEDITOR - Set Caret to end

I'm working a lot with positioning within CKEDITOR.
But i still can't figure out why the following code
sometimes doesn't work?
var range = new CKEDITOR.dom.range(editor.document);
range.moveToElementEditablePosition(element, setToEnd);
editor.getSelection().selectRanges([range]);
I think that it has something to do with the element input that i'm giving.
But i'm not sure.
Does anybody know what are the requirements for the moveToElementEditbalePosition to work?
The last time that i checked my input was a SPAN Element.
http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-moveToElementEditablePosition
Or is there a more secure(cross-browser) solution?
==== edit ====
I found an error, And it's coming from the new CKEDITOR.dom.range
TypeError: b is undefined
This means that editor.document is empty, but when i look in the editor.document it's filled?
When i'm trying to set the range a second time after the error also it shows the following error: uncaught exception: DOMException: INVALID_STATE_ERR
Try this HTML:
<p><span id="test">Text</span></p>
And this JS:
var e = CKEDITOR.instances.editor1;
var span = e.document.getById( 'test' );
var range = e.createRange();
range.moveToElementEditablePosition( span, 1 );
range.select();
e.insertText( 'FOO' );
range.moveToElementEditablePosition( span );
range.select();
e.insertText( 'BAR' );
The result seems to be correct:
<p><span>BARTextFOO</span></p>
Do you have any other cases?