Error executing Firefox CasperJS/SlimerJS - javascript

I'm trying to make some tests written with CasperJS run using SlimerJS, but I'm getting the follow error:
I've downloaded SlimerJS by using npm install slimerjs at my project's folder, and I did configure a system variable SLIMERJSLAUNCHER pointing to where my firefox.exe is in, as described on SlimerJS's website.
Here is the whole structure:
SlimerJS folder is into node_modules.
I'm trying to run these tests on my command prompt using npm test which is:
"scripts": {
"test": "casperjs --engine=slimerjs test test.js"
},
Versions:
CasperJS 1.1.3
SlimerJS 0.10.2
Firefox 50.0.2
I can really can use any help here. Thanks.

Related

why "meteor npm install" is not working on gitpod workspace?

I am new to gitpod.io, I am trying to open a meteor project on gitpod.io and when I type "meteor npm install", it's showing "bash: meteor: command not found", however, if I try "npm install" it's working fine.
Please help me with the issue.
The reason is that meteor is not installed in the default workspace Docker image.
You can run curl https://install.meteor.com/ | sh in your workspace. You'll get a message like this:
Meteor 1.10.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
Couldn't write the launcher script. Please either:
(1) Run the following as root:
cp "/home/gitpod/.meteor/packages/meteor-tool/1.10.2/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
(2) Add "$HOME/.meteor" to your path, or
(3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
Since you don't have root rights, a script in /usr/local/bin/ cannot installed by this way. However, you can still use meteor like this:
$ ~/.meteor/meteor
An alternative would be to add your own Dockerfile as described in the docs: https://www.gitpod.io/docs/config-docker/
By this, you can install meteor with root rights.

Jest: `npm test` not displaying "Watch Usage" options in Windows Git Bash

I am new to React and attempting to use npm test.
From the docs, it is my understanding that every time npm test runs, it starts the watcher. The watcher is supposed to display a list of commands titled "Watch Usage". This includes commands such as a, f and q.
When I run npm test, watcher appears to work because it runs the tests and reruns them if I save a file.
However, it does not display the "Watch Usage" list and if I type any of the "Watch Usage" commands, nothing happens.
How can I enable the "Watch Usage" commands?
I was attempting to run this command in Git Bash. I have not found a solution to make it work in Git Bash.
However, you can instead run the command in cmd.exe and it will work properly.
The Jest VSCode extension can also be helpful.
There is a problem with running Jest inside Git Bash on Windows. The terminal codes for updating the screen are not correctly handled, and I've been unable to find a reason or fix for this searching Google.
If you run npm test from a DOS prompt, then it seems to work fine, but if you run npm test from a Git Bash prompt the progress feedback from Jest is missing.
You can enable colors by running npm run test -- --colors which gets Jest to output the color status for tests in Git Bash, but strangely the colors are working but the progress is still not shown.
The only successful work around that I've found is running Jest from inside winpty if you're using Git Bash.
winpty npm.cmd test
So what I do is add an alternative npm script to my package.json file for running on Git Bash inside Windows.
"wintest": "winpty npm.cmd run test",
Then you can just run that instead.
npm run wintest
It's not a perfect solution, but at least you can see the progress correctly.
You can activate watch mode, modify your package.json:
"scripts": {
"test": "jest --watch",
}
run npm test

After npm reads package.json, what runs Electron?

I'm just starting to learn about how JavaScript, HTML, and Electron all work, and I want to know what runs electron . in the "scripts" -> "start" of package.json, because I can't tell what does and that kind of wizardry makes me nervous.
According to the man pages for npm, what npm start does is that it reads the package.json, looks at the script under "scripts" -> "start" -> some_script, and then runs some_script. Sometimes, some_script is something like node foobar.js, which makes sense to me, since I can run that from the command line. NodeJS is executing foobar.js. However, in the case of the electron-api-demos, some_script is electron .
You can download and run electron-api-demos via
git clone https://github.com/electron/electron-api-demos
cd electron-api-demos/
npm install && npm start
In order to try to figure out what is running electron ., I've run it in the node shell, and I've tried running node main.js. I've even tried opening up the node shell and running
electron-api-demos#2.0.2 start $DIR/electron-api-demos
electron .
(which is exactly the output of npm start). None of them worked, because none of them started up the Electron application. At this point I'm very puzzled at how, exactly, the start script gets executed at all.
So I guess my question is: does there exist a command (that I can use on the command line) to start up this Electron application, without using npm? If not, what is npm calling to start up this Electron app?
I apologize if this question has been asked before, but I all the sources I found didn't seem to go into any further detail about what, exactly, is done when npm start is run and how it executes electron . . Thank you for your time!
Command line interfaces installed with npm are put in the node_modules/.bin/ directory. You can't just run them from the command line because that directory isn't in your PATH (unless you put it there, or you installed it globally).
So, if you want to run electron without npm start, you can run ./node_modules/.bin/electron .. Since this is a bit verbose, newer versions of npm provide the command npx to run things without the ./node_modules/.bin/ part, so npx electron . also works.
Since npm scripts often use the packages you've installed, they automatically add node_modules/.bin/ to the PATH before running your command. As a result, the start script can just reference electron directly.
npx can do some other cool things too – npm has a blog post about it.
When you run npm start , it by default run command corresponding "start" key of script property of package.json like
"script":{
"start": "ng serve",
"launch":"electron main.js" or "electron ." // main.js located in the same dir
"test": " ng test"
}
same when you run npm run launch it will trigger the command corresponding of the "launch" key of script property of package.json file. like run electron main.js command and your application will launched.
so if you want to run the your electron application directly like electron main.js then install the electron module globally using command npm install electron -g then simply run the electron main.js command and your application will start.

Yarn (JS) commands failing with "Error: Could not find or load main class run"

I'm working on an application that recently switched from npm to yarn and I am unable to run package.json scripts. Running a command with yarn results in the following error:
Error: Could not find or load main class run
Running the same commands with npm work fine. Example:
$ yarn run test
> Error: Could not find or load main class run
$ npm run test
> RUNS test/jest/components/DataTable.test.js
> RUNS test/jest/components/NavItem.test.js
> // etc
You've also got Apache Yarn installed and your system is using this yarn.
To confirm, run yarn version and you'll see something like the following:
hadoop 2.7.1
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 15ec7ccf46de536e6ce7a
Compiled by jenkins on 2015-06-29T06:04Z
Compiled with protoc 2.5.0
From source with checksum fc0a1a23fc1868e4d5ee7fa2b28a58a
This command was run using
/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/common/hadoop-common-2.7.1.jar
You'll need to resolve the conflict by aliasing one of the commands.
you can use yarnpkg equate to yarn
yarnpkg run test

Trouble with installing Selenium(ChromeDriver, Javascript) on Windows 7

I'm having trouble installing Selenium and I'm completely lost
I followed this documentation by the letter and looked around the site and the web for a while now and came to a dead end. Like I said in the title I'm using Chrome and Javascript for this.
[Documentation]http://selenium.googlecode.com/git/docs/api/javascript/index.html
So true with the documentation, the first thing I did was installing the "selenium-webdriver" which I opened up cmd and typed "npm install selenium-webdriver". It responded with saying what directory it installed and the version it installed which was 2.42.1.
After this I installed the ChromeDriver 2.10 from their home download page. After this I unziped the file and moved chromedriver.exe to "node_modules\selenium-webdriver\ChromeDriver" and added it to my systems environmental variables.
So then the next step was to test it, so I copy pasted "npm test selenium-webdriver" into the cmd and got this following error. [Error]http://imgur.com/xIYE3oa I also tried running ChromeDriver after I kept running into this error and tried it again to get the same result. It doesn't tell me anything other then...
Starting ChromeDriver on port 9515
Only local connections are allowed.
Thank you in advance.
First, make sure that you have Mocha installed by running npm install mocha.
You will then want to edit the "scripts" section of the package.json file for selenium-webdriver to match the following:
"scripts": {
"test": "mocha -R list --recursive test"
},
After completing those two steps, you should be able to run your tests with the npm test selenium-webdriver command.

Categories