Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
19ad2f30
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
19ad2f30
编写于
9月 07, 2017
作者:
J
Joao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix debug tests
上级
5e85ee5a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
31 deletion
+63
-31
test/smoke/src/areas/debug/debug.test.ts
test/smoke/src/areas/debug/debug.test.ts
+46
-21
test/smoke/src/areas/debug/debug.ts
test/smoke/src/areas/debug/debug.ts
+12
-8
test/smoke/src/main.ts
test/smoke/src/main.ts
+4
-1
test/smoke/src/spectron/application.ts
test/smoke/src/spectron/application.ts
+1
-1
未找到文件。
test/smoke/src/areas/debug/debug.test.ts
浏览文件 @
19ad2f30
...
...
@@ -5,32 +5,57 @@
import
*
as
assert
from
'
assert
'
;
import
*
as
http
from
'
http
'
;
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
stripJsonComments
from
'
strip-json-comments
'
;
import
{
SpectronApplication
,
VSCODE_BUILD
}
from
'
../../spectron/application
'
;
import
{
SpectronApplication
,
VSCODE_BUILD
,
EXTENSIONS_DIR
}
from
'
../../spectron/application
'
;
describe
(
'
Debug
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
();
if
(
app
.
build
===
VSCODE_BUILD
.
DEV
)
{
const
extensionsPath
=
path
.
join
(
os
.
homedir
(),
'
.vscode-oss-dev
'
,
'
extensions
'
);
const
debugPath
=
path
.
join
(
extensionsPath
,
'
vscode-node-debug
'
);
const
debugExists
=
fs
.
existsSync
(
debugPath
);
const
debug2Path
=
path
.
join
(
extensionsPath
,
'
vscode-node-debug2
'
);
const
debug2Exists
=
fs
.
existsSync
(
debug2Path
);
if
(
!
debugExists
)
{
console
.
warn
(
`Skipping debug tests because vscode-node-debug extension was not found in
${
extensionsPath
}
`
);
return
;
}
if
(
!
debug2Exists
)
{
console
.
warn
(
`Skipping debug tests because vscode-node-debug2 extension was not found in
${
extensionsPath
}
`
);
return
;
}
fs
.
symlinkSync
(
debugPath
,
path
.
join
(
EXTENSIONS_DIR
,
'
vscode-node-debug
'
));
fs
.
symlinkSync
(
debug2Path
,
path
.
join
(
EXTENSIONS_DIR
,
'
vscode-node-debug2
'
));
}
before
(()
=>
app
.
start
());
after
(()
=>
app
.
stop
());
if
(
app
.
build
!==
VSCODE_BUILD
.
DEV
)
{
it
(
'
configure launch json
'
,
async
function
()
{
await
app
.
workbench
.
debug
.
openDebugViewlet
();
await
app
.
workbench
.
openFile
(
'
app.js
'
);
await
app
.
workbench
.
debug
.
configure
();
const
content
=
await
app
.
workbench
.
editor
.
getEditorVisibleText
();
const
json
=
JSON
.
parse
(
stripJsonComments
(
content
));
assert
.
equal
(
json
.
configurations
[
0
].
request
,
'
launch
'
);
assert
.
equal
(
json
.
configurations
[
0
].
type
,
'
node
'
);
if
(
process
.
platform
===
'
win32
'
)
{
assert
.
equal
(
json
.
configurations
[
0
].
program
,
'
${workspaceRoot}
\\
bin
\\
www
'
);
}
else
{
assert
.
equal
(
json
.
configurations
[
0
].
program
,
'
${workspaceRoot}/bin/www
'
);
}
});
}
it
(
'
configure launch json
'
,
async
function
()
{
await
app
.
workbench
.
debug
.
openDebugViewlet
();
await
app
.
workbench
.
openFile
(
'
app.js
'
);
await
app
.
workbench
.
debug
.
configure
();
const
content
=
await
app
.
workbench
.
editor
.
getEditorVisibleText
();
const
json
=
JSON
.
parse
(
stripJsonComments
(
content
));
assert
.
equal
(
json
.
configurations
[
0
].
request
,
'
launch
'
);
assert
.
equal
(
json
.
configurations
[
0
].
type
,
'
node
'
);
if
(
process
.
platform
===
'
win32
'
)
{
assert
.
equal
(
json
.
configurations
[
0
].
program
,
'
${workspaceRoot}
\\
bin
\\
www
'
);
}
else
{
assert
.
equal
(
json
.
configurations
[
0
].
program
,
'
${workspaceRoot}/bin/www
'
);
}
});
it
(
'
breakpoints
'
,
async
function
()
{
await
app
.
workbench
.
openFile
(
'
index.js
'
);
...
...
@@ -39,7 +64,7 @@ describe('Debug', () => {
it
(
'
start debugging
'
,
async
function
()
{
await
app
.
workbench
.
debug
.
startDebugging
();
setTimeout
(()
=>
http
.
get
(
'
http://localhost:3000
'
).
on
(
'
error
'
,
e
=>
void
0
),
2
00
);
setTimeout
(()
=>
http
.
get
(
`http://localhost:3000`
).
on
(
'
error
'
,
e
=>
void
0
),
4
00
);
await
app
.
workbench
.
debug
.
waitForStackFrame
(
sf
=>
sf
.
name
===
'
index.js
'
&&
sf
.
lineNumber
===
6
);
});
...
...
@@ -64,7 +89,7 @@ describe('Debug', () => {
it
(
'
continue
'
,
async
function
()
{
await
app
.
workbench
.
debug
.
continue
();
setTimeout
(()
=>
http
.
get
(
'
http://localhost:3000
'
).
on
(
'
error
'
,
e
=>
void
0
),
2
00
);
setTimeout
(()
=>
http
.
get
(
`http://localhost:3000`
).
on
(
'
error
'
,
e
=>
void
0
),
4
00
);
await
app
.
workbench
.
debug
.
waitForStackFrame
(
sf
=>
sf
.
name
===
'
index.js
'
&&
sf
.
lineNumber
===
6
);
});
...
...
test/smoke/src/areas/debug/debug.ts
浏览文件 @
19ad2f30
...
...
@@ -23,7 +23,9 @@ const NOT_DEBUG_STATUS_BAR = `.statusbar:not(debugging)`;
const
TOOLBAR_HIDDEN
=
`.debug-actions-widget.builder-hidden`
;
const
STACK_FRAME
=
`
${
VIEWLET
}
.monaco-tree-row .stack-frame`
;
const
VARIABLE
=
`
${
VIEWLET
}
.debug-variables .monaco-tree-row .expression`
;
const
CONSOLE_OUTPUT
=
`.repl .input-output-pair .output.expression`
;
const
CONSOLE_OUTPUT
=
`.repl .output.expression`
;
const
CONSOLE_INPUT_OUTPUT
=
`.repl .input-output-pair .output.expression`
;
const
SCOPE
=
`
${
VIEWLET
}
.debug-variables .scope`
;
const
REPL_FOCUSED
=
'
.repl-input-wrapper .monaco-editor.focused
'
;
...
...
@@ -86,7 +88,7 @@ export class Debug extends Viewlet {
return
await
this
.
spectron
.
client
.
waitFor
(
async
()
=>
{
const
stackFrames
=
await
this
.
getStackFrames
();
return
stackFrames
.
filter
(
func
)[
0
];
});
;
});
}
async
focusStackFrame
(
name
:
string
):
Promise
<
any
>
{
...
...
@@ -99,12 +101,14 @@ export class Debug extends Viewlet {
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Debug: Focus Debug Console
'
);
await
this
.
spectron
.
client
.
waitForElement
(
REPL_FOCUSED
);
await
this
.
spectron
.
client
.
type
(
text
);
await
this
.
spectron
.
client
.
waitForElement
(
CONSOLE_OUTPUT
+
` .
${
type
}
`
);
await
this
.
spectron
.
client
.
waitForElement
(
CONSOLE_
INPUT_
OUTPUT
+
` .
${
type
}
`
);
return
this
.
getLastConsoleOutput
();
const
result
=
await
this
.
getConsoleOutput
();
return
result
[
result
.
length
-
1
]
||
''
;
}
async
getLocalVariableCount
():
Promise
<
number
>
{
await
this
.
spectron
.
client
.
waitForElement
(
SCOPE
);
return
await
this
.
spectron
.
webclient
.
selectorExecute
(
VARIABLE
,
div
=>
(
Array
.
isArray
(
div
)
?
div
:
[
div
]).
length
);
}
...
...
@@ -126,14 +130,14 @@ export class Debug extends Viewlet {
return
result
.
map
(({
name
,
lineNumber
,
element
})
=>
({
name
,
lineNumber
,
id
:
element
.
ELEMENT
}));
}
private
async
get
LastConsoleOutput
():
Promise
<
string
>
{
private
async
get
ConsoleOutput
():
Promise
<
string
[]
>
{
const
result
=
await
this
.
spectron
.
webclient
.
selectorExecute
(
CONSOLE_OUTPUT
,
div
=>
(
Array
.
isArray
(
div
)
?
div
:
[
div
]).
map
(
element
=>
{
const
value
=
element
.
querySelector
(
'
.value
'
)
as
HTMLElement
;
return
value
.
textContent
;
})
return
value
&&
value
.
textContent
;
})
.
filter
(
line
=>
!!
line
)
);
return
result
.
pop
()
;
return
result
;
}
}
test/smoke/src/main.ts
浏览文件 @
19ad2f30
...
...
@@ -10,6 +10,7 @@ import * as path from 'path';
import
*
as
minimist
from
'
minimist
'
;
import
*
as
tmp
from
'
tmp
'
;
import
*
as
rimraf
from
'
rimraf
'
;
import
*
as
mkdirp
from
'
mkdirp
'
;
const
[,
,
...
args
]
=
process
.
argv
;
const
opts
=
minimist
(
args
,
{
string
:
[
'
build
'
,
'
stable-build
'
,
'
screenshot
'
]
});
...
...
@@ -22,6 +23,8 @@ const workspacePath = path.join(testDataPath, 'smoketest.code-workspace');
const
testRepoUrl
=
'
https://github.com/Microsoft/vscode-smoketest-express
'
;
const
testRepoLocalDir
=
path
.
join
(
testDataPath
,
'
vscode-smoketest-express
'
);
const
keybindingsPath
=
path
.
join
(
testDataPath
,
'
keybindings.json
'
);
const
extensionsPath
=
path
.
join
(
testDataPath
,
'
extensions-dir
'
);
mkdirp
.
sync
(
extensionsPath
);
function
fail
(
errorMessage
):
void
{
console
.
error
(
errorMessage
);
...
...
@@ -72,7 +75,7 @@ if (!fs.existsSync(testCodePath)) {
}
process
.
env
.
VSCODE_USER_DIR
=
path
.
join
(
testDataPath
,
'
user-dir
'
);
process
.
env
.
VSCODE_EXTENSIONS_DIR
=
path
.
join
(
testDataPath
,
'
extensions-dir
'
)
;
process
.
env
.
VSCODE_EXTENSIONS_DIR
=
extensionsPath
;
process
.
env
.
SCREENSHOTS_DIR
=
path
.
join
(
testDataPath
,
'
screenshots-dir
'
);
process
.
env
.
SMOKETEST_REPO
=
testRepoLocalDir
;
process
.
env
.
VSCODE_WORKSPACE_PATH
=
workspacePath
;
...
...
test/smoke/src/spectron/application.ts
浏览文件 @
19ad2f30
...
...
@@ -112,7 +112,7 @@ export class SpectronApplication {
// Prevent 'Getting Started' web page from opening on clean user-data-dir
args
.
push
(
'
--skip-getting-started
'
);
// Ensure that running over custom extensions directory, rather than picking up the one that was used by a tester previously
args
.
push
(
`--extensions-dir=
${
path
.
join
(
EXTENSIONS_DIR
,
new
Date
().
getTime
().
toString
())
}
`
);
args
.
push
(
`--extensions-dir=
${
EXTENSIONS_DIR
}
`
);
args
.
push
(...
moreArgs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录