Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3f2b4def
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,发现更多精彩内容 >>
提交
3f2b4def
编写于
9月 01, 2017
作者:
J
Joao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix up smoketest dependencies
上级
819b1b93
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
62 deletion
+32
-62
test/smoke/package.json
test/smoke/package.json
+13
-12
test/smoke/src/main.ts
test/smoke/src/main.ts
+15
-46
test/smoke/src/spectron/application.ts
test/smoke/src/spectron/application.ts
+4
-4
未找到文件。
test/smoke/package.json
浏览文件 @
3f2b4def
...
...
@@ -3,24 +3,25 @@
"version"
:
"0.1.0"
,
"main"
:
"./src/main.js"
,
"scripts"
:
{
"compile"
:
"tsc"
,
"pretest"
:
"tsc"
,
"test"
:
"node out/main.js"
"postinstall"
:
"tsc"
,
"watch"
:
"tsc --watch"
},
"devDependencies"
:
{
"@types/mocha"
:
"^2.2.41"
,
"@types/node"
:
"^6.0.70"
,
"@types/webdriverio"
:
"^4.6.1"
,
"@types/commander"
:
"^2.9.2"
,
"@types/electron"
:
"~1.4.37"
,
"@types/rimraf"
:
"^0.0.28"
,
"@types/htmlparser2"
:
"^3.7.29"
,
"@types/mkdirp"
:
"^0.5.1"
,
"@types/mocha"
:
"^2.2.41"
,
"@types/node"
:
"^8.0.26"
,
"@types/rimraf"
:
"^0.0.28"
,
"@types/webdriverio"
:
"^4.6.1"
,
"commander"
:
"^2.9.0"
,
"htmlparser2"
:
"^3.9.2"
,
"mocha"
:
"^3.2.0"
,
"spectron"
:
"~3.6.4"
,
"typescript"
:
"^2.2.2"
,
"rimraf"
:
"^2.6.1"
,
"commander"
:
"^2.9.0"
,
"simple-git"
:
"^1.73.0"
,
"spectron"
:
"~3.6.4"
,
"strip-json-comments"
:
"^2.0.1"
,
"
htmlparser2"
:
"^3.9
.2"
"
typescript"
:
"^2.2
.2"
}
}
\ No newline at end of file
}
test/smoke/src/main.ts
浏览文件 @
3f2b4def
...
...
@@ -3,13 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const
fs
=
require
(
'
fs
'
);
const
https
=
require
(
'
https
'
);
const
program
=
require
(
'
commander
'
);
const
git
=
require
(
'
simple-git
'
)();
const
child_process
=
require
(
'
child_process
'
);
const
path
=
require
(
'
path
'
);
const
mkdirp
=
require
(
'
mkdirp
'
);
import
*
as
fs
from
'
fs
'
;
import
*
as
https
from
'
https
'
;
import
*
as
program
from
'
commander
'
;
import
*
as
simplegit
from
'
simple-git
'
;
import
*
as
cp
from
'
child_process
'
;
import
*
as
path
from
'
path
'
;
import
*
as
mkdirp
from
'
mkdirp
'
;
const
git
=
simplegit
();
const
testDataPath
=
path
.
join
(
process
.
cwd
(),
'
test_data
'
);
const
codeWorkspacePath
=
path
.
join
(
testDataPath
,
'
smoketest.code-workspace
'
);
...
...
@@ -33,12 +35,13 @@ program.on('--help', () => {
console
.
log
(
'
$ npm test -- -l path/to/latest/binary -s path/to/stable/binary
'
);
console
.
log
(
''
);
});
program
.
parse
(
process
.
argv
);
if
(
!
program
.
latest
)
{
fail
(
'
You must specify the binary to run the smoke test against
'
);
}
if
(
!
binaryExists
(
program
.
latest
)
||
(
program
.
stable
&&
!
binaryExists
(
program
.
stable
)))
{
if
(
!
fs
.
existsSync
(
program
.
latest
)
||
(
program
.
stable
&&
!
fs
.
existsSync
(
program
.
stable
)))
{
fail
(
'
The file path to electron binary does not exist or permissions do not allow to execute it. Please check the path provided.
'
);
}
if
(
parseInt
(
process
.
version
.
substr
(
1
))
<
6
)
{
...
...
@@ -81,7 +84,7 @@ async function main(): Promise<void> {
await
createWorkspaceFile
(
codeWorkspacePath
,
workspace
);
await
cleanOrClone
(
testRepoUrl
,
testRepoLocalDir
);
await
execute
(
'
npm install
'
,
testRepoLocalDir
);
cp
.
execSync
(
'
npm install
'
,
{
cwd
:
testRepoLocalDir
}
);
await
runTests
();
}
...
...
@@ -100,7 +103,7 @@ function toUri(path: string): string {
function
runTests
():
void
{
console
.
log
(
'
Running tests...
'
);
var
proc
=
c
hild_process
.
spawn
(
process
.
execPath
,
[
var
proc
=
c
p
.
spawn
(
process
.
execPath
,
[
'
out/mocha-runner.js
'
]);
proc
.
stdout
.
on
(
'
data
'
,
data
=>
{
...
...
@@ -122,7 +125,7 @@ function runTests(): void {
async
function
cleanOrClone
(
repo
:
string
,
dir
:
string
):
Promise
<
any
>
{
console
.
log
(
'
Cleaning or cloning test project repository...
'
);
if
(
!
f
olderExists
(
dir
))
{
if
(
!
f
s
.
existsSync
(
dir
))
{
await
gitClone
(
repo
,
dir
);
}
else
{
git
.
cwd
(
dir
);
...
...
@@ -146,22 +149,6 @@ async function gitResetAndClean(): Promise<any> {
console
.
log
(
'
Test project was successfully reset to initial state.
'
);
}
function
execute
(
cmd
:
string
,
dir
:
string
):
Promise
<
any
>
{
return
new
Promise
((
res
,
rej
)
=>
{
console
.
log
(
`Running
${
cmd
}
...`
);
child_process
.
exec
(
cmd
,
{
cwd
:
dir
,
stdio
:
[
0
,
1
,
2
]
},
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
rej
(
error
);
}
if
(
stderr
)
{
console
.
error
(
stderr
);
}
console
.
log
(
stdout
);
res
();
});
});
}
function
getKeybindings
(
url
:
string
,
location
:
string
):
Promise
<
any
>
{
console
.
log
(
`Fetching keybindings from
${
url
}
...`
);
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -171,7 +158,7 @@ function getKeybindings(url: string, location: string): Promise<any> {
}
var
buffer
:
Buffer
[]
=
[];
res
.
on
(
'
data
'
,
(
chunk
)
=>
buffer
.
push
(
chunk
));
res
.
on
(
'
data
'
,
(
chunk
:
Buffer
)
=>
buffer
.
push
(
chunk
));
res
.
on
(
'
end
'
,
()
=>
{
fs
.
writeFile
(
location
,
Buffer
.
concat
(
buffer
),
'
utf8
'
,
()
=>
{
console
.
log
(
'
Keybindings were successfully fetched.
'
);
...
...
@@ -201,22 +188,4 @@ function createWorkspaceFile(path: string, workspace: any): Promise<any> {
});
});
});
}
function
folderExists
(
folder
:
string
):
boolean
{
try
{
fs
.
accessSync
(
folder
,
'
rw
'
);
return
true
;
}
catch
(
e
)
{
return
false
;
}
}
function
binaryExists
(
filePath
:
string
):
boolean
{
try
{
fs
.
accessSync
(
filePath
,
'
x
'
);
return
true
;
}
catch
(
e
)
{
return
false
;
}
}
\ No newline at end of file
test/smoke/src/spectron/application.ts
浏览文件 @
3f2b4def
...
...
@@ -9,10 +9,10 @@ import { Screenshot } from '../helpers/screenshot';
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
export
const
LATEST_PATH
=
process
.
env
.
VSCODE_LATEST_PATH
;
export
const
STABLE_PATH
=
process
.
env
.
VSCODE_STABLE_PATH
;
export
const
WORKSPACE_PATH
=
process
.
env
.
SMOKETEST_REPO
;
export
const
CODE_WORKSPACE_PATH
=
process
.
env
.
VSCODE_WORKSPACE_PATH
;
export
const
LATEST_PATH
=
process
.
env
.
VSCODE_LATEST_PATH
||
''
;
export
const
STABLE_PATH
=
process
.
env
.
VSCODE_STABLE_PATH
||
''
;
export
const
WORKSPACE_PATH
=
process
.
env
.
SMOKETEST_REPO
||
''
;
export
const
CODE_WORKSPACE_PATH
=
process
.
env
.
VSCODE_WORKSPACE_PATH
||
''
;
export
const
USER_DIR
=
'
test_data/temp_user_dir
'
;
export
const
EXTENSIONS_DIR
=
'
test_data/temp_extensions_dir
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录