With the "old" modernizr I used something like
https://modernizr.com/download?-flexbox-flexboxlegacy-flexboxtweener-flexwrap-fullscreen-geolocation-video-webp-setclasses-dontmin
in order to build it with my needed features.
Apparently it doesn't work any more, at least it doesn't use the current release. The docs say that I must install modernizr with npm and then use bin/modernizr, which want the features to detect as a comma separated list of the -f parameter, and the options as a comma separated list of the -o paramenter.
I'm seeing a list of options and features in https://github.com/Modernizr/Modernizr/blob/HEAD/lib/config-all.json, but the features don't work: I'm trying
$ ./bin/modernizr -f "img/webp"
and I get
/home/user/git/Modernizr/bin/modernizr:137
throw new Error('invalid key value name - ' + prop);
^
Error: invalid key value name - img/webp
at /home/paolo/git/Modernizr/bin/modernizr:137:17
at Array.map (<anonymous>)
at find (/home/paolo/git/Modernizr/bin/modernizr:122:8)
at Object.<anonymous> (/home/paolo/git/Modernizr/bin/modernizr:145:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
I'm getting the same error with a comma separated list of various options.
What am I missing?
I'm trying to run Cypress BDD test suites with Browserstack but i kept getting this error
CYPRESS_RUN_FAILEDCypress failed to run. Hide stack trace [-]
The plugins file is missing or invalid.
Your pluginsFile is set to .\cypress\plugins\index.js, but either
the file is missing, it contains a syntax error, or threw an error
when required. The pluginsFile must be a .js, .ts, or .coffee
file.
Or you might have renamed the extension of your pluginsFile. If
that's the case, restart the test runner.
Please fix this, or set pluginsFile to false if a plugins file is
not necessary for your project.
Error: Cannot find module 'cypress-cucumber-preprocessor' Require
stack:
.\cypress\plugins\index.js
\cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js
\cypress_package\4.12.1\app\packages\server\lib\plugins\child\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
at Module._load (internal/modules/cjs/loader.js:691:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (.\cypress\plugins\index.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at module.exports (\cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js:208:15)
cypress run process exited with code 1 cypress run failed, exiting
with code: 1
After following the answer suggestion, it seems it cannot read my stepDef and Page class files;
enter image description here
From the stack trace, I see:
Cannot find module 'cypress-cucumber-preprocessor' Require stack
Looks like you're missing the dependency.
Cypress execution on BrowserStack requires you to explicitly mention the npm packages required by the test in the browserstack.json file.
Here's the documentation link: https://www.browserstack.com/docs/automate/cypress/npm-packages
I've moved from the now deprecated jquery.mmenu (available at http://mmenu.frebsite.nl/) to mmlight (https://mmenujs.com/).
Same author, different version of the script, with the latter being more modern and short in size between the other things.
While using the new version in conjunction with a static site generator that has a pre-processing routine to compress Javascript I got an error that I was able to pin down to the line that contains the =>
document.addEventListener("DOMContentLoaded", () => {
Regrettably the error from the verbose is not helpful when it says:
SyntaxError: Unexpected token: punc ())
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:48
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (internal/modules/cjs/loader.js:738:30)
Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
Module.load (internal/modules/cjs/loader.js:630:32)
tryModuleLoad (internal/modules/cjs/loader.js:570:12)
Function.Module._load (internal/modules/cjs/loader.js:562:3)
Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
Does anybody have an idea on how to forward?
Is there any chance to rewrite the routine as a custom prototype or similar?
So apparently the issue is the new ES6 and Uglifier that doesn't support it in full yet as stated here https://github.com/lautis/uglifier
The workaround is to activate the compressor as per their recommendation.
I'm trying to get PostCSS CLI to work on Windows, to use with PHPStorm. I've got it working via command line options, but I want to use it with the javascript config file.
Here are the commands I used to install PostCSS through NPM:
# NPM is installed at PostCSS\node\npm. Commands are run in the PostCSS dir.
"node\npm" install --global postcss-cli # PostCSS\node\node_modules\postcss-cli\
"node\npm" install --global lost # PostCSS\node\node_modules\lost\
# and a few other modules...
So I've got about 6 modules are in the node/node_modules directory now.
I have this batch file (split into multiple lines for your viewing pleasure). This is in the PostCSS folder, just for testing:
"node\postcss" -u postcss-normalize
-u postcss-cssnext
-u postcss-import
-u lost
-o output.css
source.css
This batch file works, and all of the plugins work too.
My problem:
I want to use postcss.config.js, instead of command line parameters, so that I can customize the plugins easily and make it even more portable. I have dozens of separate projects that I will use the same settings for in different directories and computers. So to do that, I've got a new batch file called "run-from-config.bat" with the following content:
"node\postcss" -c "postcss.config.js"
-o output-configured.css
source.css
This new batch file is in the same folder as the command line version, along with the new file postcss.config.js:
module.exports = {
plugins: [
require('postcss-normalize')({
"browserslist": "last 2 versions" // I intend to add more options...
}),
require('postcss-cssnext')({}),
require('postcss-import')({}),
require('lost')({})
]
}
This follows the instructions on the PostCSS-CLI page under "Content": https://github.com/postcss/postcss-cli
But it gives me an error, and appears to be loading modules from the wrong location:
Processing source.css
{ Error: Cannot find module 'postcss-normalize'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (G:\Dropbox\Web Development\PostCSS\postcss.config.js:3:5)
at Module._compile (module.js:570:32)
at requireFromString (G:\Dropbox\Web Development\PostCSS\node\node_modules\postcss-cli\node_modules\require-from-string\index.js:27:4)
at G:\Dropbox\Web Development\PostCSS\node\node_modules\postcss-cli\node_modules\cosmiconfig\lib\loadJs.js:11:15 code: 'MODULE_NOT_FOUND' }
So it seems it can't find the module when using this javascript config file. But it can when loading plugins through the command line option -u. I simply don't know how to change the module directory.
I tried using some other options to change the directory, including -b and -d, but nothing seems to work. And I just don't understand PostCSS (or the underlying javascript software) enough to debug the problem on my own.
I am trying to do code coverage for mocha using istanbul which I have installed globally:
I do this as suggested here
E:\Do\learn_mocha>istanbul cover _mocha -- -R spec
C:\Users\Vamsi\AppData\Roaming\npm\_mocha.CMD:1
(function (exports, require, module, __filename, __dirname) { #IF EXIST "%~dp0
^
No coverage information was collected, exit without writing coverage information
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.Module._extensions..js (C:\Users\Vamsi\AppData\Roaming\npm\node_mo
dules\istanbul\lib\hook.js:102:13)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at runFn (C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\comma
nd\common\run-with-cover.js:114:16)
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\command\comm
on\run-with-cover.js:232:17
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:56:16
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:35:9
This command also throws the same error as above:
E:\Do\learn_mocha>istanbul cover --hook-run-in-context _mocha -- -R spec
I was told by a github issue that I had to add a path to mocha from node_modules,so I did this:
E:\Do\learn_mocha>istanbul cover C:\Users\Vamsi\AppData\Roaming\npm\mocha -- -R
spec
C:\Users\Vamsi\AppData\Roaming\npm\mocha:2
basedir=`dirname "$0"`
^
No coverage information was collected, exit without writing coverage information
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.Module._extensions..js (C:\Users\Vamsi\AppData\Roaming\npm\node_mo
dules\istanbul\lib\hook.js:102:13)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at runFn (C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\comma
nd\common\run-with-cover.js:114:16)
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\command\comm
on\run-with-cover.js:232:17
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:56:16
at C:\Users\Vamsi\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-ma
tcher.js:35:9
I am using Windows 7 as my OS
My test looks like this:
var assert = require("assert"); // core module
var C = require('../cash.js'); // our module
describe('Cash Register', function(){
describe('Module C', function(){
it('should have a getChange Method', function(){
assert.equal(typeof C, 'object');
assert.equal(typeof C.getChange, 'function');
})
it('getChange(210,300) should equal [50,20,20]',function(){
assert.deepEqual(C.getChange(210,300),[50,20,20]);
})
it('getChange(486,1000) should equal [500,10,2,2]',function(){
assert.deepEqual(C.getChange(486,1000),[500,10,2,2]);
})
it('getChange(1487,10000) should equal [5000,2000,1000,500,10,2,1]',function(){
assert.deepEqual(C.getChange(1487,10000),[5000,2000,1000,500,10,2,1]);
})
})
})
This worked for me:
I have both mocha and istanbul installed locally (no -g on the npm install).
I was running
*./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha*
and this came up with the error you were seeing above. I have changed this to look in the explicit local folder for mocha
*./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha*
and now everything is working great.
Please note I'm running my setup under gitbash on windows 7
Try this one, it should work.
istanbul cover %APPDATA%/npm/node_modules/mocha/bin/_mocha -- -R spec
As per this comment in github, in windows the batch commands are not being resolved inside javascript. Hence causing the issue.
As per the suggestion, you can directly pass the javascript function for mocha to istanbul. Here is how you can do it
Type npm ls -g --depth=0
Copy the first line of the output.
it should be C:\Users\<YourUserName>\AppData\Roaming\npm
Type istanbul cover C:\Users\<YourUserName>\AppData\Roaming\npm\node_modules\mocha\bin\_mocha test\folder
So here instead of passing the _mocha(windows command), the javascript from your global mocha installation is being passed. This is exactly what, happening for the local installation of mocha in the previous answer.
Try this command:
istanbul cover C:\\Users\\username\\AppData\\Roaming\\npm\\node_modules\\mocha\\bin\\_mocha
^
Insert Your username here
Where username = Your username
Try:
istanbul cover %NODE_HOME%\node_modules\mocha\bin_mocha -- -R spec --recursive test