Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
91ab8307
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,发现更多精彩内容 >>
提交
91ab8307
编写于
6月 26, 2017
作者:
M
Michel Kaporin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactored main.js to TS
上级
915a0056
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
86 addition
and
68 deletion
+86
-68
build/tfs/darwin/smoketest.sh
build/tfs/darwin/smoketest.sh
+1
-2
build/tfs/linux/smoketest.sh
build/tfs/linux/smoketest.sh
+1
-2
build/tfs/win32/smoketest.ps1
build/tfs/win32/smoketest.ps1
+13
-13
test/smoke/package.json
test/smoke/package.json
+2
-2
test/smoke/src/main.ts
test/smoke/src/main.ts
+68
-46
test/smoke/src/mocha-runner.ts
test/smoke/src/mocha-runner.ts
+1
-3
未找到文件。
build/tfs/darwin/smoketest.sh
浏览文件 @
91ab8307
...
...
@@ -23,6 +23,5 @@ step "Build minified & upload source maps" \
step
"Run smoke test"
\
pushd test
/smoke
npm
install
npm run compile
node src/main.js
--latest
"
$AGENT_BUILDDIRECTORY
/VSCode-darwin/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"
npm
test
--
--latest
"
$AGENT_BUILDDIRECTORY
/VSCode-darwin/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"
popd
\ No newline at end of file
build/tfs/linux/smoketest.sh
浏览文件 @
91ab8307
...
...
@@ -35,8 +35,7 @@ function configureEnvironment {
function
runTest
{
pushd test
/smoke
npm
install
npm run compile
sudo
-u
testuser
-H
xvfb-run
-a
-s
"-screen 0 1024x768x8"
node src/main.js
--latest
"
$AGENT_BUILDDIRECTORY
/VSCode-linux-ia32/code-insiders"
sudo
-u
testuser
-H
xvfb-run
-a
-s
"-screen 0 1024x768x8"
npm
test
--
--latest
"
$AGENT_BUILDDIRECTORY
/VSCode-linux-ia32/code-insiders"
popd
}
...
...
build/tfs/win32/smoketest.ps1
浏览文件 @
91ab8307
Param
(
[
string
]
$arch
,
[
string
]
$mixinPassword
,
[
string
]
$vsoPAT
[
string
]
$arch
,
[
string
]
$mixinPassword
,
[
string
]
$vsoPAT
)
.
.
\scripts\env.ps1
...
...
@@ -9,38 +9,38 @@ Param(
# Create a _netrc file to download distro dependencies
# In order to get _netrc to work, we need a HOME variable setup
$
env
:
HOME
=
$
env
:
USERPROFILE
$
env
:
HOME
=
$
env
:
USERPROFILE
"machine monacotools.visualstudio.com password
${vsoPAT}
"
|
Out-File
"
$
env
:
USERPROFILE
\_netrc"
-Encoding
ASCII
# Set the right architecture
$
env
:
npm_config_arch
=
"
$arch
"
$
env
:
npm_config_arch
=
"
$arch
"
step
"Install dependencies"
{
exec
{
&
npm
install
}
exec
{
&
npm
install
}
}
$
env
:
VSCODE_MIXIN_PASSWORD
=
$mixinPassword
step
"Mix in repository from vscode-distro"
{
exec
{
&
npm
run
gulp
--
mixin
}
exec
{
&
npm
run
gulp
--
mixin
}
}
step
"Get Electron"
{
exec
{
&
npm
run
gulp
--
"electron-
$
global
:
arch
"
}
exec
{
&
npm
run
gulp
--
"electron-
$
global
:
arch
"
}
}
step
"Install distro dependencies"
{
exec
{
&
node
build\tfs\common\installDistro.js
}
exec
{
&
node
build\tfs\common\installDistro.js
}
}
step
"Build minified"
{
exec
{
&
npm
run
gulp
--
--max_old_space_size
=
4096
"vscode-win32-
$
global
:
arch
-min"
}
exec
{
&
npm
run
gulp
--
--max_old_space_size
=
4096
"vscode-win32-
$
global
:
arch
-min"
}
}
step
"Run smoke test"
{
exec
{
&
Push-Location
test\smoke
}
exec
{
&
npm
install
;
npm
run
compile
}
exec
{
&
n
ode
src/main.js
--latest
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
\Code - Insiders.exe"
}
exec
{
&
Pop-Location
}
exec
{
&
npm
install
}
exec
{
&
n
pm
test
--
--latest
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
\Code - Insiders.exe"
}
exec
{
&
Pop-Location
}
}
done
\ No newline at end of file
test/smoke/package.json
浏览文件 @
91ab8307
...
...
@@ -5,7 +5,7 @@
"scripts"
:
{
"compile"
:
"tsc"
,
"pretest"
:
"tsc"
,
"test"
:
"node
src
/main.js"
"test"
:
"node
out
/main.js"
},
"devDependencies"
:
{
"@types/mocha"
:
"^2.2.41"
,
...
...
@@ -23,4 +23,4 @@
"strip-json-comments"
:
"^2.0.1"
,
"htmlparser2"
:
"^3.9.2"
}
}
}
\ No newline at end of file
test/smoke/src/main.
j
s
→
test/smoke/src/main.
t
s
浏览文件 @
91ab8307
...
...
@@ -3,17 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var
fs
=
require
(
'
fs
'
);
var
https
=
require
(
'
https
'
);
var
program
=
require
(
'
commander
'
);
var
git
=
require
(
'
simple-git
'
)();
var
child_process
=
require
(
'
child_process
'
);
var
path
=
require
(
'
path
'
);
var
tempFolder
=
'
test_data
'
;
var
testRepoUrl
=
'
https://github.com/Microsoft/vscode-smoketest-express
'
;
var
testRepoLocalDir
=
path
.
join
(
process
.
cwd
(),
`
${
tempFolder
}
/vscode-smoketest-express`
);
var
keybindingsUrl
=
'
https://raw.githubusercontent.com/Microsoft/vscode-docs/master/scripts/keybindings
'
;
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
tempFolder
=
'
test_data
'
;
const
testRepoUrl
=
'
https://github.com/Microsoft/vscode-smoketest-express
'
;
const
testRepoLocalDir
=
path
.
join
(
process
.
cwd
(),
`
${
tempFolder
}
/vscode-smoketest-express`
);
const
keybindingsUrl
=
'
https://raw.githubusercontent.com/Microsoft/vscode-docs/master/scripts/keybindings
'
;
program
.
option
(
'
-l, --latest <file path>
'
,
'
path to the latest VS Code to test
'
)
...
...
@@ -43,32 +43,42 @@ if (parseInt(process.version.substr(1)) < 6) {
// Setting up environment variables
process
.
env
.
VSCODE_LATEST_PATH
=
program
.
latest
;
if
(
program
.
stable
)
process
.
env
.
VSCODE_STABLE_PATH
=
program
.
stable
;
if
(
program
.
stable
)
{
process
.
env
.
VSCODE_STABLE_PATH
=
program
.
stable
;
}
process
.
env
.
SMOKETEST_REPO
=
testRepoLocalDir
;
if
(
program
.
stable
&&
program
.
stable
.
toLowerCase
().
startsWith
(
'
insiders
'
))
process
.
env
.
VSCODE_EDITION
=
'
insiders
'
;
if
(
program
.
stable
&&
program
.
stable
.
toLowerCase
().
startsWith
(
'
insiders
'
))
{
process
.
env
.
VSCODE_EDITION
=
'
insiders
'
;
}
// Setting up 'vscode-smoketest-express' project
var
os
=
process
.
platform
;
if
(
os
===
'
darwin
'
)
os
=
'
osx
'
;
else
if
(
os
===
'
win32
'
)
os
=
'
win
'
;
var
promises
=
[];
try
{
promises
.
push
(
getKeybindings
(
`
${
keybindingsUrl
}
/doc.keybindings.
${
os
}
.json`
,
`
${
tempFolder
}
/keybindings.json`
));
promises
.
push
(
cleanOrClone
(
testRepoUrl
,
testRepoLocalDir
));
Promise
.
all
(
promises
).
then
(()
=>
{
execute
(
'
npm install
'
,
testRepoLocalDir
).
then
(()
=>
runTests
());
});
}
catch
(
e
)
{
throw
new
Error
(
'
Error caught running the smoke test:
'
+
e
);
let
os
=
process
.
platform
.
toString
();
if
(
os
===
'
darwin
'
)
{
os
=
'
osx
'
;
}
else
if
(
os
===
'
win32
'
)
{
os
=
'
win
'
;
}
function
fail
(
errorMessage
)
{
var
promises
:
Promise
<
any
>
[]
=
[];
promises
.
push
(
getKeybindings
(
`
${
keybindingsUrl
}
/doc.keybindings.
${
os
}
.json`
,
`
${
tempFolder
}
/keybindings.json`
));
promises
.
push
(
cleanOrClone
(
testRepoUrl
,
testRepoLocalDir
));
Promise
.
all
(
promises
)
.
then
(()
=>
execute
(
'
npm install
'
,
testRepoLocalDir
))
.
then
(()
=>
runTests
())
.
catch
(
reason
=>
{
throw
new
Error
(
'
Error caught running the smoke test:
'
+
reason
);
});
function
fail
(
errorMessage
):
void
{
console
.
error
(
errorMessage
);
process
.
exit
(
1
);
}
function
runTests
()
{
console
.
log
(
'
Running tests...
'
)
function
runTests
()
:
void
{
console
.
log
(
'
Running tests...
'
)
;
const
spawn
=
require
(
'
child_process
'
).
spawn
;
var
proc
=
spawn
(
process
.
execPath
,
[
'
out/mocha-runner.js
'
...
...
@@ -79,7 +89,9 @@ function runTests() {
proc
.
stderr
.
on
(
'
data
'
,
data
=>
{
var
date
=
new
Date
().
toLocaleString
();
fs
.
appendFile
(
`
${
tempFolder
}
/errors.log`
,
`
${
date
}
:
${
data
.
toString
()}
`
,
(
err
)
=>
{
if
(
err
)
throw
new
Error
(
`Could not write stderr to errors.log with the following error:
${
err
}
`
);
if
(
err
)
{
throw
new
Error
(
`Could not write stderr to errors.log with the following error:
${
err
}
`
);
};
});
});
proc
.
on
(
'
exit
'
,
(
code
)
=>
{
...
...
@@ -87,7 +99,7 @@ function runTests() {
});
}
function
cleanOrClone
(
repo
,
dir
)
{
function
cleanOrClone
(
repo
:
string
,
dir
:
string
):
Promise
<
any
>
{
console
.
log
(
'
Cleaning or cloning test project repository...
'
);
return
new
Promise
((
res
,
rej
)
=>
{
if
(
!
folderExists
(
dir
))
{
...
...
@@ -97,47 +109,57 @@ function cleanOrClone(repo, dir) {
});
}
else
{
git
.
cwd
(
dir
);
git
.
fetch
((
err
)
=>
{
if
(
err
)
rej
(
err
);
git
.
fetch
(
err
=>
{
if
(
err
)
{
rej
(
err
);
}
resetAndClean
();
});
}
var
resetAndClean
=
()
=>
{
git
.
reset
([
'
FETCH_HEAD
'
,
'
--hard
'
],
(
err
)
=>
{
if
(
err
)
rej
(
err
);
git
.
clean
(
'
f
'
,
[
'
-d
'
],
(
err
)
=>
{
if
(
err
)
rej
(
err
);
git
.
reset
([
'
FETCH_HEAD
'
,
'
--hard
'
],
err
=>
{
if
(
err
)
{
rej
(
err
);
}
git
.
clean
(
'
f
'
,
[
'
-d
'
],
err
=>
{
if
(
err
)
{
rej
(
err
);
}
console
.
log
(
'
Test project was successfully reset to initial state.
'
);
res
();
});
});
}
}
;
});
}
function
execute
(
cmd
,
dir
)
{
function
execute
(
cmd
,
dir
)
:
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
);
if
(
error
)
{
rej
(
error
);
}
if
(
stderr
)
{
console
.
error
(
stderr
);
}
console
.
log
(
stdout
);
res
();
});
});
}
function
getKeybindings
(
url
,
location
)
{
function
getKeybindings
(
url
:
string
,
location
:
string
):
Promise
<
any
>
{
console
.
log
(
`Fetching keybindings from
${
url
}
...`
);
return
new
Promise
((
resolve
,
reject
)
=>
{
https
.
get
(
url
,
(
res
)
=>
{
if
(
res
.
statusCode
!=
200
)
{
if
(
res
.
statusCode
!=
=
200
)
{
reject
(
`Failed to obtain key bindings with response code:
${
res
.
statusCode
}
`
);
}
var
buffer
=
[];
var
buffer
:
Buffer
[]
=
[];
res
.
on
(
'
data
'
,
(
chunk
)
=>
buffer
.
push
(
chunk
));
res
.
on
(
'
end
'
,
()
=>
{
fs
.
writeFile
(
location
,
Buffer
.
concat
(
buffer
),
'
utf8
'
,
()
=>
{
...
...
@@ -151,7 +173,7 @@ function getKeybindings(url, location) {
});
}
function
folderExists
(
folder
)
{
function
folderExists
(
folder
:
string
):
boolean
{
try
{
fs
.
accessSync
(
folder
,
'
rw
'
);
return
true
;
...
...
@@ -160,7 +182,7 @@ function folderExists(folder) {
}
}
function
binaryExists
(
filePath
)
{
function
binaryExists
(
filePath
:
string
):
boolean
{
try
{
fs
.
accessSync
(
filePath
,
'
x
'
);
return
true
;
...
...
test/smoke/src/mocha-runner.ts
浏览文件 @
91ab8307
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
const
MochaTest
=
require
(
'
mocha
'
);
const
path
=
require
(
'
path
'
);
const
mochaTest
=
new
MochaTest
({
timeout
:
360000
,
...
...
@@ -12,8 +11,7 @@ const mochaTest = new MochaTest({
slow
:
50000
,
useColors
:
true
});
mochaTest
.
addFile
(
path
.
join
(
process
.
cwd
(),
'
out/test.js
'
));
mochaTest
.
addFile
(
require
(
'
path
'
).
join
(
process
.
cwd
(),
'
out/test.js
'
));
mochaTest
.
run
((
failures
)
=>
{
process
.
exit
(
failures
);
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录