File tree Expand file tree Collapse file tree 11 files changed +103
-7
lines changed
extensions/test-extension Expand file tree Collapse file tree 11 files changed +103
-7
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,30 @@ set -euo pipefail
33
44main () {
55 cd " $( dirname " $0 " ) /../.."
6+ source ./ci/lib.sh
67
7- echo " Installing code-server test dependencies..."
8+ pushd test
9+ echo " Installing dependencies for $PWD "
10+ yarn install
11+ popd
812
913 local args=(install)
1014 if [[ ${CI-} ]]; then
1115 args+=(--frozen-lockfile)
1216 fi
1317
14- cd test
18+ pushd test
19+ echo " Installing dependencies for $PWD "
1520 yarn " ${args[@]} "
16- cd ..
21+ popd
1722
18- cd vendor
19- echo " Installing vendor dependencies..."
23+ pushd test/e2e/extensions/test-extension
24+ echo " Installing dependencies for $PWD "
25+ yarn " ${args[@]} "
26+ popd
27+
28+ pushd vendor
29+ echo " Installing dependencies for $PWD "
2030
2131 # We install in 'modules' instead of 'node_modules' because VS Code's
2232 # extensions use a webpack config which cannot differentiate between its own
@@ -33,6 +43,8 @@ main() {
3343
3444 # Finally, run the vendor `postinstall`
3545 yarn run postinstall
46+
47+ popd
3648}
3749
3850main " $@ "
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ main() {
1313
1414 source ./ci/lib.sh
1515
16+ pushd test/e2e/extensions/test-extension
17+ echo " Building test extension"
18+ yarn build
19+ popd
20+
1621 local dir=" $PWD "
1722 if [[ ! ${CODE_SERVER_TEST_ENTRY-} ]]; then
1823 echo " Set CODE_SERVER_TEST_ENTRY to test another build of code-server"
Original file line number Diff line number Diff line change 66
77 source ./ci/lib.sh
88
9+ echo " Building test plugin"
910 pushd test/unit/node/test-plugin
1011 make -s out/index.js
1112 popd
Original file line number Diff line number Diff line change 1+ import { describe , test } from "./baseFixture"
2+
3+ describe ( "Extensions" , true , ( ) => {
4+ // This will only work if the test extension is loaded into code-server.
5+ test ( "should have access to VSCODE_PROXY_URI" , async ( { codeServerPage } ) => {
6+ const address = await codeServerPage . address ( )
7+
8+ await codeServerPage . executeCommandViaMenus ( "code-server: Get proxy URI" )
9+
10+ await codeServerPage . page . waitForSelector ( `text=${ address } /proxy/{{port}}` )
11+ } )
12+ } )
Original file line number Diff line number Diff line change 1+ /extension.js
Original file line number Diff line number Diff line change 1+ import * as vscode from "vscode"
2+
3+ export function activate ( context : vscode . ExtensionContext ) {
4+ context . subscriptions . push (
5+ vscode . commands . registerCommand ( "codeServerTest.proxyUri" , ( ) => {
6+ if ( process . env . VSCODE_PROXY_URI ) {
7+ vscode . window . showInformationMessage ( process . env . VSCODE_PROXY_URI )
8+ } else {
9+ vscode . window . showErrorMessage ( "No proxy URI was set" )
10+ }
11+ } ) ,
12+ )
13+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " code-server-extension" ,
3+ "description" : " code-server test extension" ,
4+ "version" : " 0.0.1" ,
5+ "publisher" : " cdr" ,
6+ "activationEvents" : [
7+ " onCommand:codeServerTest.proxyUri"
8+ ],
9+ "engines" : {
10+ "vscode" : " ^1.56.0"
11+ },
12+ "main" : " ./extension.js" ,
13+ "contributes" : {
14+ "commands" : [
15+ {
16+ "command" : " codeServerTest.proxyUri" ,
17+ "title" : " Get proxy URI" ,
18+ "category" : " code-server"
19+ }
20+ ]
21+ },
22+ "devDependencies" : {
23+ "@types/vscode" : " ^1.56.0" ,
24+ "typescript" : " ^4.0.5"
25+ },
26+ "scripts" : {
27+ "build" : " tsc extension.ts"
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "target" : " es2020" ,
4+ "module" : " commonjs" ,
5+ "outDir" : " ." ,
6+ "strict" : true ,
7+ "baseUrl" : " ./"
8+ },
9+ "include" : [" ./extension.ts" ]
10+ }
Original file line number Diff line number Diff line change 1+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+ # yarn lockfile v1
3+
4+
5+ " @types/vscode@^1.56.0 " :
6+ version "1.57.0"
7+ resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.57.0.tgz#cc648e0573b92f725cd1baf2621f8da9f8bc689f"
8+ integrity sha512-FeznBFtIDCWRluojTsi9c3LLcCHOXP5etQfBK42+ixo1CoEAchkw39tuui9zomjZuKfUVL33KZUDIwHZ/xvOkQ==
9+
10+ typescript@^4.0.5 :
11+ version "4.3.2"
12+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
13+ integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ export class CodeServer {
8888 path . join ( dir , "config.yaml" ) ,
8989 "--user-data-dir" ,
9090 dir ,
91+ "--extensions-dir" ,
92+ path . join ( __dirname , "../extensions" ) ,
9193 // The last argument is the workspace to open.
9294 dir ,
9395 ] ,
You can’t perform that action at this time.
0 commit comments