Skip to content

Commit 9bfda48

Browse files
authored
Update package and build scripts (#16881)
* Remove old test scripts * Faster * Fixes * Updates * Updates * Updates * Updates * Fix formattingÏ * More updates * Remove unwanted logs * Avoid unnecessary logging * Remove more logs * Ignore the custom reporter if not required * Updates
1 parent 35bc7e2 commit 9bfda48

File tree

18 files changed

+121
-362
lines changed

18 files changed

+121
-362
lines changed

.github/actions/create-venv-for-tests/action.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ outputs:
1515
runs:
1616
using: 'composite'
1717
steps:
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
1821
# Used by tests for installation of ipykernel.
1922
# Create a venv & register it as a kernel.
2023
# These tests are slow hence will only run on linux.
@@ -24,27 +27,26 @@ runs:
2427
- name: Create virtual environment without ipykernel
2528
if: inputs.IPyWidgetVersion == '7'
2629
run: |
27-
python -m venv .venvnoreg
28-
29-
python -m venv .venvkernel
30+
uv venv .venvnoreg
31+
uv venv .venvkernel
32+
source .venvnoreg/bin/activate
33+
uv pip install pip
3034
source .venvkernel/bin/activate
3135
python --version
3236
python -c "import sys;print(sys.executable)"
33-
python -m pip install ipykernel
37+
uv pip install pip
38+
uv pip install ipykernel
3439
python -m ipykernel install --user --name .venvkernel --display-name .venvkernel
35-
python -m pip uninstall jedi --yes
36-
python -m pip install jedi==0.17.2
37-
python -m pip install pandas
38-
python -m pip install ipywidgets==7.7.2
40+
uv pip install pandas
41+
uv pip install ipywidgets==7.7.2
3942
40-
python -m venv .venvnokernel
43+
uv venv .venvnokernel
4144
source .venvnokernel/bin/activate
4245
python --version
4346
python -c "import sys;print(sys.executable)"
44-
python -m pip install ipykernel
47+
uv pip install pip
48+
uv pip install ipykernel
4549
python -m ipykernel install --user --name .venvnokernel --display-name .venvnokernel
46-
python -m pip uninstall jedi --yes
47-
python -m pip install jedi==0.17.2
4850
working-directory: src/test/datascience
4951
shell: bash
5052
# Used by tests for installation of ipykernel.
@@ -56,26 +58,25 @@ runs:
5658
- name: Create virtual environment without ipykernel (ipywidgets 8)
5759
if: inputs.IPyWidgetVersion == '8'
5860
run: |
59-
python -m venv .venvnoreg
60-
61-
python -m venv .venvkernel
61+
uv venv .venvnoreg
62+
uv venv .venvkernel
63+
source .venvnoreg/bin/activate
64+
uv pip install pip
6265
source .venvkernel/bin/activate
6366
python --version
6467
python -c "import sys;print(sys.executable)"
65-
python -m pip install ipykernel
68+
uv pip install pip
69+
uv pip install ipykernel
6670
python -m ipykernel install --user --name .venvkernel --display-name .venvkernel
67-
python -m pip uninstall jedi --yes
68-
python -m pip install jedi==0.17.2
69-
python -m pip install pandas
70-
python -m pip install ipywidgets -U
71+
uv pip install pandas
72+
uv pip install ipywidgets -U
7173
72-
python -m venv .venvnokernel
74+
uv venv .venvnokernel
7375
source .venvnokernel/bin/activate
7476
python --version
7577
python -c "import sys;print(sys.executable)"
76-
python -m pip install ipykernel
78+
uv pip install pip
79+
uv pip install ipykernel
7780
python -m ipykernel install --user --name .venvnokernel --display-name .venvnokernel
78-
python -m pip uninstall jedi --yes
79-
python -m pip install jedi==0.17.2
8081
working-directory: src/test/datascience
8182
shell: bash

.github/instructions/typescript.instructions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@ const mockInstance = mock<YourType>();
2929
mockInstance.then = undefined; // Ensure 'then' is undefined to prevent hanging
3030
```
3131

32+
## Integration Tests
33+
These tests can be a little slow as VS Code needs to be downloaded and launched.
34+
- Use `npm run test:integration` to run integration tests with local Jupyter Kernels (add `-- -- --grep <pattern>` to filter tests, pay attention to the prefix `-- --`)
35+
- Use `npm run test:integration:web` to run integration tests with Remote Jupyter Kernels and VSCode in browser (`--grep` is not supported)
36+
37+
3238
## Scripts
3339
- Use `npm install` to install dependencies if you changed `package.json`
34-
- Use `npm run test:unittests` for unit tests (add `--grep <pattern>` to filter tests)
40+
- Use `npm run test:unittests` for unit tests (add `-- -- --grep <pattern>` to filter tests, pay attention to the prefix `-- --`)
41+
- Use `npm run test:integration` to run integration tests with local Jupyter Kernels (add `-- -- --grep <pattern>` to filter tests, pay attention to the prefix `-- --`)
42+
- Use `npm run test:integration:web` to run integration tests with Remote Jupyter Kernels and VSCode in browser (`--grep` is not supported)
3543
- Use `npm run lint` to check for linter issues
3644
- Use `npm run format` to check code style
3745
- Use `npm run format-fix` to auto-fix formatting issues

.github/workflows/build-test.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
run: npm run postinstall
147147

148148
- name: Verify Translation files
149-
run: npm run validateTranslationFiles
149+
run: npx gulp validateTranslationFiles
150150

151151
- name: Run linting on TypeScript code (eslint)
152152
run: npm run lint
@@ -166,8 +166,8 @@ jobs:
166166
python -m black . --check
167167
working-directory: pythonFiles
168168

169-
- name: Run gulp prePublishNonBundle
170-
run: npm run prePublishNonBundle
169+
- name: Compile
170+
run: npm run compile
171171

172172
- name: Check dependencies
173173
run: npm run checkDependencies
@@ -176,7 +176,7 @@ jobs:
176176
run: npx gulp validatePackageLockJson
177177

178178
- name: Validate TELEMETRY files
179-
run: npm run validateTelemetry
179+
run: npx gulp validateTelemetry
180180

181181
- name: Verify usage of new Proposed API
182182
if: github.event_name == 'pull_request'
@@ -249,15 +249,15 @@ jobs:
249249
run: npm run postinstall
250250

251251
- name: Compile if not cached
252-
run: npm run prePublishNonBundle
252+
run: npm run compile
253253
if: steps.out-cache.outputs.cache-hit != 'true'
254254

255255
- name: Run TypeScript unit tests
256256
id: test_unittests
257257
run: npm run test:unittests
258258

259259
- name: Verify there are no unhandled errors
260-
run: npm run verifyUnhandledErrors
260+
run: npx gulp verifyUnhandledErrors
261261

262262
vscodeTests:
263263
name: Tests # These tests run with Python extension & real Jupyter
@@ -592,7 +592,7 @@ jobs:
592592

593593
# This step is slow.
594594
- name: Compile # if not cached
595-
run: npm run prePublishNonBundle
595+
run: npm run compile
596596
# Do not cache for web tests, as the code generated in the compiled code is different for each matrix in web tests
597597
# Rememeber the compiled code contains injected tests, and the injected tests are different for each matrix in the web
598598
# if: steps.out-cache.outputs.cache-hit != 'true' && matrix.jupyterConnection != 'web'
@@ -659,7 +659,7 @@ jobs:
659659
- name: Run Native Notebook with VSCode & Jupyter (ubuntu)
660660
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
661661
with:
662-
run: ${{ env.xvfbCommand }} npm run testNativeNotebooksInVSCode
662+
run: ${{ env.xvfbCommand }} npm run test:integration
663663
env:
664664
VSC_JUPYTER_FORCE_LOGGING: 1
665665
VSC_PYTHON_FORCE_LOGGING: 1
@@ -676,13 +676,11 @@ jobs:
676676
- name: Run Notebook Perf Test Without Jupyter
677677
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
678678
with:
679-
run: ${{ env.xvfbCommand }} npm run testPerfInVSCode
679+
run: ${{ env.xvfbCommand }} npm run test:performance:notebook
680680
env:
681681
VSC_JUPYTER_FORCE_LOGGING: 1
682682
VSC_PYTHON_FORCE_LOGGING: 1
683683
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1
684-
VSC_JUPYTER_PERF_TEST: ${{ matrix.matrix == '@notebookPerformance' }}
685-
VSC_JUPYTER_NOTEBOOK_PERF_TEST: ${{ matrix.matrix == '@notebookPerformance' }}
686684
VSC_JUPYTER_CI_TEST_DO_NOT_INSTALL_PYTHON_EXT: ${{ matrix.matrix == '@notebookPerformance' }}
687685
VSC_JUPYTER_REMOTE_NATIVE_TEST: ${{ matrix.jupyterConnection == 'remote' }}
688686
VSC_JUPYTER_NON_RAW_NATIVE_TEST: ${{ matrix.jupyterConnection == 'local' }}
@@ -696,12 +694,11 @@ jobs:
696694
- name: Run Execution Perf Test With Jupyter
697695
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
698696
with:
699-
run: ${{ env.xvfbCommand }} npm run testExecPerfInVSCode
697+
run: ${{ env.xvfbCommand }} npm run test:performance:execution
700698
env:
701699
VSC_JUPYTER_FORCE_LOGGING: 1
702700
VSC_PYTHON_FORCE_LOGGING: 1
703701
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1
704-
VSC_JUPYTER_PERF_TEST: ${{ matrix.matrix == '@executionPerformance' }}
705702
VSC_JUPYTER_REMOTE_NATIVE_TEST: ${{ matrix.jupyterConnection == 'remote' }}
706703
VSC_JUPYTER_NON_RAW_NATIVE_TEST: ${{ matrix.jupyterConnection == 'local' }}
707704
VSC_JUPYTER_CI_RUN_JAVA_NB_TEST: ${{ matrix.python == 'conda' }}
@@ -720,7 +717,7 @@ jobs:
720717
- name: Run Native Notebook with VSCode & Jupyter (web)
721718
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
722719
with:
723-
run: npm run testWebExtension
720+
run: npm run test:integration:web
724721
env:
725722
VSC_JUPYTER_FORCE_LOGGING: 1
726723
VSC_PYTHON_FORCE_LOGGING: 1
@@ -735,8 +732,9 @@ jobs:
735732
if: matrix.python != 'noPython' && matrix.os == 'ubuntu-latest' && matrix.jupyterConnection == 'web'
736733

737734
- name: Run Native Notebook with VSCode & Jupyter (windows)
735+
# Running tests on Windows is verys low, hence run only a few of the tests.
738736
run: |
739-
npm run testNativeNotebooksInVSCodeWithoutTestSuffix
737+
npm run test:integration:windows
740738
env:
741739
VSC_JUPYTER_FORCE_LOGGING: 1
742740
VSC_PYTHON_FORCE_LOGGING: 1
@@ -754,7 +752,7 @@ jobs:
754752
- name: Run Native Notebook with VSCode & Jupyter (without Python)
755753
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
756754
with:
757-
run: ${{ env.xvfbCommand }} npm run testNativeNotebooksWithoutPythonInVSCode
755+
run: ${{ env.xvfbCommand }} npm run test:integration:nonpython
758756
env:
759757
VSC_JUPYTER_FORCE_LOGGING: 1
760758
VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST: 1
@@ -773,7 +771,7 @@ jobs:
773771

774772
- name: Log test results
775773
if: always()
776-
run: npm run printTestResults
774+
run: npx gulp printTestResults
777775

778776
- name: Upload test result, screenshots files
779777
uses: actions/upload-artifact@v4
@@ -784,7 +782,7 @@ jobs:
784782
retention-days: 60
785783

786784
- name: Verify there are no unhandled errors
787-
run: npm run verifyUnhandledErrors
785+
run: npx gulp verifyUnhandledErrors
788786

789787
smoke-tests:
790788
timeout-minutes: 30
@@ -857,4 +855,4 @@ jobs:
857855
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders'
858856
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
859857
with:
860-
run: npm run testSmokeLogged
858+
run: npm run test:smoke

.github/workflows/copilot-setup-steps.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,14 @@ jobs:
7272
echo "Playwright not found, skipping browser installation"
7373
fi
7474
continue-on-error: true
75+
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@v6
78+
79+
- name: Setup Venv
80+
run: |
81+
uv venv
82+
source .venv/bin/activate
83+
uv pip install pip
84+
uv pip install -r build/venv-test-ipywidgets8-requirements.txt
85+
uv pip install jupyter notebook ipykernel

.vscode/launch.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -126,34 +126,6 @@
126126
"order": 10
127127
}
128128
},
129-
{
130-
"name": "Jedi LSP tests",
131-
"type": "extensionHost",
132-
"request": "launch",
133-
"runtimeExecutable": "${execPath}",
134-
"args": [
135-
"${workspaceFolder}/src/test",
136-
"--disable-extensions",
137-
"--extensionDevelopmentPath=${workspaceFolder}",
138-
"--extensionTestsPath=${workspaceFolder}/out/test"
139-
],
140-
"env": {
141-
"VSC_JUPYTER_CI_TEST_GREP": "Language Server:"
142-
},
143-
"sourceMaps": true,
144-
"outFiles": [
145-
"${workspaceFolder}/out/**/*.js",
146-
"!${workspaceFolder}/**/node_modules**/*"
147-
],
148-
"preLaunchTask": "preTestJediLSP",
149-
"skipFiles": [
150-
"<node_internals>/**"
151-
],
152-
"presentation": {
153-
"group": "2_tests",
154-
"order": 4
155-
}
156-
},
157129
{
158130
// Run this first: https://github.com/microsoft/vscode-jupyter/blob/main/src/test/datascience/setupTestEnvs.cmd
159131
// Then specify either a grep below or mark a test as 'test.only' to run the test that's failing.
@@ -309,7 +281,6 @@
309281
"--extensionTestsPath=${workspaceFolder}/out/test/index.node.js"
310282
],
311283
"env": {
312-
"VSC_JUPYTER_PERF_TEST": "1",
313284
"VSC_JUPYTER_CI_TEST_GREP": "@notebookPerformance",
314285
"VSC_JUPYTER_CI_TEST_VSC_CHANNEL": "insiders",
315286
"TEST_FILES_SUFFIX": "*.vscode.common.test",
@@ -341,7 +312,6 @@
341312
"--extensionTestsPath=${workspaceFolder}/out/test/index.node.js"
342313
],
343314
"env": {
344-
"VSC_JUPYTER_PERF_TEST": "1",
345315
"VSC_JUPYTER_CI_TEST_GREP": "@executionPerformance",
346316
"VSC_JUPYTER_CI_TEST_VSC_CHANNEL": "insiders",
347317
"CI_PYTHON_PATH": "",

.vscode/tasks.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,6 @@
5555
"isDefault": true
5656
}
5757
},
58-
{
59-
"type": "npm",
60-
"script": "preTestJediLSP",
61-
"problemMatcher": [],
62-
"label": "preTestJediLSP"
63-
},
64-
{
65-
"type": "npm",
66-
"script": "launchWebExtension",
67-
"problemMatcher": [],
68-
"label": "Launch Web Extension (Chrome)"
69-
},
70-
{
71-
"type": "shell",
72-
"problemMatcher": [],
73-
"command": "npm",
74-
"args": ["run", "launchWebExtension", "--", "--browser=webkit", "--port=3111"],
75-
"label": "Launch Web Extension (Safari)"
76-
},
7758
{
7859
"type": "npm",
7960
"script": "lint",

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Run the `watch` build Tasks from the [Run Build Task...](https://code.visualstud
4848
You can also compile from the command-line. For a full compile you can use:
4949

5050
```shell
51-
npx gulp prePublishNonBundle
51+
npm run compile
5252
```
5353

5454
For incremental builds it is recommended you use the `watch` build task (for better integration with VS Code).

build/azure-pipeline.pre-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extends:
8282
- script: npm run clean
8383
displayName: Clean
8484

85-
- script: npm run prePublishBundlePreRelease
85+
- script: npm run build:prerelease
8686
displayName: Build
8787
env:
8888
VSC_VSCE_TARGET: $(vsceTarget)

build/azure-pipeline.stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extends:
7676
- script: npm run clean
7777
displayName: Clean
7878

79-
- script: npm run prePublishBundleStable
79+
- script: npm run build:stable
8080
displayName: Build
8181
env:
8282
VSC_VSCE_TARGET: $(vsceTarget)

gulpfile.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,8 @@ gulp.task('updatePackageJsonForBundle', async () => {
200200
}
201201
});
202202

203-
gulp.task('prePublishBundle', async () => {
204-
await spawnAsync('npm', ['run', 'prePublishBundle']);
205-
});
206-
207203
gulp.task('checkDependencies', gulp.series('checkNativeDependencies', 'checkNpmDependencies'));
208204

209-
gulp.task('prePublishNonBundle', async () => {
210-
await spawnAsync('npm', ['run', 'prePublishNonBundle']);
211-
});
212-
213205
function spawnAsync(command, args) {
214206
return new Promise((resolve, reject) => {
215207
let stdOut = '';

0 commit comments

Comments
 (0)