Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e2c91378
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
e2c91378
编写于
1月 06, 2021
作者:
C
Connor Peet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testing: fix unit tests
上级
59091157
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
23 addition
and
616 deletion
+23
-616
build/gulpfile.extensions.js
build/gulpfile.extensions.js
+0
-1
build/npm/dirs.js
build/npm/dirs.js
+0
-1
extensions/testing-editor-contributions/.vscodeignore
extensions/testing-editor-contributions/.vscodeignore
+0
-6
extensions/testing-editor-contributions/README.md
extensions/testing-editor-contributions/README.md
+0
-5
extensions/testing-editor-contributions/extension-browser.webpack.config.js
...-editor-contributions/extension-browser.webpack.config.js
+0
-22
extensions/testing-editor-contributions/extension.webpack.config.js
.../testing-editor-contributions/extension.webpack.config.js
+0
-20
extensions/testing-editor-contributions/package.json
extensions/testing-editor-contributions/package.json
+0
-48
extensions/testing-editor-contributions/package.nls.json
extensions/testing-editor-contributions/package.nls.json
+0
-19
extensions/testing-editor-contributions/src/extension.ts
extensions/testing-editor-contributions/src/extension.ts
+0
-412
extensions/testing-editor-contributions/src/typings/refs.d.ts
...nsions/testing-editor-contributions/src/typings/refs.d.ts
+0
-7
extensions/testing-editor-contributions/tsconfig.json
extensions/testing-editor-contributions/tsconfig.json
+0
-9
extensions/testing-editor-contributions/yarn.lock
extensions/testing-editor-contributions/yarn.lock
+0
-8
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+8
-6
src/vs/workbench/api/browser/mainThreadTesting.ts
src/vs/workbench/api/browser/mainThreadTesting.ts
+1
-19
src/vs/workbench/api/common/extHostTesting.ts
src/vs/workbench/api/common/extHostTesting.ts
+3
-7
src/vs/workbench/contrib/testing/browser/testing.contribution.ts
...workbench/contrib/testing/browser/testing.contribution.ts
+0
-19
src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
.../workbench/contrib/testing/browser/testingExplorerView.ts
+11
-3
src/vs/workbench/contrib/testing/common/testServiceImpl.ts
src/vs/workbench/contrib/testing/common/testServiceImpl.ts
+0
-4
未找到文件。
build/gulpfile.extensions.js
浏览文件 @
e2c91378
...
...
@@ -60,7 +60,6 @@ const compilations = [
'
python/tsconfig.json
'
,
'
search-result/tsconfig.json
'
,
'
simple-browser/tsconfig.json
'
,
'
testing-editor-contributions/tsconfig.json
'
,
'
typescript-language-features/test-workspace/tsconfig.json
'
,
'
typescript-language-features/tsconfig.json
'
,
'
vscode-api-tests/tsconfig.json
'
,
...
...
build/npm/dirs.js
浏览文件 @
e2c91378
...
...
@@ -35,7 +35,6 @@ exports.dirs = [
'
extensions/php-language-features
'
,
'
extensions/search-result
'
,
'
extensions/simple-browser
'
,
'
extensions/testing-editor-contributions
'
,
'
extensions/typescript-language-features
'
,
'
extensions/vscode-api-tests
'
,
'
extensions/vscode-colorize-tests
'
,
...
...
extensions/testing-editor-contributions/.vscodeignore
已删除
100644 → 0
浏览文件 @
59091157
src/**
out/**
tsconfig.json
extension.webpack.config.js
extension-browser.webpack.config.js
yarn.lock
extensions/testing-editor-contributions/README.md
已删除
100644 → 0
浏览文件 @
59091157
# Testing Editor Contributions
**Notice:**
This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Provides the in-editor experience for tests and test results
extensions/testing-editor-contributions/extension-browser.webpack.config.js
已删除
100644 → 0
浏览文件 @
59091157
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'
use strict
'
;
const
withBrowserDefaults
=
require
(
'
../shared.webpack.config
'
).
browser
;
const
path
=
require
(
'
path
'
);
module
.
exports
=
withBrowserDefaults
({
context
:
__dirname
,
entry
:
{
extension
:
'
./src/extension.ts
'
},
output
:
{
filename
:
'
extension.js
'
,
path
:
path
.
join
(
__dirname
,
'
dist
'
)
}
});
extensions/testing-editor-contributions/extension.webpack.config.js
已删除
100644 → 0
浏览文件 @
59091157
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'
use strict
'
;
const
withDefaults
=
require
(
'
../shared.webpack.config
'
);
module
.
exports
=
withDefaults
({
context
:
__dirname
,
resolve
:
{
mainFields
:
[
'
module
'
,
'
main
'
]
},
entry
:
{
extension
:
'
./src/extension.ts
'
,
}
});
extensions/testing-editor-contributions/package.json
已删除
100644 → 0
浏览文件 @
59091157
{
"name"
:
"testing-editor-contributions"
,
"displayName"
:
"%displayName%"
,
"description"
:
"%description%"
,
"version"
:
"1.0.0"
,
"enableProposedApi"
:
true
,
"publisher"
:
"vscode"
,
"license"
:
"MIT"
,
"engines"
:
{
"vscode"
:
"^1.39.0"
},
"categories"
:
[
"Other"
],
"main"
:
"./out/extension.js"
,
"browser"
:
"./dist/extension.js"
,
"activationEvents"
:
[
"onStartupFinished"
],
"dependencies"
:
{
"vscode-nls"
:
"^5.0.0"
},
"contributes"
:
{
"configuration"
:
{
"title"
:
"Testing"
,
"properties"
:
{
"testing.enableCodeLens"
:
{
"description"
:
"%config.enableCodeLens%"
,
"type"
:
"boolean"
,
"default"
:
true
},
"testing.enableProblemDiagnostics"
:
{
"description"
:
"%config.enableProblemDiagnostics%"
,
"type"
:
"boolean"
,
"default"
:
true
}
}
}
},
"scripts"
:
{
"vscode:prepublish"
:
"node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:testing-editor-contributions ./tsconfig.json"
},
"prettier"
:
{
"printWidth"
:
100
,
"singleQuote"
:
true
,
"trailingComma"
:
"all"
}
}
extensions/testing-editor-contributions/package.nls.json
已删除
100644 → 0
浏览文件 @
59091157
{
"displayName"
:
"Testing Editor Contributions"
,
"description"
:
"Provides the in-editor experience for tests and test results."
,
"action.run"
:
"Run Tests"
,
"action.debug"
:
"Debug"
,
"tooltip.run"
:
"Run {0}"
,
"tooltip.debug"
:
"Debug {0}"
,
"tooltip.runState"
:
"{0}/{0} Tests Passed"
,
"tooltip.runStateWithDuration"
:
"{0}/{1} Tests Passed in {2}"
,
"state.failed"
:
"Failed"
,
"state.passed"
:
"Passed"
,
"state.passedWithDuration"
:
"Passed in {0}"
,
"config.enableCodeLens"
:
"Whether code lens on test cases and suites should be visible"
,
"config.enableProblemDiagnostics"
:
"Whether test failures should be reported in the 'problems' view and show as errors in the editor."
}
extensions/testing-editor-contributions/src/extension.ts
已删除
100644 → 0
浏览文件 @
59091157
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
vscode
from
'
vscode
'
;
import
*
as
nls
from
'
vscode-nls
'
;
const
localize
=
nls
.
loadMessageBundle
();
interface
IDisposable
{
dispose
():
void
;
}
const
enum
Constants
{
ConfigSection
=
'
testing
'
,
EnableCodeLensConfig
=
'
enableCodeLens
'
,
EnableDiagnosticsConfig
=
'
enableProblemDiagnostics
'
,
}
export
function
activate
(
context
:
vscode
.
ExtensionContext
)
{
const
diagnostics
=
vscode
.
languages
.
createDiagnosticCollection
();
const
services
=
new
TestingEditorServices
(
diagnostics
);
context
.
subscriptions
.
push
(
services
,
diagnostics
,
vscode
.
languages
.
registerCodeLensProvider
({
scheme
:
'
file
'
},
services
),
);
}
class
TestingConfig
implements
IDisposable
{
private
section
=
vscode
.
workspace
.
getConfiguration
(
Constants
.
ConfigSection
);
private
readonly
changeEmitter
=
new
vscode
.
EventEmitter
<
void
>
();
private
readonly
listener
=
vscode
.
workspace
.
onDidChangeConfiguration
(
evt
=>
{
if
(
evt
.
affectsConfiguration
(
Constants
.
ConfigSection
))
{
this
.
section
=
vscode
.
workspace
.
getConfiguration
(
Constants
.
ConfigSection
);
this
.
changeEmitter
.
fire
();
}
});
public
readonly
onChange
=
this
.
changeEmitter
.
event
;
public
get
codeLens
()
{
return
this
.
section
.
get
(
Constants
.
EnableCodeLensConfig
,
true
);
}
public
get
diagnostics
()
{
return
this
.
section
.
get
(
Constants
.
EnableDiagnosticsConfig
,
true
);
}
public
get
isEnabled
()
{
return
this
.
codeLens
||
this
.
diagnostics
;
}
public
dispose
()
{
this
.
listener
.
dispose
();
}
}
export
class
TestingEditorServices
implements
IDisposable
,
vscode
.
CodeLensProvider
{
private
readonly
codeLensChangeEmitter
=
new
vscode
.
EventEmitter
<
void
>
();
private
readonly
documents
=
new
Map
<
string
,
DocumentTestObserver
>
();
private
readonly
config
=
new
TestingConfig
();
private
disposables
:
IDisposable
[];
private
wasEnabled
=
this
.
config
.
isEnabled
;
/**
* @inheritdoc
*/
public
readonly
onDidChangeCodeLenses
=
this
.
codeLensChangeEmitter
.
event
;
constructor
(
private
readonly
diagnostics
:
vscode
.
DiagnosticCollection
)
{
this
.
disposables
=
[
new
vscode
.
Disposable
(()
=>
this
.
expireAll
()),
this
.
config
,
vscode
.
window
.
onDidChangeVisibleTextEditors
((
editors
)
=>
{
if
(
!
this
.
config
.
isEnabled
)
{
return
;
}
const
expiredEditors
=
new
Set
(
this
.
documents
.
keys
());
for
(
const
editor
of
editors
)
{
const
key
=
editor
.
document
.
uri
.
toString
();
this
.
ensure
(
key
,
editor
.
document
);
expiredEditors
.
delete
(
key
);
}
for
(
const
expired
of
expiredEditors
)
{
this
.
expire
(
expired
);
}
}),
vscode
.
workspace
.
onDidCloseTextDocument
((
document
)
=>
{
this
.
expire
(
document
.
uri
.
toString
());
}),
this
.
config
.
onChange
(()
=>
{
if
(
!
this
.
wasEnabled
||
this
.
config
.
isEnabled
)
{
this
.
attachToAllVisible
();
}
else
if
(
this
.
wasEnabled
||
!
this
.
config
.
isEnabled
)
{
this
.
expireAll
();
}
this
.
wasEnabled
=
this
.
config
.
isEnabled
;
this
.
codeLensChangeEmitter
.
fire
();
}),
];
if
(
this
.
config
.
isEnabled
)
{
this
.
attachToAllVisible
();
}
}
/**
* @inheritdoc
*/
public
provideCodeLenses
(
document
:
vscode
.
TextDocument
)
{
if
(
!
this
.
config
.
codeLens
)
{
return
[];
}
return
this
.
documents
.
get
(
document
.
uri
.
toString
())?.
provideCodeLenses
()
??
[];
}
/**
* Attach to all currently visible editors.
*/
private
attachToAllVisible
()
{
for
(
const
editor
of
vscode
.
window
.
visibleTextEditors
)
{
this
.
ensure
(
editor
.
document
.
uri
.
toString
(),
editor
.
document
);
}
}
/**
* Unattaches to all tests.
*/
private
expireAll
()
{
for
(
const
observer
of
this
.
documents
.
values
())
{
observer
.
dispose
();
}
this
.
documents
.
clear
();
}
/**
* Subscribes to tests for the document URI.
*/
private
ensure
(
key
:
string
,
document
:
vscode
.
TextDocument
)
{
const
state
=
this
.
documents
.
get
(
key
);
if
(
!
state
)
{
const
observer
=
new
DocumentTestObserver
(
document
,
this
.
diagnostics
,
this
.
config
);
this
.
documents
.
set
(
key
,
observer
);
observer
.
onDidChangeCodeLenses
(()
=>
this
.
config
.
codeLens
&&
this
.
codeLensChangeEmitter
.
fire
());
}
}
/**
* Expires and removes the watcher for the document.
*/
private
expire
(
key
:
string
)
{
const
observer
=
this
.
documents
.
get
(
key
);
if
(
!
observer
)
{
return
;
}
observer
.
dispose
();
this
.
documents
.
delete
(
key
);
}
/**
* @override
*/
public
dispose
()
{
this
.
disposables
.
forEach
((
d
)
=>
d
.
dispose
());
}
}
class
DocumentTestObserver
implements
IDisposable
{
private
readonly
codeLensChangeEmitter
=
new
vscode
.
EventEmitter
<
void
>
();
private
readonly
observer
=
vscode
.
test
.
createDocumentTestObserver
(
this
.
document
);
private
readonly
disposables
:
IDisposable
[];
public
readonly
onDidChangeCodeLenses
=
this
.
codeLensChangeEmitter
.
event
;
private
didHaveDiagnostics
=
this
.
config
.
diagnostics
;
constructor
(
private
readonly
document
:
vscode
.
TextDocument
,
private
readonly
diagnostics
:
vscode
.
DiagnosticCollection
,
private
readonly
config
:
TestingConfig
,
)
{
this
.
disposables
=
[
this
.
observer
,
this
.
codeLensChangeEmitter
,
config
.
onChange
(()
=>
{
if
(
this
.
didHaveDiagnostics
&&
!
config
.
diagnostics
)
{
this
.
diagnostics
.
set
(
document
.
uri
,
[]);
}
else
if
(
!
this
.
didHaveDiagnostics
&&
config
.
diagnostics
)
{
this
.
updateDiagnostics
();
}
this
.
didHaveDiagnostics
=
config
.
diagnostics
;
}),
this
.
observer
.
onDidChangeTest
(()
=>
{
this
.
updateDiagnostics
();
this
.
codeLensChangeEmitter
.
fire
();
}),
];
}
private
updateDiagnostics
()
{
if
(
!
this
.
config
.
diagnostics
)
{
return
;
}
const
uriString
=
this
.
document
.
uri
.
toString
();
const
diagnostics
:
vscode
.
Diagnostic
[]
=
[];
for
(
const
test
of
iterateOverTests
(
this
.
observer
.
tests
))
{
for
(
const
message
of
test
.
state
.
messages
)
{
if
(
message
.
location
?.
uri
.
toString
()
===
uriString
)
{
diagnostics
.
push
({
range
:
message
.
location
.
range
,
message
:
message
.
message
.
toString
(),
severity
:
testToDiagnosticSeverity
(
message
.
severity
),
});
}
}
}
this
.
diagnostics
.
set
(
this
.
document
.
uri
,
diagnostics
);
}
public
provideCodeLenses
():
vscode
.
CodeLens
[]
{
const
lenses
:
vscode
.
CodeLens
[]
=
[];
for
(
const
test
of
iterateOverTests
(
this
.
observer
.
tests
))
{
const
{
debuggable
=
false
,
runnable
=
true
}
=
test
;
if
(
!
test
.
location
||
!
(
debuggable
||
runnable
))
{
continue
;
}
const
summary
=
summarize
(
test
);
lenses
.
push
({
isResolved
:
true
,
range
:
test
.
location
.
range
,
command
:
{
title
:
`$(
${
testStateToIcon
[
summary
.
computedState
]}
)
${
getLabelFor
(
test
,
summary
)}
`
,
command
:
'
vscode.runTests
'
,
arguments
:
[[
test
]],
tooltip
:
localize
(
'
tooltip.debug
'
,
'
Debug {0}
'
,
test
.
label
),
},
});
if
(
debuggable
)
{
lenses
.
push
({
isResolved
:
true
,
range
:
test
.
location
.
range
,
command
:
{
title
:
localize
(
'
action.debug
'
,
'
Debug
'
),
command
:
'
vscode.debugTests
'
,
arguments
:
[[
test
]],
tooltip
:
localize
(
'
tooltip.debug
'
,
'
Debug {0}
'
,
test
.
label
),
},
});
}
}
return
lenses
;
}
/**
* @override
*/
public
dispose
()
{
this
.
diagnostics
.
set
(
this
.
document
.
uri
,
[]);
this
.
disposables
.
forEach
(
d
=>
d
.
dispose
());
}
}
function
getLabelFor
(
test
:
vscode
.
TestItem
,
summary
:
ITestSummary
)
{
if
(
summary
.
duration
!==
undefined
)
{
return
localize
(
'
tooltip.runStateWithDuration
'
,
'
{0}/{1} Tests Passed in {2}
'
,
summary
.
passed
,
summary
.
passed
+
summary
.
failed
,
formatDuration
(
summary
.
duration
),
);
}
if
(
summary
.
passed
>
0
||
summary
.
failed
>
0
)
{
return
localize
(
'
tooltip.runState
'
,
'
{0}/{1} Tests Passed
'
,
summary
.
passed
,
summary
.
failed
);
}
if
(
test
.
state
.
runState
===
vscode
.
TestRunState
.
Passed
)
{
return
test
.
state
.
duration
!==
undefined
?
localize
(
'
state.passedWithDuration
'
,
'
Passed in {0}
'
,
formatDuration
(
test
.
state
.
duration
))
:
localize
(
'
state.passed
'
,
'
Passed
'
);
}
if
(
isFailedState
(
test
.
state
.
runState
))
{
return
localize
(
'
state.failed
'
,
'
Failed
'
);
}
return
localize
(
'
action.run
'
,
'
Run Tests
'
);
}
function
formatDuration
(
duration
:
number
)
{
if
(
duration
<
1
_000
)
{
return
`
${
Math
.
round
(
duration
)}
ms`
;
}
if
(
duration
<
100
_000
)
{
return
`
${(
duration
/
1000
).
toPrecision
(
3
)}
s`
;
}
return
`
${(
duration
/
1000
/
60
).
toPrecision
(
3
)}
m`
;
}
const
statePriority
:
{
[
K
in
vscode
.
TestRunState
]:
number
}
=
{
[
vscode
.
TestRunState
.
Running
]:
6
,
[
vscode
.
TestRunState
.
Queued
]:
5
,
[
vscode
.
TestRunState
.
Errored
]:
4
,
[
vscode
.
TestRunState
.
Failed
]:
3
,
[
vscode
.
TestRunState
.
Passed
]:
2
,
[
vscode
.
TestRunState
.
Skipped
]:
1
,
[
vscode
.
TestRunState
.
Unset
]:
0
,
};
const
maxPriority
=
(
a
:
vscode
.
TestRunState
,
b
:
vscode
.
TestRunState
)
=>
statePriority
[
a
]
>
statePriority
[
b
]
?
a
:
b
;
const
isFailedState
=
(
s
:
vscode
.
TestRunState
)
=>
s
===
vscode
.
TestRunState
.
Failed
||
s
===
vscode
.
TestRunState
.
Errored
;
interface
ITestSummary
{
passed
:
number
;
failed
:
number
;
duration
:
number
|
undefined
;
computedState
:
vscode
.
TestRunState
;
}
function
summarize
(
test
:
vscode
.
TestItem
)
{
let
passed
=
0
;
let
failed
=
0
;
let
duration
:
number
|
undefined
;
let
computedState
=
test
.
state
.
runState
;
const
queue
=
test
.
children
?
[
test
.
children
]
:
[];
while
(
queue
.
length
)
{
for
(
const
test
of
queue
.
pop
()
!
)
{
computedState
=
maxPriority
(
computedState
,
test
.
state
.
runState
);
if
(
test
.
state
.
runState
===
vscode
.
TestRunState
.
Passed
)
{
passed
++
;
if
(
test
.
state
.
duration
!==
undefined
)
{
duration
=
test
.
state
.
duration
+
(
duration
??
0
);
}
}
else
if
(
isFailedState
(
test
.
state
.
runState
))
{
failed
++
;
if
(
test
.
state
.
duration
!==
undefined
)
{
duration
=
test
.
state
.
duration
+
(
duration
??
0
);
}
}
if
(
test
.
children
)
{
queue
.
push
(
test
.
children
);
}
}
}
return
{
passed
,
failed
,
duration
,
computedState
};
}
function
*
iterateOverTests
(
tests
:
ReadonlyArray
<
vscode
.
TestItem
>
)
{
const
queue
=
[
tests
];
while
(
queue
.
length
)
{
for
(
const
test
of
queue
.
pop
()
!
)
{
yield
test
;
if
(
test
.
children
)
{
queue
.
push
(
test
.
children
);
}
}
}
}
const
testStateToIcon
:
{
[
K
in
vscode
.
TestRunState
]:
string
}
=
{
[
vscode
.
TestRunState
.
Errored
]:
'
testing-error-icon
'
,
[
vscode
.
TestRunState
.
Failed
]:
'
testing-failed-icon
'
,
[
vscode
.
TestRunState
.
Passed
]:
'
testing-passed-icon
'
,
[
vscode
.
TestRunState
.
Queued
]:
'
testing-queued-icon
'
,
[
vscode
.
TestRunState
.
Skipped
]:
'
testing-skipped-icon
'
,
[
vscode
.
TestRunState
.
Unset
]:
'
beaker
'
,
[
vscode
.
TestRunState
.
Running
]:
'
loading~spin
'
,
};
const
testToDiagnosticSeverity
=
(
severity
:
vscode
.
TestMessageSeverity
|
undefined
)
=>
{
switch
(
severity
)
{
case
vscode
.
TestMessageSeverity
.
Hint
:
return
vscode
.
DiagnosticSeverity
.
Hint
;
case
vscode
.
TestMessageSeverity
.
Information
:
return
vscode
.
DiagnosticSeverity
.
Information
;
case
vscode
.
TestMessageSeverity
.
Warning
:
return
vscode
.
DiagnosticSeverity
.
Warning
;
case
vscode
.
TestMessageSeverity
.
Error
:
default
:
return
vscode
.
DiagnosticSeverity
.
Error
;
}
};
extensions/testing-editor-contributions/src/typings/refs.d.ts
已删除
100644 → 0
浏览文件 @
59091157
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/vs/vscode.proposed.d.ts'/>
extensions/testing-editor-contributions/tsconfig.json
已删除
100644 → 0
浏览文件 @
59091157
{
"extends"
:
"../shared.tsconfig.json"
,
"compilerOptions"
:
{
"outDir"
:
"./out"
,
},
"include"
:
[
"src/**/*"
]
}
extensions/testing-editor-contributions/yarn.lock
已删除
100644 → 0
浏览文件 @
59091157
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
src/vs/vscode.proposed.d.ts
浏览文件 @
e2c91378
...
...
@@ -2090,11 +2090,13 @@ declare module 'vscode' {
readonly
onDidChangeTest
:
Event
<
T
>
;
/**
* Promise that should be resolved when all tests that are initially
* defined have been discovered. The provider should continue to watch for
* changes and fire `onDidChangeTest` until the hierarchy is disposed.
* An event that should be fired when all tests that are currently defined
* have been discovered. The provider should continue to watch for changes
* and fire `onDidChangeTest` until the hierarchy is disposed.
*
* @todo can this be covered by existing progress apis? Or return a promise
*/
readonly
discoveredInitialTests
?:
Thenable
<
unknown
>
;
readonly
onDidDiscoverInitialTests
:
Event
<
void
>
;
/**
* Dispose will be called when there are no longer observers interested
...
...
@@ -2124,7 +2126,7 @@ declare module 'vscode' {
* there is a previous undisposed watcher for the given workspace folder.
*/
// eslint-disable-next-line vscode-dts-provider-naming
createWorkspaceTestHierarchy
?(
workspace
:
WorkspaceFolder
):
TestHierarchy
<
T
>
|
undefined
;
createWorkspaceTestHierarchy
?(
workspace
:
WorkspaceFolder
):
TestHierarchy
<
T
>
;
/**
* Requests that tests be provided for the given document. This will
...
...
@@ -2132,7 +2134,7 @@ declare module 'vscode' {
* for instance by code lens UI.
*/
// eslint-disable-next-line vscode-dts-provider-naming
createDocumentTestHierarchy
?(
document
:
TextDocument
):
TestHierarchy
<
T
>
|
undefined
;
createDocumentTestHierarchy
?(
document
:
TextDocument
):
TestHierarchy
<
T
>
;
/**
* Starts a test run. This should cause {@link onDidChangeTest} to
...
...
src/vs/workbench/api/browser/mainThreadTesting.ts
浏览文件 @
e2c91378
...
...
@@ -4,30 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
getTestSubscriptionKey
,
RunTestsRequest
,
RunTestsResult
,
Test
DiffOpType
,
Test
sDiff
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
{
getTestSubscriptionKey
,
RunTestsRequest
,
RunTestsResult
,
TestsDiff
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
{
ITestService
}
from
'
vs/workbench/contrib/testing/common/testService
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostTestingResource
,
ExtHostTestingShape
,
IExtHostContext
,
MainContext
,
MainThreadTestingShape
}
from
'
../common/extHost.protocol
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
const
reviveDiff
=
(
diff
:
TestsDiff
)
=>
{
for
(
const
entry
of
diff
)
{
if
(
entry
[
0
]
===
TestDiffOpType
.
Add
||
entry
[
0
]
===
TestDiffOpType
.
Update
)
{
const
item
=
entry
[
1
];
if
(
item
.
item
.
location
)
{
item
.
item
.
location
.
uri
=
URI
.
revive
(
item
.
item
.
location
.
uri
);
}
for
(
const
message
of
item
.
item
.
state
.
messages
)
{
if
(
message
.
location
)
{
message
.
location
.
uri
=
URI
.
revive
(
message
.
location
.
uri
);
}
}
}
}
};
@
extHostNamedCustomer
(
MainContext
.
MainThreadTesting
)
export
class
MainThreadTesting
extends
Disposable
implements
MainThreadTestingShape
{
private
readonly
proxy
:
ExtHostTestingShape
;
...
...
@@ -93,7 +76,6 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
* @inheritdoc
*/
public
$publishDiff
(
resource
:
ExtHostTestingResource
,
uri
:
UriComponents
,
diff
:
TestsDiff
):
void
{
reviveDiff
(
diff
);
this
.
testService
.
publishDiff
(
resource
,
URI
.
revive
(
uri
),
diff
);
}
...
...
src/vs/workbench/api/common/extHostTesting.ts
浏览文件 @
e2c91378
...
...
@@ -19,7 +19,7 @@ import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import
{
TestItem
}
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
{
Disposable
,
RequiredTestItem
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
IExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
AbstractIncrementalTestCollection
,
EMPTY_TEST_RESULT
,
IncrementalChangeCollector
,
IncrementalTestCollectionItem
,
InternalTestItem
,
RunTestForProviderRequest
,
RunTestsResult
,
TestDiffOpType
,
Test
IdWithProvider
,
Test
sDiff
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
{
AbstractIncrementalTestCollection
,
EMPTY_TEST_RESULT
,
IncrementalChangeCollector
,
IncrementalTestCollectionItem
,
InternalTestItem
,
RunTestForProviderRequest
,
RunTestsResult
,
TestDiffOpType
,
TestsDiff
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
type
*
as
vscode
from
'
vscode
'
;
const
getTestSubscriptionKey
=
(
resource
:
ExtHostTestingResource
,
uri
:
URI
)
=>
`
${
resource
}
:
${
uri
.
toString
()}
`
;
...
...
@@ -148,7 +148,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
updateDelta
(
1
);
disposable
.
add
(
hierarchy
);
collection
.
addRoot
(
hierarchy
.
root
,
id
);
Promise
.
resolve
(
hierarchy
.
discoveredInitialTests
).
then
(()
=>
updateDelta
(
-
1
));
hierarchy
.
onDidDiscoverInitialTests
(()
=>
updateDelta
(
-
1
));
hierarchy
.
onDidChangeTest
(
e
=>
collection
.
onItemChange
(
e
,
id
));
}
catch
(
e
)
{
console
.
error
(
e
);
...
...
@@ -669,7 +669,7 @@ class ExtHostTestItem implements vscode.TestItem, RequiredTestItem {
}
public
toJSON
()
{
const
serialized
:
RequiredTestItem
&
TestIdWithProvider
=
{
const
serialized
:
RequiredTestItem
=
{
label
:
this
.
label
,
description
:
this
.
description
,
state
:
this
.
state
,
...
...
@@ -677,9 +677,6 @@ class ExtHostTestItem implements vscode.TestItem, RequiredTestItem {
runnable
:
this
.
runnable
,
debuggable
:
this
.
debuggable
,
children
:
this
.
children
.
map
(
c
=>
(
c
as
ExtHostTestItem
).
toJSON
()),
providerId
:
this
.
#
internal
.
providerId
,
testId
:
this
.
#
internal
.
id
,
};
return
serialized
;
...
...
@@ -700,7 +697,6 @@ abstract class AbstractTestObserverFactory {
const
resourceKey
=
resourceUri
.
toString
();
const
resource
=
this
.
resources
.
get
(
resourceKey
)
??
this
.
createObserverData
(
resourceUri
);
resource
.
pendingDeletion
?.
dispose
();
resource
.
observers
++
;
return
{
...
...
src/vs/workbench/contrib/testing/browser/testing.contribution.ts
浏览文件 @
e2c91378
...
...
@@ -5,11 +5,9 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
ViewContainerExtensions
,
IViewContainersRegistry
,
IViewsRegistry
,
ViewContainerLocation
}
from
'
vs/workbench/common/views
'
;
import
{
testingViewIcon
}
from
'
vs/workbench/contrib/testing/browser/icons
'
;
...
...
@@ -17,7 +15,6 @@ import { ITestingCollectionService, TestingCollectionService } from 'vs/workbenc
import
{
TestingExplorerView
}
from
'
vs/workbench/contrib/testing/browser/testingExplorerView
'
;
import
{
TestingViewPaneContainer
}
from
'
vs/workbench/contrib/testing/browser/testingViewPaneContainer
'
;
import
{
Testing
}
from
'
vs/workbench/contrib/testing/common/constants
'
;
import
{
TestIdWithProvider
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
{
TestingContextKeys
}
from
'
vs/workbench/contrib/testing/common/testingContextKeys
'
;
import
{
ITestService
}
from
'
vs/workbench/contrib/testing/common/testService
'
;
import
{
TestService
}
from
'
vs/workbench/contrib/testing/common/testServiceImpl
'
;
...
...
@@ -73,19 +70,3 @@ registerAction2(Action.TestingViewAsTreeAction);
registerAction2
(
Action
.
CancelTestRunAction
);
registerAction2
(
Action
.
RunSelectedAction
);
registerAction2
(
Action
.
DebugSelectedAction
);
CommandsRegistry
.
registerCommand
({
id
:
'
vscode.runTests
'
,
handler
:
async
(
accessor
:
ServicesAccessor
,
tests
:
TestIdWithProvider
[])
=>
{
const
testService
=
accessor
.
get
(
ITestService
);
testService
.
runTests
({
debug
:
false
,
tests
:
tests
.
filter
(
t
=>
t
.
providerId
&&
t
.
testId
)
});
}
});
CommandsRegistry
.
registerCommand
({
id
:
'
vscode.debugTests
'
,
handler
:
async
(
accessor
:
ServicesAccessor
,
tests
:
TestIdWithProvider
[])
=>
{
const
testService
=
accessor
.
get
(
ITestService
);
testService
.
runTests
({
debug
:
true
,
tests
:
tests
.
filter
(
t
=>
t
.
providerId
&&
t
.
testId
)
});
}
});
src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
浏览文件 @
e2c91378
...
...
@@ -213,7 +213,7 @@ export class TestingExplorerViewModel extends Disposable {
}
editorService
.
openEditor
({
resource
:
location
.
uri
,
resource
:
URI
.
revive
(
location
.
uri
)
,
options
:
{
selection
:
location
.
range
,
preserveFocus
:
true
}
});
}));
...
...
@@ -434,7 +434,7 @@ class TestsRenderer implements ITreeRenderer<ITestTreeElement, FuzzyScore, TestT
const
test
=
element
.
test
;
if
(
test
)
{
if
(
test
.
item
.
location
)
{
label
.
resource
=
test
.
item
.
location
.
uri
;
label
.
resource
=
URI
.
revive
(
test
.
item
.
location
.
uri
)
;
}
options
.
title
=
'
hover title
'
;
...
...
@@ -529,7 +529,15 @@ class HierarchalElement implements ITestTreeElement {
}
public
get
location
()
{
return
this
.
test
.
item
.
location
;
const
location
=
this
.
test
.
item
.
location
;
if
(
!
location
)
{
return
;
}
return
{
uri
:
URI
.
revive
(
location
.
uri
),
range
:
location
.
range
,
};
}
constructor
(
public
readonly
test
:
InternalTestItem
,
public
readonly
parentItem
:
HierarchalFolder
|
HierarchalElement
)
{
...
...
src/vs/workbench/contrib/testing/common/testServiceImpl.ts
浏览文件 @
e2c91378
...
...
@@ -121,10 +121,6 @@ export class TestService extends Disposable implements ITestService {
});
}).
filter
(
isDefined
);
if
(
requests
.
length
===
0
)
{
return
EMPTY_TEST_RESULT
;
}
this
.
runningTests
.
set
(
req
,
cancelSource
);
this
.
runStartedEmitter
.
fire
(
req
);
this
.
isRunning
.
set
(
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录