How to debug unconverted source code correctly in react18 jest unit test? - reactjs

Environment:react18 source code, win10 , node v16.13.1
I'm using jest tests inside the source code to explore the react18 source code,but jest use babel to convert source code, when i debug jest unit test,it will jump to babel's converted code,it is hard to read,
So I want to ask is there any way to debug on the source code,not the converted code?
for Example:
when i debug it,it will be converted
Even in some places,It's almost unreadable:
i want to debug unconverted source code correctly in react18 jest unit test.
here is my vscode lanuch.json config:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--config",
"./scripts/jest/config.source.js",
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "development"
},
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}

i found in 'preprocessor.js' file , it contain babel configuration
so,we just add global item process.env.JEST_ENABLE_SOURCE_MAPS : inline.

Related

Passing targets in as a dependency and making sure they output something useful and meaningful to be consumed by next target

I am trying to get a plugin to use run-commands and I want it to run and execute a dependent task and pass the result to my command. In this case, I want to have a dependent target start up a webserver and keep it running.
I have tried to do the following and nx graph shows the right DAG but I am not seeing the output I want.
"executor": "nx:run-commands",
"options": {
"command": "./my-cli-tool --arg={frontendApp:serve}"
},
"dependsOn": [
"frontendApp:serve"
]
I know that in a monorepo tool like bazel, passing around the target like //frontendApp:serve would do what I am expecting here so I am guessing there should be a way to do this in nx.
Update: To help with debugging.
If the dependency is running, it is failing silently. I can run it individually, e.g. npx nx run frontendApp:serve. I can't see the port starting up and being taken so if something is happening, its happening silently.
dependsOn configuration looks a little different. It's in the docs here:
https://nx.dev/reference/project-configuration#dependson
Basically, you need have a local target which invokes the target in the other project.
{
"foo": {
"executor": "nx:run-commands",
"options": {
"command": "./my-cli-tool --arg={frontendApp:serve}"
},
"dependsOn": ["serve"]
},
"serve": {
"executor": "nx:run-commands",
"options": {
"command": "nx run frontendApp:serve"
}
}
}
Another option is to use Angular DevKit's allOf or concat executors for running multiple things at once:
"serve-with-graphql": {
"executor": "#angular-devkit/architect:allOf",
"options": {
"targets": [
{
"target": "web:serve"
},
{
"target": "graphql:dev-server"
}
]
}
},
https://github.com/angular/angular-cli/blob/main/packages/angular_devkit/architect/builders/builders.json#L14-L23
allOf runs each target at the same time
concat runs them serially

Debug node process with different PID on every request

guys!
I'm trying to debug a remix grunge-stack (https://github.com/remix-run/grunge-stack) with a simple launch.json:
{
"version": "0.2.0",
"configurations": [
{
"command": "npm run dev",
"name": "Run npm run dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}",
"autoAttachChildProcesses": true,
},
]
}
but when the application starts, every request has a different PID (arc, https://arc.codes/docs/en/get-started/quickstart, does this to emulate how AWS Lambdas works)
⚬ Sandbox Users/gnllucena/git/app/server (pid 63404) emitted 'close' (code 'null', signal 'SIGINT')
⚬ Sandbox Users/gnllucena/git/app/server (pid 63758) emitted 'close' (code 'null', signal 'SIGINT')
⚬ Sandbox Users/gnllucena/git/app/server (pid 63773) emitted 'close' (code 'null', signal 'SIGINT')
but the vscode don't know how to handle this debug session.
Does anybody knows how to debug an application like this?

Visual Studio 2019 debug embedded targets. How to force VS to not treat it as a windows executable

I am trying to set up Cmake ARM uC (STM32) embedded project in the VS 2019.
Project buils OK but I struggle to start the debug session.
I have amended launch.vs.json
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "cppdbg",
"name": "GCEC-FW.elf",
"project": "out\\build\\IoT-Debug\\GCEC-FW.elf",
"projectTarget": "",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}\\BUILD\\${workspaceRootFolderName}.elf",
"MIMode": "gdb",
"externalConsole": true,
"inheritEnvironments": [
"gcc_arm"
],
"miDebuggerPath": "${env.gccpath}\\bin\\arm-none-eabi-gdb.exe",
"setupCommands": [
{
"text": "-environment-cd ${workspaceRoot}/BUILD"
},
{
"text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf",
"description": "load file",
"ignoreFailures": false
},
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"visualizerFile": "${debugInfo.linuxNatvisPath}",
"showDisplayString": true,
"miDebuggerServerAddress": "localhost:3333",
"launchCompleteCommand": "None",
"debugServerPath": "C:\\Program Files (x86)\Atollic\\TrueSTUDIO for STM32 9.3.0\\Servers\\J-Link_gdbserver\\JLinkGDBServerCL.exe",
"debugServerArgs": "-port 2331 -s -CPU Cortex-M -device STM32F427II -endian little -speed 4000 -vd -swoport 2332",
"serverStarted": "GDB\\ server\\ started",
"filterStderr": true,
"filterStdout": true
}
]
}
But when I try to start the debug session I am getting error stating that my .elf file is not an win32 executable (which is actually correct - it is not).
The question is: what has to be done VS to start this session?
edit
I needed to change the name when adding appending the new microcontroller debug configuration.
"name": "GCEC-FW.elf"
Now it complains about the path to the gdb.
The new question is: can I output or see build variables in VisualStudio - Like
${workspaceRootFolderName} or ${env.gccpath}
Regarding "... can I output or see build variables in VisualStudio - Like: ${workspaceRootFolderName} or ${env.gccpath}
To display all of the currently available macros, in the Property
Pages dialog, under VC++ Directories, choose the drop-down arrow at
the end of a property row. Click on Edit and then in the edit dialog
box, choose the Macros button. The current set of properties and
macros visible to Visual Studio is listed along with the current value
for each. For more information, see the Specifying User-Defined Values
section of C++ project property page reference.
More here about that.

