Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
58596383
U
uni-app
项目概览
MuGuiLin
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58596383
编写于
5月 19, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: uni-stacktracey test、uts error path
上级
3555bf36
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
33 deletion
+47
-33
packages/uni-stacktracey/__tests__/test.spec.ts
packages/uni-stacktracey/__tests__/test.spec.ts
+16
-13
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
+8
-4
packages/uni-stacktracey/src/index.ts
packages/uni-stacktracey/src/index.ts
+3
-3
packages/uni-stacktracey/test/index.js
packages/uni-stacktracey/test/index.js
+19
-13
packages/uni-stacktracey/test/nativeplugins-sourceMap/DCloud-UTSPlugin/io/dcloud/uniplugin/TestModule.kt.map
...ap/DCloud-UTSPlugin/io/dcloud/uniplugin/TestModule.kt.map
+1
-0
未找到文件。
packages/uni-stacktracey/__tests__/test.spec.ts
浏览文件 @
58596383
const
path
=
require
(
'
path
'
)
const
{
stacktracey
,
uniStracktraceyPreset
,
utsStracktraceyPreset
,
}
=
require
(
'
../dist/uni-stacktracey.cjs.js
'
)
const
utsErrorMsg
=
`Appid: __UNI__E070870
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello
const
utsErrorMsg
=
`e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (9, 5): Unresolved reference: logxxxxxxx
FAILURE: Build failed with an exception.
...
...
@@ -19,7 +18,7 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug
* Get more help at https://help.gradle.org
BUILD FAILED in
3
s`
BUILD FAILED in
2
s`
const
uniErrorMsg
=
`Error: Sentry Error
at a.throwError(/static/js/pages-index-index.3ab0d0e5.js:1:567)
...
...
@@ -35,7 +34,10 @@ describe('uni-stacktracey', () => {
test
(
'
uniStracktraceyPreset local
'
,
()
=>
{
stacktracey
(
uniErrorMsg
,
{
preset
:
uniStracktraceyPreset
({
base
:
'
D:/DCloud_local_git/uni-app-next/packages/uni-stacktracey/test/__UNI__APPID__/1.0.0/.sourcemap/h5/
'
,
base
:
path
.
resolve
(
__dirname
,
'
../test/__UNI__APPID__/1.0.0/.sourcemap/h5/
'
),
sourceRoot
:
''
,
}),
}).
then
((
res
:
string
)
=>
{
...
...
@@ -51,17 +53,18 @@ at node_modules/@sentry/browser/esm/helpers.js:74
})
})
test
(
'
uniStracktraceyPreset
'
,
()
=>
{
test
(
'
uniStracktraceyPreset
local
'
,
()
=>
{
stacktracey
(
utsErrorMsg
,
{
preset
:
utsStracktraceyPreset
({
base
:
'
/usr/fxy/poroject/test/.sourcemap/src/
'
,
sourceRoot
:
'
/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/
'
,
base
:
path
.
resolve
(
__dirname
,
'
../test/nativeplugins-sourceMap/DCloud-UTSPlugin/
'
),
sourceRoot
:
'
DCloud-UTSPlugin/android/src/
'
,
}),
}).
then
((
res
:
string
)
=>
{
expect
(
res
).
toEqual
(
`Appid: __UNI__E070870
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello
expect
(
res
)
.
toEqual
(
`e: C:/Users/xianyang/Documents/HBuilderProjects/test-uni2/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.uts: (7, 0): Unresolved reference: logxxxxxxx
FAILURE: Build failed with an exception.
...
...
@@ -74,7 +77,7 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug
* Get more help at https://help.gradle.org
BUILD FAILED in
3
s`
)
BUILD FAILED in
2
s`
)
})
})
})
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
浏览文件 @
58596383
...
...
@@ -124,7 +124,7 @@ function uniStracktraceyPreset(opts) {
if
(
!
file
)
return
''
;
if
(
sourceRoot
)
{
return
`
${
file
.
replace
(
sourceRoot
,
base
)}
.map`
;
return
`
${
file
.
replace
(
sourceRoot
,
base
+
'
/
'
)}
.map`
;
}
return
`
${
base
}
/
${
file
}
.map`
;
},
...
...
@@ -142,12 +142,16 @@ function uniStracktraceyPreset(opts) {
};
}
function
utsStracktraceyPreset
(
opts
)
{
const
{
base
,
sourceRoot
}
=
opts
;
let
stack
;
let
errStack
=
[];
return
{
parseSourceMapUrl
(
file
,
fileName
)
{
// 根据 base,filename 组合 sourceMapUrl
return
`
${
file
.
replace
(
opts
.
sourceRoot
,
opts
.
base
)}
.map`
;
// 组合 sourceMapUrl
if
(
sourceRoot
)
{
return
`
${
file
.
replace
(
sourceRoot
,
base
+
'
/
'
)}
.map`
;
}
return
`
${
base
}
/
${
file
}
.map`
;
},
getSourceMapContent
(
file
,
fileName
)
{
// 根据 base,filename 组合 sourceMapUrl
...
...
@@ -198,7 +202,7 @@ function utsStracktraceyPreset(opts) {
if
(
item
===
'
%StacktraceyItem%
'
)
{
const
_stack
=
stack
.
items
.
shift
();
if
(
_stack
)
return
`
${
_stack
.
callee
}${
_stack
.
file
Short
}
/
${
_stack
.
fileName
}
: (
${
_stack
.
line
}
,
${
_stack
.
column
}
):
${
_stack
.
errMsg
}
`
;
return
`
${
_stack
.
callee
}${
_stack
.
file
}
: (
${
_stack
.
line
}
,
${
_stack
.
column
}
):
${
_stack
.
errMsg
}
`
;
}
return
item
;
})
...
...
packages/uni-stacktracey/src/index.ts
浏览文件 @
58596383
...
...
@@ -197,7 +197,7 @@ export function uniStracktraceyPreset(
file
=
(
file
.
match
(
/
(\/
.*
)
/
)
||
[])[
1
]
if
(
!
file
)
return
''
if
(
sourceRoot
)
{
return
`
${
file
.
replace
(
sourceRoot
,
base
)}
.map`
return
`
${
file
.
replace
(
sourceRoot
,
base
+
'
/
'
)}
.map`
}
return
`
${
base
}
/
${
file
}
.map`
},
...
...
@@ -241,7 +241,7 @@ export function utsStracktraceyPreset(
parseSourceMapUrl
(
file
,
fileName
)
{
// 组合 sourceMapUrl
if
(
sourceRoot
)
{
return
`
${
file
.
replace
(
sourceRoot
,
base
)}
.map`
return
`
${
file
.
replace
(
sourceRoot
,
base
+
'
/
'
)}
.map`
}
return
`
${
base
}
/
${
file
}
.map`
},
...
...
@@ -306,7 +306,7 @@ export function utsStracktraceyPreset(
if
(
item
===
'
%StacktraceyItem%
'
)
{
const
_stack
=
stack
.
items
.
shift
()
if
(
_stack
)
return
`
${
_stack
.
callee
}${
_stack
.
file
Short
}
/
${
_stack
.
fileName
}
: (
${
_stack
.
line
}
,
${
_stack
.
column
}
):
${
_stack
.
errMsg
}
`
return
`
${
_stack
.
callee
}${
_stack
.
file
}
: (
${
_stack
.
line
}
,
${
_stack
.
column
}
):
${
_stack
.
errMsg
}
`
}
return
item
})
...
...
packages/uni-stacktracey/test/index.js
浏览文件 @
58596383
const
path
=
require
(
'
path
'
)
const
{
stacktracey
,
uniStracktraceyPreset
,
utsStracktraceyPreset
,
}
=
require
(
'
../dist/uni-stacktracey.cjs.js
'
)
const
utsErrorMsg
=
`Appid: __UNI__E070870
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello
e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello
const
utsErrorMsg
=
`e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (9, 5): Unresolved reference: logxxxxxxx
FAILURE: Build failed with an exception.
...
...
@@ -19,7 +18,8 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug
* Get more help at https://help.gradle.org
BUILD FAILED in 3s`
BUILD FAILED in 2s
`
const
uniErrorMsg
=
`Error: Sentry Error
at a.throwError(/static/js/pages-index-index.3ab0d0e5.js:1:567)
...
...
@@ -31,20 +31,26 @@ at HTMLElement.n(/static/js/chunk-vendors.75525bd5.js:34:13824)
at HTMLElement.o._wrapper(/static/js/chunk-vendors.75525bd5.js:34:53966)
at HTMLElement.i(/static/js/chunk-vendors.75525bd5.js:7:609894)`
stacktracey
(
uniErrorMsg
,
{
/*
stacktracey(uniErrorMsg, {
preset: uniStracktraceyPreset({
base
:
'
D:/DCloud_local_git/uni-app-next/packages/uni-stacktracey/test/__UNI__APPID__/1.0.0/.sourcemap/h5/
'
,
base:
path.resolve(__dirname, './__UNI__APPID__/1.0.0/.sourcemap/h5/')
,
sourceRoot: '',
}),
}).then((res) => {
console.log('res :>> ', res)
})
/* stacktracey(utsErrorMsg, {
}) */
console
.
log
(
'
path.resolve(__dirname, "./nativeplugins-sourceMap/DCloud-UTSPlugin/"), :>>
'
,
path
.
resolve
(
__dirname
,
'
./nativeplugins-sourceMap/DCloud-UTSPlugin/
'
)
)
stacktracey
(
utsErrorMsg
,
{
preset
:
utsStracktraceyPreset
({
base: '/usr/fxy/poroject/test/.sourcemap/src/',
sourceRoot:
'/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/',
base
:
path
.
resolve
(
__dirname
,
'
./nativeplugins-sourceMap/DCloud-UTSPlugin/
'
),
sourceRoot
:
'
DCloud-UTSPlugin/android/src/
'
,
}),
}).
then
((
res
)
=>
{
console.log('res :>> ', res)
;
})
*/
console
.
log
(
'
res :>>
'
,
res
)
})
packages/uni-stacktracey/test/nativeplugins-sourceMap/DCloud-UTSPlugin/io/dcloud/uniplugin/TestModule.kt.map
0 → 100644
浏览文件 @
58596383
{"version":3,"sources":["C:/Users/xianyang/Documents/HBuilderProjects/test-uni2/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["logxxxxxxx","TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":";AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;;IACxBA,UAAU;;AACK,WAAMC,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,kBAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录