我正在将 Jest 测试用例运行到一个 ReactJS 项目中。我正在尝试在 VS code 中调试我的笑话测试用例。测试在命令行上运行正常。但是当我在 VS Code 中启动调试器时,我看到错误。
启动.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Tests",
"program": "${workspaceRoot}/xxx/xxx/node_modules/jest/bin/jest",
"args": [
"-i"
],
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceRoot}/xxx/xxx/**/*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
Debugger listening on ws://127.0.0.1:31182/2bf113f1-002f-49ed-ad91-5510affd172a
Debugger attached.
Error: Could not find a config file based on provided values:
path: "/Users/xxx/xxx/xxx-ui"
cwd: "/Users/xxx/xxx/xxx-ui"
Configh paths must be specified by either a direct path to a config
file, or a path to …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个触发器,我需要将新行转换为 json 并插入到另一个表中。我不明白。
CREATE OR REPLACE FUNCTION public.eventlogs_add_user()
RETURNS trigger AS
$BODY$
DECLARE newRecord JSON;
BEGIN
newRecord := row_to_json(row)
from (NEW) row;
// Insert newRecord into another table
RETURN NEW;
END$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION public.eventlogs_add_user()
OWNER TO postgres;
-----------------------------------------------------------
Run Code Online (Sandbox Code Playgroud) 我有一个 ES6 Map ,其中键是数字。有时键是数字,有时键是表示数字的字符串。对我来说,地图在运行时永远不会有重复的键。示例我永远不会拥有键 "1" 和 1 。
从地图检索时,我需要一个简单的单行代码,它将否定键是字符串还是数字。
var map = new Map();
undefined
map.set('1', 'string one');
map.set(2, 'number tow')
Map(2) {"1" => "string one", 2 => "number tow"}
map.get(1)
undefined
map.get('1')
"string one"
Run Code Online (Sandbox Code Playgroud)