mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add a simple convenience test task runner for VSCode (#15417)
This commit is contained in:
parent
e5ba3041cd
commit
c8fd99fb33
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,7 +17,7 @@
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code related
|
||||
.vscode/
|
||||
.vscode/*
|
||||
|
||||
# Flutter repo-specific
|
||||
/bin/cache/
|
||||
@ -79,6 +79,8 @@ unlinked_spec.ds
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!.vscode/tasks.json
|
||||
!.vscode/test.sh
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
|
||||
24
.vscode/tasks.json
vendored
Normal file
24
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"command": "./.vscode/test.sh",
|
||||
"windows": {
|
||||
// TODO :S
|
||||
},
|
||||
"label": "test",
|
||||
"type": "shell",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "new"
|
||||
},
|
||||
"args": ["${relativeFile}"]
|
||||
}
|
||||
]
|
||||
}
|
||||
27
.vscode/test.sh
vendored
Executable file
27
.vscode/test.sh
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Invalid test target arguments.
|
||||
|
||||
Please invoke test from VSCode via the workbench.action.tasks.test command."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" != *.dart ]]; then
|
||||
echo "Only .dart files can be tested by task in this repo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Testing $1..."
|
||||
|
||||
if [[ "$1" == packages/flutter/test/* ]]; then
|
||||
cd packages/flutter
|
||||
../../bin/flutter test ../../$1
|
||||
elif [[ "$1" == packages/flutter_tools/test/* ]]; then
|
||||
bin/cache/dart-sdk/bin/dart $1
|
||||
else
|
||||
echo "No test task configured for $1.
|
||||
|
||||
Please edit .vscode/test.sh to configure new test types."
|
||||
exit 1
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user