run one test by name from one nodeunit file - nodeunit

Is it possible to run only one test from nodeunit test file with several tests. My tests.js file:
module.exports = {
test2: function (test) {
console.log ("test2")
test.done();
},
test1: function (test) {
console.log ("test1")
test.done();
}
};
I can run all tests:
$ nodeunit tests.js
But I want to run only test2 like:
$ nodeunit tests.js test2
Is it possible without spliting file tests.js into 2 separate files?

See nodeunit -h for the available options (This is for version 0.8.1):
Usage: nodeunit [options] testmodule1.js testfolder [...]
Options:
--config FILE the path to a JSON file with options
--reporter FILE optional path to a reporter file to customize the output
--list-reporters list available build-in reporters
-t name, specify a test to run
-f fullname, specify a specific test to run. fullname is built so: "outerGroup - .. - innerGroup - testName"
-h, --help display this help and exit
-v, --version output version information and exit
So from that the following should do what you want:
$ nodeunit tests.js -t test2
e.g:
$ nodeunit ./tests.js -t test2
tests.js
test2
✔ test2

Related

Pass config file as arg when calling snowsql from command line

I am trying to run a snowsql query from the command line and also to pass config file while calling snowsql. On this blog there is an option presented:
–config PATH SnowSQL config file path.
I tried including this:
#!/bin/bash
snowsql -f training-data.sql \
-o quiet=true \
-o friendly=false \
-o header=false \
-config=./config
When I attempt ti run this I get:
No connection could be found for onfig=./config
It's odd because previously, I could swear the error message was (Note onfig Vs. nfig!):
No connection could be found for nfig=./config
How can I tell snowsql to use ./config as the config file when running the query?
You don’t need an equals sign. It should just be:
-config ./config

Trouble with preserving source file path

Assuming I'm currently in /home/testUser/gcovTest/test1/ directory where I have a file test.c which I compile with gcc -fprofile-arcs -ftest-coverage test.c which generates relevant .gcda and .gcno files.
After successful compilation, I execute the generated binary ./a.out and run the following command to generate the .gcov report.
gcov -p test.c
What I expected
The resultant test.c.gcov file should have contained the full path of test.c i.e. home/testUser/gcovTest/test1/test.c in the source: tag but actually it contains just test.c
Question
How I can get gcov to preserve the complete path of test.c in test.c.gcov file?
I have even tried the follwing but it still prints test.c in source of test.c.gcov
gcov -p home/testUser/gcovTest/test1/test.c
The -p switch for gcov preserves the path of the input file in the file name of the output. That is,
gcov -p /foo/bar/baz.c
generates the file #foo#bar#baz.c.gcov instead of simply baz.c.gcov - but the contents of the file are identical.
The name of the source file, as shown in the .gcov report, is generated by gcc. If you wish the full path to be included in the report, simply specify the full path on your compilation command line:
$ gcc -fprofile-arcs -ftest-coverage /foo/bar/test.c
$ ./a.out
$ gcov test.c
File '/foo/bar/test.c'
Lines executed: ...
Creating 'test.c.gcov'
$ head -n 1 test.c.gcov
-: 0: Source:/foo/bar/test.c

ERROR: Failed to spawn fakeroot worker to run /PATH_TO_THIS/example_0.1.bb:do_install: [Errno 2] No such file or directory

I am trying to compile a c code and install it using yocto. it is successfully compiled using do_compile.
I tried to install using do_install, it is giving bellow error.
ERROR: Failed to spawn fakeroot worker to run /PATH_TO_THIS/example_0.1.bb:do_install: [Errno 2] No such file or directory
Please find my bb file below
SUMMARY = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR} /MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://sample.c"
S = "${WORKDIR}"
do_compile() {
x86_64-linux-gnu-gcc sample.c -o test_example
}
do_install() {
install -d ${D}${bindir}
install -m 0755 test_example ${D}${bindir}
}
Based on your comment above that you are using -b - that is almost certainly the cause of this issue. When you use -b bitbake will print this warning:
WARNING: Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.
One of the dependencies that you may be missing is the fakeroot program (pseudo). Using -b is likely preventing that from being built.
Instead of using -b, you should put the recipe into a place bitbake can find it (to test, could be meta/recipes-extended/example, but when you do it properly you should create your own layer and put it there). Then you can just build it like any other recipe:
bitbake example

How config React to render .js

I'm trying to let WebStorm to render the .js files for me watching .jsx files.
I'm using or trying to use browserify/babelify and react nodes but I'm getting the following error
/usr/local/bin/browserify -t [babelify --presets react]
/Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/*
-o /Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/bundle.js
Error: Cannot find module
'/Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/*'
from
<br>'/Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src'
at <br>/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
at load <br>(/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
at onex <br>(/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
at <br>/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
at<br> FSReqWrap.oncomplete (fs.js:95:15)<br>
Process finished with exit code 1
The configuration for the file watcher is the following:
arguments: -t [babelify --presets react] $FileDir$/* -o $FileDir$/bundle.js
What am I doing wrong?
OK....I got the solution...
browseify cannot use wildcard (as *) so it should transpile individual files using the following arguments:
-t [babelify --presets react] $FileDir$/$FileNameWithoutExtension$.jsx -o $FileDir$/../dist/$FileNameWithoutExtension$.js
after that when you want to bundle all .jsx files, it can run the following command:
browserify -t [ babelify --presets [ react ] ] src/* -o dist/bundle.js

Init build environment within a batch

I'm using a windows batch file to run vxWorks build.
In order to run the build, I need to run the wrenv.exe utility that set up the build environment.
I'm trying the following, but the update operation fails
call C:\WindRiver32\wrenv.exe -p vxworks-6.8
call wrws_update.bat -data "%WORKSPACE%" -l %APP_MODULE% -b build -c %CPU%
How can I force the batch to "remember" the wrenv.exe settings?
The two commands may be combined, like this:
call C:\WindRiver32\wrenv.exe -p vxworks-6.8 wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%
This will run the command "wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%", inside the "C:\WindRiver32\wrenv.exe -p vxworks-6.8" shell, returning control upon completion.

Resources