Run jasmine specs via phantom, got "Can't find variable: describe" - node.js

I met same problem when run it on a centOS5 linux server as CI job, with phantomJS 1.7 (I compiled it by myself)
Running "jasmine" task
Testing jasmine specs via phantom
...
[D] ["phantomjs","onResourceReceived","GET
http://127.0.0.1:8888/test/spec/CommonTest.js"]
[D] ["phantomjs","onError","ReferenceError: Can't find variable: describe", [{"file":"http://127.0.0.1:8888/test/spec/CommonTest.js","line":31,"function":""}]]
ReferenceError: Can't find variable: describe
...
the specs run successfully on other machine such as WinXP etc.

At last, it’s caused by that: I created a symbolic link for “node_modules” to re-use common module, but it preventgrunt-jasmine-runner to fetch sth. (not sure yet). To resolve it, need to copy the “node_modules” files directly under project folder.

Related

How can I create a Rust Clippy binary to use as part of a separate standalone application?

I am trying to build a standalone application through which I can run Rust Clippy without needing to install it locally. Essentially, I want to run a command like cargo-clippy -- --message-format=json through my application when a Rust project is uploaded to it.
What I've tried:
I installed cargo locally using the instructions here
I forked the Clippy repo locally into a folder called clippy_local
I ran cargo build on the repo which created some exe binary files including cargo-clippy under clippy_local/target/debug/ (contents of the target folder attached in screenshot below)
I copied this cargo-clippy exe into the tool binaries folder for my application
After this, the project compiles, but when I try to run Clippy through my tool, I get an error like below:
dyld[14510]: Library not loaded: '#rpath/librustc_driver-6ca1b5240144bf0b.dylib'
Referenced from: '/Users/<redacted>/repos/<redacted>/target/webapp/WEB-INF/classes/tools/clippy/cargo-clippy'
Reason: tried: '/usr/local/lib/librustc_driver-6ca1b5240144bf0b.dylib' (no such file), '/usr/lib/librustc_driver-6ca1b5240144bf0b.dylib' (no such file)
My app is running the following command internally to invoke Clippy:
/Users/<redacted>/repos/<redacted>/target/webapp/WEB-INF/classes/tools/clippy/cargo-clippy -- --message-format=json
I was guessing from the error that it has something to do with missing libraries/dependencies (apart from the cargo-clippy exe). I have tried to copy all the contents of the target/debug folder into my app as well, but the same error still persists.
So, I want to know what's going wrong and how I can build a Rust Clippy binary which I can then use to run Clippy from other applications?

Running gulp on project fails because it cannot find an existing file

I'm currently porting a fully working Windows project to an Ubuntu system. After doing the installation of apache/php/mysql/composer/nodejs/nmp I try to run the project. I got the directory where the sources are located (in the web servers location) and I do composer install and the nmp install and they all finish without a flaw. The last step is to call gulp. When I do, I get several of the following errors:
gulp-notify: [Laravel Elixir] Browserify Failed!: Cannot find module
'./components/Colegiados/pagosMatricula/index.vue' from
'/home/web/martilleros/resources/src'
However, the files are there at the specified location. So what am I doing wrong?

Compiled node.js module not getting correct library path when copied to different machines

My problem is a little complicated but I'll try:
I have a node.js application that needs to be completely prebuilt and bundled alongside standalone node.js (specifically 4.4.5 LTS), zipped and deployed to offline CentOS 6/7 machines, meaning I cannot do npm install, and no gcc/g++/python so I cannot do things like node-gyp rebuild.
Everything is working correctly except this module: ibm_db.
It's compiled with node-gyp after downloading the db2 cli drivers, but basically it's supposed to work like the regular DB2 client except all its dynamic libraries, binaries etc. are inside the module path itself (node_modules/ibm_db/installer/clidriver).
If I deploy the bundle (which includes all node modules in the tarball, including ibm_db) to another machine, it's probably going to sit on a different path from the machine on which I built the bundle. When I try to run the app like this: ./node app.js (here node is a symlink to the standalone node binary inside the unpacked bundle) i get this error:
Error: libdb2.so.1: cannot open shared object file: No such file or directory
Now, I can clearly see that libdb2.so.1 is inside node_modules/ibm_db/installer/clidriver/lib but the paths in bindings.gyp all use the original paths on the build machine which don't match, so I assume this is where the problem lies.
I can easily just add that path with ldconfig and it would work, however the user profile installing the app will not have superuser access so it's not a real option.
I tried setting the environment variable LD_LIBRARY_PATH but node.js deletes this entry from process.env on startup, and even if I programmatically set it like process.env.LD_LIBRARY_PATH='...'; it doesn't seem to do anything.
Is there any way to modify the library path for a compiled module without recompiling/rebuilding it? If it's possible I would assume that would be the easiest solution, but I couldn't find a way to do it.

Temporary files on Travis

I have a Javascript project which uses Grunt for build process, QUnit for tests, Blanket for code coverage and a custom Grunt task to convert coverage results into LCOV files, sended to Coveralls. Everything running on TravisCI.
the project : https://github.com/mistic100/jQuery-QueryBuilder
my Grunt task : https://github.com/mistic100/grunt-qunit-blanket-lcov
So what should happen is that npm test runs QUnit+Blanket tests in a PhantomJS process and in the meanwhile, coverage results are saved in .coverage-results/all.lcov.
After a successfull build, grunt coveralls sends this file to Coveralls.
And my problem is here, the task does not find the file, although when I test on my computer it does.
see the last Travis log: https://travis-ci.org/mistic100/jQuery-QueryBuilder#L389
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
edit
so this has nothing to do with Travis but with my Grunt task where I use absolute paths thinking it's relative paths (I still don't know why it doesn't append on Windows though)
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
No, lifecycle-wise the build artefacts are still present, when running after_success commands.
The gruntfile.js configures force true and defines path - no issue here.
This should work.
I would suggest to throw in some commands to check the folders and files on Travis.
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/*
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/.coverage-results/*
Maybe you spot a permission issue during folder and file creation.
But that's my only guess.

Getting started with nightwatch.js

Can anyone provide me with a detailed explanation on how to setup nightwatch and start writing browser tests? I have searched for such information online and was unable to find it. The nightwatch.js website had good information about various nightwatch command line commands, but not about actually setting up a nightwatch project, which is what I am having trouble with.
Specifically, I do not have a good understanding of the various files that come with installation of nightwatch, and how I am supposed to use them.
Step-by-Step Beginner's Tutorial
We needed an up-to-date, well-researched and maintained tutorial for Nightwatch for our team so we wrote one: https://github.com/dwyl/learn-nightwatch
We (highly) recommend using a nightwatch.conf.js (.js) file for configuring Nightwatch because (unlike a .json file) it allows you leave in-line comments to your fellow developers (i.e avoid "WTF" moments by communicating) and to evolve your configuration with variables & functions as needed.
Also, we prefer to install Nightwatch (and its required dependencies) locally so it's clear to everyone exactly what is required to run the project and which versions we are using.
Using the selenium-download module will download the latest versions of Selenium Standalone Server and Chromedriver (both required to run a basic Nightwatch test) for your OS and means you will be up-and-running much faster.
Rather than including the whole tutorial here we invite you to Star/Fork it on GitHub: https://github.com/dwyl/learn-nightwatch#step-by-step-tutorial
Feedback / questions / updates / improvements are always welcome!
You need basiclly two things:
The nightwatch.json file in the root of your project
And nightwatch installed (npm install -g nightwatch).
After that you use it on the command line as described in the documentation here and it will automatically grab your nightwatch.json file and run your tests based on the default test_setting.
I opened up an issue to add a nightwatch init command, so the setup of the nightwatch.json file is easier.
Further reading
How to setup nightwatch.json
Github Repository
You can go through this step-by-step method to get better understanding
Nightwatch.js Part 1
Nightwatch.js Part 2
one big problem for users "is not worked on count 1-2-3".
so we find many-many-many times our all internet :)
and.
1) nightwatch is installed (by .rpm, .deb, npm, downloaded). is haven't questions
2) is worked by execution "nightwatch" on CLI
3) but where wunderbar example?????????????
of course, on internet!
4) by my bad memory and catalog list in simple test:
- create catalog
- create in catalog 2 dirs:
bin for web-drivers (add chromedriver, selenium-server-standalone as minimum)
tests for tests
5) we need this simple config - nightwatch.json in catalog (use any simple which access have)
6) create-copy-paste any simple test in test catalog (it's one on planet :)
7)it's all, run in catalog by CLI: nightwatch
you need only this? for first time, before documentation readings? ;)
$ npm install -g yo
$ npm install -g generator-selenium-nightwatch
$ yo selenium-nightwatch
$ npm install
$ npm test

Resources