Atom custom language package not picking up file extensions or highlighting correctly

I'm trying to build a simple atom package that displays some filetypes associated with squarespace development in the correct highlighted way. Iv'e tried reading the docs and looking at related packages and mirroring mine off of theirs but it seems no matter what I do atom wont pickup that these file types have an associated language package installed, and when I manually apply my language it doesn't even highlight them correctly.
The associations I'm trying to build are
.block -> html
.region -> html
.list -> html
.item -> html
.conf -> json
.preset -> json
my package.json looks like
{
"name": "language-squarespace",
"version": "0.4.0",
"description": "Syntax Highlighting for SquareSpace files",
"repository": {
"type": "git",
"url": "https://github.com/blaketarter/language-squarespace"
},
"license": "MIT",
"engines": {
"atom": "*",
"node": "*"
}
}
and an example of one of my grammar files is
'filetypes': [
'block'
]
'name': 'block (squarespace)'
'patterns': [
{
'include': 'source.html'
}
]
'scopeName': 'source.block'
I feel like im missing something important because I based mine off of https://github.com/rgbkrk/language-ipynb and things seem to match.

Composer wont update to lastest package

I'm using Cakephp and Miles's uploader plugin. I've got the composer plugin installed, and I'm using the latest copy of wamp. Fileinfo extension is enabled in php. when I try to update using composer it doesn't - it just uses a previous version. If I change the json file to force an update to the latest version I get and error message telling me the ext-fileinfo is not present - but it is.............
I need to get the lastest version as I have an error which shows up on my webserver which is running php 5.3 (wamp is using 5.4)
Additional info:-
The main composer.json is :-
{"config":{"vendor-dir":"Vendor"},
"require": {
"mjohnson/uploader": "4.3.*",
"mjohnson/utility": "1.5.*",
"mjohnson/decoda": "*",
"titon/utility": "*",
"cakephp/debug_kit": "2.2.*"
}
}
I'm expecting mjohnson/uploader to update (
a sub set composer.JSON is held in the uploader package :-
{
"name": "mjohnson/uploader",
"type": "cakephp-plugin",
"description": "File uploader and validation plugin for CakePHP.",
"keywords": ["cakephp", "uploader", "plugin", "file", "validation", "attachment"],
"homepage": "http://milesj.me/code/cakephp/uploader",
"license": "MIT",
"authors": [
{
"name": "Miles Johnson",
"homepage": "http://milesj.me"
}
],
"require": {
"php": ">=5.3.3",
"ext-curl": "*",
"ext-mbstring": "*",
"composer/installers": "*",`enter code here`
"mjohnson/transit": ">=1.4"
},
"support": {
"source": "https://github.com/milesj/Uploader"
}
}
and I would also have expected mjohnson/transit to have updated
I had a similar problem with ext-fileinfo and ext-curl on Windows 7. My problem was the path variable causing the wrong php.exe to be executed by composer. If php -m from the command line shows ext-fileinfo is not present that could be your problem too.

Resources