Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3f6dd33f
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3f6dd33f
编写于
4月 04, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
woo: smoke infrastructure up and running
上级
b1f17c53
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
171 addition
and
8 deletion
+171
-8
src/vs/platform/environment/node/argv.ts
src/vs/platform/environment/node/argv.ts
+2
-1
test/smoke2/package.json
test/smoke2/package.json
+2
-0
test/smoke2/src/code.ts
test/smoke2/src/code.ts
+131
-0
test/smoke2/src/main.ts
test/smoke2/src/main.ts
+19
-6
test/smoke2/tsconfig.json
test/smoke2/tsconfig.json
+3
-1
test/smoke2/yarn.lock
test/smoke2/yarn.lock
+14
-0
未找到文件。
src/vs/platform/environment/node/argv.ts
浏览文件 @
3f6dd33f
...
...
@@ -29,7 +29,8 @@ const options: minimist.Opts = {
'
enable-proposed-api
'
,
'
export-default-configuration
'
,
'
install-source
'
,
'
upload-logs
'
'
upload-logs
'
,
'
driver
'
],
boolean
:
[
'
help
'
,
...
...
test/smoke2/package.json
浏览文件 @
3f6dd33f
...
...
@@ -11,6 +11,8 @@
"author"
:
""
,
"license"
:
"ISC"
,
"devDependencies"
:
{
"@types/tmp"
:
"^0.0.33"
,
"tmp"
:
"^0.0.33"
,
"typescript"
:
"^2.8.1"
}
}
test/smoke2/src/code.ts
0 → 100644
浏览文件 @
3f6dd33f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
cp
from
'
child_process
'
;
import
{
tmpName
}
from
'
tmp
'
;
import
{
IDriver
,
connect
as
connectDriver
,
IDisposable
}
from
'
./driver
'
;
const
repoPath
=
path
.
join
(
__dirname
,
'
../../..
'
);
function
getDevElectronPath
():
string
{
const
buildPath
=
path
.
join
(
repoPath
,
'
.build
'
);
const
product
=
require
(
path
.
join
(
repoPath
,
'
product.json
'
));
switch
(
process
.
platform
)
{
case
'
darwin
'
:
return
path
.
join
(
buildPath
,
'
electron
'
,
`
${
product
.
nameLong
}
.app`
,
'
Contents
'
,
'
MacOS
'
,
'
Electron
'
);
case
'
linux
'
:
return
path
.
join
(
buildPath
,
'
electron
'
,
`
${
product
.
applicationName
}
`
);
case
'
win32
'
:
return
path
.
join
(
buildPath
,
'
electron
'
,
`
${
product
.
nameShort
}
.exe`
);
default
:
throw
new
Error
(
'
Unsupported platform.
'
);
}
}
function
getBuildElectronPath
(
root
:
string
):
string
{
switch
(
process
.
platform
)
{
case
'
darwin
'
:
return
path
.
join
(
root
,
'
Contents
'
,
'
MacOS
'
,
'
Electron
'
);
case
'
linux
'
:
{
const
product
=
require
(
path
.
join
(
root
,
'
resources
'
,
'
app
'
,
'
product.json
'
));
return
path
.
join
(
root
,
product
.
applicationName
);
}
case
'
win32
'
:
{
const
product
=
require
(
path
.
join
(
root
,
'
resources
'
,
'
app
'
,
'
product.json
'
));
return
path
.
join
(
root
,
`
${
product
.
nameShort
}
.exe`
);
}
default
:
throw
new
Error
(
'
Unsupported platform.
'
);
}
}
function
getDevOutPath
():
string
{
return
path
.
join
(
repoPath
,
'
out
'
);
}
function
getBuildOutPath
(
root
:
string
):
string
{
switch
(
process
.
platform
)
{
case
'
darwin
'
:
return
path
.
join
(
root
,
'
Contents
'
,
'
Resources
'
,
'
app
'
,
'
out
'
);
default
:
return
path
.
join
(
root
,
'
resources
'
,
'
app
'
,
'
out
'
);
}
}
export
class
Code
{
constructor
(
private
process
:
cp
.
ChildProcess
,
private
client
:
IDisposable
,
readonly
driver
:
IDriver
)
{
}
dispose
():
void
{
this
.
client
.
dispose
();
this
.
process
.
kill
();
}
}
export
interface
SpawnOptions
{
codePath
?:
string
;
userDataDir
:
string
;
extensionsPath
:
string
;
}
export
async
function
connect
(
child
:
cp
.
ChildProcess
,
outPath
:
string
,
handlePath
:
string
):
Promise
<
Code
>
{
let
errCount
=
0
;
while
(
true
)
{
try
{
const
{
client
,
driver
}
=
await
connectDriver
(
outPath
,
handlePath
);
return
new
Code
(
child
,
client
,
driver
);
}
catch
(
err
)
{
if
(
++
errCount
>
50
)
{
child
.
kill
();
throw
err
;
}
// retry
await
new
Promise
(
c
=>
setTimeout
(
c
,
100
));
}
}
}
export
function
spawn
(
options
:
SpawnOptions
):
Promise
<
Code
>
{
const
codePath
=
options
.
codePath
;
const
electronPath
=
codePath
?
getBuildElectronPath
(
codePath
)
:
getDevElectronPath
();
const
outPath
=
codePath
?
getBuildOutPath
(
codePath
)
:
getDevOutPath
();
return
new
Promise
((
c
,
e
)
=>
{
tmpName
((
err
,
handlePath
)
=>
{
if
(
err
)
{
return
e
(
err
);
}
const
args
=
[
'
--skip-getting-started
'
,
'
--skip-release-notes
'
,
'
--sticky-quickopen
'
,
'
--disable-telemetry
'
,
'
--disable-updates
'
,
'
--disable-crash-reporter
'
,
`--extensions-dir=
${
options
.
extensionsPath
}
`
,
`--user-data-dir=
${
options
.
userDataDir
}
`
,
'
--driver
'
,
handlePath
];
if
(
!
codePath
)
{
args
.
unshift
(
repoPath
);
}
const
child
=
cp
.
spawn
(
electronPath
,
args
);
connect
(
child
,
outPath
,
handlePath
).
then
(
c
,
e
);
});
});
}
\ No newline at end of file
test/smoke2/src/main.ts
浏览文件 @
3f6dd33f
...
...
@@ -5,14 +5,27 @@
import
*
as
path
from
'
path
'
;
import
{
connect
}
from
'
./driver
'
;
import
{
spawn
}
from
'
./code
'
;
const
rootPath
=
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
__dirname
)));
const
outPath
=
path
.
join
(
rootPath
,
'
out
'
);
const
handlePath
=
path
.
join
(
rootPath
,
'
foo.sock
'
);
//
const rootPath = path.dirname(path.dirname(path.dirname(__dirname)));
//
const outPath = path.join(rootPath, 'out');
//
const handlePath = path.join(rootPath, 'foo.sock');
connect
(
outPath
,
handlePath
).
then
(({
client
,
driver
})
=>
{
return
driver
.
getWindows
().
then
(
w
=>
{
// connect(outPath, handlePath).then(({ client, driver }) => {
// return driver.getWindows().then(w => {
// console.log(w);
// client.dispose();
// });
// }, err => console.error('oh no', err));
const
opts
=
{
extensionsPath
:
'
/Users/joao/Desktop/extensions
'
,
userDataDir
:
'
/Users/joao/Desktop/user-data-dir
'
,
};
spawn
(
opts
).
then
(
code
=>
{
return
code
.
driver
.
getWindows
().
then
(
w
=>
{
console
.
log
(
w
);
c
lient
.
dispose
();
c
ode
.
dispose
();
});
},
err
=>
console
.
error
(
'
oh no
'
,
err
));
\ No newline at end of file
test/smoke2/tsconfig.json
浏览文件 @
3f6dd33f
{
"compilerOptions"
:
{
"module"
:
"commonjs"
,
"outDir"
:
"out"
"outDir"
:
"out"
,
"target"
:
"es6"
,
"strictNullChecks"
:
true
},
"exclude"
:
[
"node_modules"
...
...
test/smoke2/yarn.lock
浏览文件 @
3f6dd33f
...
...
@@ -2,6 +2,20 @@
# yarn lockfile v1
"@types/tmp@^0.0.33":
version "0.0.33"
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.0.33.tgz#1073c4bc824754ae3d10cfab88ab0237ba964e4d"
os-tmpdir@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
dependencies:
os-tmpdir "~1.0.2"
typescript@^2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录