Преглед изворни кода

fix(devcontainer): make it possible to run mocha tests in VSCode using different extension

Indeed https://github.com/maty21/mocha-sidebar/issues/181#issuecomment-1016768595 seems to work and pointed me to a better extension.
This works better than maty.vscode-mocha-sidebar which could not find nyc.
rugk пре 5 месеци
родитељ
комит
809a79bd3e
4 измењених фајлова са 23 додато и 20 уклоњено
  1. 12 16
      .devcontainer/devcontainer.json
  2. 6 2
      .devcontainer/postCreateCommand.sh
  3. 2 1
      .vscode/extensions.json
  4. 3 1
      .vscode/settings.json

+ 12 - 16
.devcontainer/devcontainer.json

@@ -4,22 +4,18 @@
     "customizations": {
         "vscode": {
             "extensions": [
-				"github.codespaces",
-                // PHP from https://github.com/devcontainers/templates/tree/main/src/php
-				"xdebug.php-debug",
-				"bmewburn.vscode-intelephense-client",
-				"xdebug.php-pack",
-                // PHP
-				"DEVSENSE.phptools-vscode",
-				"DEVSENSE.composer-php-vscode",
-                // linting
-				"EditorConfig.EditorConfig",
-				"dbaeumer.vscode-eslint",
-				"raymondcamden.CSSLint",
-                // testing
-				"maty.vscode-mocha-sidebar",
-                "recca0120.vscode-phpunit"
-			]
+                "github.codespaces",
+                "xdebug.php-debug",
+                "bmewburn.vscode-intelephense-client",
+                "xdebug.php-pack",
+                "DEVSENSE.phptools-vscode",
+                "DEVSENSE.composer-php-vscode",
+                "EditorConfig.EditorConfig",
+                "dbaeumer.vscode-eslint",
+                "raymondcamden.CSSLint",
+                "recca0120.vscode-phpunit",
+                "hbenl.vscode-mocha-test-adapter"
+            ]
         },
         "codespaces": {
             "openFiles": [

+ 6 - 2
.devcontainer/postCreateCommand.sh

@@ -15,6 +15,10 @@ composer install --no-dev --optimize-autoloader
 composer global require phpunit/phpunit
 composer global require google/cloud-storage
 
-sudo chmod a+x "$(pwd)" && sudo rm -rf /var/www/html && sudo ln -s "$(pwd)" /var/www/html
-
+# for JS testing
+JAVASCRIPT_DIRECTORY="$(pwd)/js"
+npm --prefix "$JAVASCRIPT_DIRECTORY" install "$JAVASCRIPT_DIRECTORY"
 npm install --global nyc
+
+# development webserver
+sudo chmod a+x "$(pwd)" && sudo rm -rf /var/www/html && sudo ln -s "$(pwd)" /var/www/html

+ 2 - 1
.vscode/extensions.json

@@ -2,6 +2,7 @@
     "recommendations": [
         "recca0120.vscode-phpunit",
         "onecentlin.phpunit-snippets",
-        "devsense.profiler-php-vscode"
+        "devsense.profiler-php-vscode",
+        "spoonscen.es6-mocha-snippets"
     ]
 }

+ 3 - 1
.vscode/settings.json

@@ -8,5 +8,7 @@
         "${workspaceFolder}/tst/phpunit.xml",
         "--bootstrap",
         "${workspaceFolder}/tst/Bootstrap.php"
-    ]
+    ],
+    "mochaExplorer.pkgFile": "js/package.json",
+    "mochaExplorer.files": "js/test/*.js",
 }