From 809a79bd3e89d4b2a9160735c0b8fe20856b104b Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 23 Feb 2026 14:44:21 +0000 Subject: [PATCH] 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. --- .devcontainer/devcontainer.json | 28 ++++++++++++---------------- .devcontainer/postCreateCommand.sh | 8 ++++++-- .vscode/extensions.json | 3 ++- .vscode/settings.json | 4 +++- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 839ccdaf..bd13accd 100644 --- a/.devcontainer/devcontainer.json +++ b/.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": [ diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 269ecca3..ed9f7956 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.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 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index eea5315d..730e78eb 100644 --- a/.vscode/extensions.json +++ b/.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" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 08271210..f18b8d8b 100644 --- a/.vscode/settings.json +++ b/.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", }