How to change CLI arguments of Jest Runner using VSCode - visual-studio-code

I'm switching from MacOS to Windows WSL2 Ubuntu subsystem.
I want to run a basic Jest test from VSCode, with the JestRunner plugin :
When I click on the "Run" button, it opens a terminal on VSCode (WSL not PowerShell), but it automatically launches this command
vincent#LAPTOP-xxxxx:~/Development/Labomaton/packages/api/node_modules$ node "//wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js"
"//wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/src/user/infrastructure/rest/pipes/create-user-validation.spec.ts"
-t "Register user into Labomaton missing firstname"
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
So I try to run the same command with the correct path to this node module:
vincent#LAPTOP-xxxxx:~/Development/Labomaton/packages/api/node_modules$ node "/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js"
"/home/vincent/Development/Labomaton/packages/api/src/user/infrastructure/rest/pipes/create-user-validation.spec.ts"
-t "Register user into Labomaton missing firstname"
PASS ../src/user/infrastructure/rest/pipes/create-user-validation.spec.ts
Register user into Labomaton
✓ missing firstname (5 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 2.313 s
My question is: how to change the path as an argument to this VSCode JestRunner feature?

Related

Is there a way to fix this build bug in SITL simulation?

When I ran SITL simulation in WSL2, I got the following message:
john#DESKTOP-0P475SS:~/ardupilot/ArduCopter$ sim_vehicle.py
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
...
Checking for program 'rsync' : /usr/bin/rsync
'configure' finished successfully (9.977s)
SIM_VEHICLE: Building
SIM_VEHICLE: "/home/john/ardupilot/modules/waf/waf-light" "build" "--target" "bin/arducopter"
Waf: Entering directory `/home/john/ardupilot/build/sitl'
Command ['/usr/bin/git', 'rev-parse', '--short=8', 'HEAD'] returned 128
SIM_VEHICLE: Build failed
SIM_VEHICLE: Killing tasks
john#DESKTOP-0P475SS:~/ardupilot/ArduCopter$
What was going wrong and what does this
Waf: Entering directory `/home/john/ardupilot/build/sitl'
Command ['/usr/bin/git', 'rev-parse', '--short=8', 'HEAD'] returned 128
mean?

VUE 3 - weird failure in VS Code and flawless running in console

Windows 10 x64 21H2, running my project in VS Code and get the following error:
Executing task: npm run serve
> weatherApp#0.1.0 serve
> vue-cli-service serve
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
INFO Starting development server...
10% building 2/5 modules 3 active ...babel-loader\lib\index.js!C:\tmp\VUE Weather apps\VUE 3 - weather\node_modules\eslint-loader\index.js??ref--13-0!C:\tmp\VUE Weather apps\VUE 3 - weather\src\main.jsError: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (C:\tmp\VUE Weather apps\VUE 3 -
...
{
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.1
* The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run serve" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
At the same time the command npm run serve runs w/o any issues. What should I do to have the issue fixed?

Unknown command error in Jenkins when running Cake script using Powershell

Our Jenkins server has been successfully building projects for years using Powershell to run a cake script. Out of the blue today, we started getting the following error on multiple projects:
12:10:46 Running build script...
12:10:46
12:10:46 Error: Unknown command 'Default'.
12:10:46
12:10:46 .\scripts\build.cake -target=Default -configuration=Release
12:10:46 -verbosity=Verbose -environment=dev -certificatePath=C:/Program Files
12:10:46 (x86)/xxxxx/Verisign Certificate -certificateName=xxxxxxxx_cert.pfx
12:10:46 -certificatePassword=xxxxxxxxxxx
12:10:46 ^^^^^^^ No such command
12:10:46
12:10:47 Build step 'Windows PowerShell' marked build as failure
The build.ps1 script has not changed. The build.cake script has not changed. Jenkins was not updated since the last successful builds nor any of the add-ins.
If I remove "-target=Default" from the argument list, I just get the same error on "-configuration=Release" indicating unknown command: "Release".
Has anyone else experienced this?
The possible root cause of this failure is the cake version update (0.38.x --> 1.0)
You have two ways to fix this issue
Change the Argument Syntex - arguments should always be called with multi-dash syntax (e.g. --target=Foo) instead of (e.g. -target=Foo)
Refer: https://cakebuild.net/docs/getting-started/upgrade
Pinning the cake version
Specified the version of Cake in the tools/packages.config file
Refer: https://cakebuild.net/docs/writing-builds/reproducible-builds/pinning-cake-version

Command failed with exit code 2 in ionic

I HAVE THIS ERROR
On build app in ionic
sudo ionic build android
Error: ANDROID_HOME is not set and "android" command not in your PATH.
You must fulfill at least one of these conditions.
at /home/sbh/testt/mobilebra/platforms/android/cordova/lib/check_reqs.js:206:19
at _fulfilled (/home/sbh/testt/mobilebra/platforms/android/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/sbh/testt/mobilebra/platforms/android/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/sbh/testt/mobilebra/platforms/android/cordova/node_modules/q/q.js:760:13)
at /home/sbh/testt/mobilebra/platforms/android/cordova/node_modules/q/q.js:821:14
at flush (/home/sbh/testt/mobilebra/platforms/android/cordova/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:422:7)
Error: /home/sbh/testt/mobilebra/platforms/android/cordova/build:
Command failed with exit code 2
Do the following:
(nano is my preference, use whatever your heart desires)
sudo nano ~/.bashrc
add the following lines, modifying the paths if your SDKs in a different spot:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Hudson failing build w/o revealing cause

Every build has failed as of Tuesday. I'm not exactly sure what happened. The Phing targets (clean/prepare) are being executed properly. Additionally, the unit tests are passing with flying colors, with only a warning for duplicate code (not a reason for a fail). I tried removing the phpDoc target to see if that was causing the error, but the build still failed.
Started by user chris Updating
file://localhost/projects/svn/ips-com/trunk
At revision 234 no change for
file://localhost/projects/svn/ips-com/trunk
since the previous build [trunk] $
/opt/phing/bin/phing clean prepare
-logger phing.listener.NoBannerLogger Buildfile:
/var/lib/hudson/.hudson/jobs/IPS/workspace/trunk/build.xml
IPS > clean:
[echo] Clean... [delete] Deleting directory
/var/lib/hudson/.hudson/jobs/IPS/workspace/build
IPS > prepare:
[echo] Prepare...
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage-html
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/docs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/app
BUILD FINISHED
Total time: 1.0244 second
[workspace] $ /bin/bash -xe
/tmp/hudson3259012225710915845.sh
+ cd trunk/tests
+ /usr/local/bin/phpunit --verbose -d memory_limit=512M --log-junit
../../build/logs/phpunit.xml
--coverage-clover ../../build/logs/coverage/clover.xml
--coverage-html ../../build/logs/coverage-html/
PHPUnit 3.5.0 by Sebastian Bergmann.
IPS Default_IndexControllerTest .
Default_AuthControllerTest ......
Manage_UsersControllerTest .....
testDeleteInvalidUserId ..
testGetPermissionsForInvalidUserId .. Audit_OverviewControllerTest
............
Time: 14 seconds, Memory: 61.00Mb
[30;42m[2KOK (28 tests, 198
assertions) [0m[2K Writing code
coverage data to XML file, this may
take a moment.
Generating code coverage report, this
may take a moment.
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
[workspace] $ /bin/bash -xe
/tmp/hudson1439023061736436000.sh
+ /usr/local/bin/phpcpd --log-pmd ./build/logs/cpd.xml ./trunk phpcpd
1.3.2 by Sebastian Bergmann.
Found 1 exact clones with 6 duplicated
lines in 2 files:
library/Ips/Form/Decorator/SplitInput.php:8-14
library/Ips/Form/Decorator/FeetInches.php:10-16
0.04% duplicated lines out of 16585 total lines of code.
Time: 4 seconds, Memory: 19.50Mb [DRY]
Skipping publisher since build result
is FAILURE Publishing Javadoc [xUnit]
[INFO] - Starting to record. [xUnit]
[WARNING] - Can't create the path
/var/lib/hudson/.hudson/jobs/IPS/workspace/generatedJUnitFiles.
Maybe the directory already exists.
[xUnit] [INFO] - Processing
PHPUnit-3.4 (default) [xUnit] [INFO] -
[PHPUnit-3.4 (default)] - 1 test
report file(s) were found with the
pattern 'build/logs/phpunit.xml'
relative to
'/var/lib/hudson/.hudson/jobs/IPS/workspace'
for the testing framework 'PHPUnit-3.4
(default)'. [xUnit] [INFO] -
Converting
'/var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/phpunit.xml'
. [xUnit] [INFO] - Stopping recording.
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Finished: FAILURE
What changed since Tuesday? Try to manually run exactly the same commands that Hudson tries to run from the same directory that Hudson starts it from (usually the jobs workspace directory). Of course with the user account that Hudson is started under.
There are several possibilities. ranging from standard groups for a directory, to permission, or other things outside of Hudson. Was Hudson upgraded? Was a plugin upgraded? Was the OS or php upgraded? Was there a change in the default or user .profile or .env (or the equivalent files)? Does another process accesses the workspace? ......
Once I had the problem that all of the sudden my deployment scripts did not run anymore. The mystery was, that I could still run the script from command line with the Hudson user account. The reason was simple but took a while to uncover. There was a java upgrade from 5 to 6. Both versions were available. After comparing the environment variables, there was a difference in the path. The problem was that the new path was set in the global .profile. But Hudson does not open an interactive shell, therefore the .profile will not be executed. If you have a problem like this, you can put the initialization in the .env file (or whatever the filename is for your system), because this will be run regardless if it is a interactive shell or not. Alternatively you can configure Hudson to set it on master or node/slave level.
if you want a command to not break the 'build' as a failure you have to add #! in front of the command to prevent the flags -xe which produce this behaviour.