Skip to content

Commit

Permalink
Fix jest configuration (#238)
Browse files Browse the repository at this point in the history
* Update channel

* Fix jest configuration

* Test tl;dr on CI

* Fix preview image link
  • Loading branch information
fcollonval authored Jun 22, 2023
1 parent 97aed63 commit b6b2e29
Show file tree
Hide file tree
Showing 33 changed files with 46 additions and 75 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,23 @@ jobs:
# - if: steps.filter.outputs.extension == 'true' && matrix.example == 'documents'
# run: |
# python -m pip install jupyter-collaboration
- name: Install the NPM dependencies
- name: Build the extension
if: steps.filter.outputs.extension == 'true'
run: jlpm
run: |
# Same commands as in TL;DR to ensure it works
touch yarn.lock
pip install -e . -v
jupyter labextension develop . --overwrite
shell: bash
- name: Lint the files
if: steps.filter.outputs.extension == 'true'
run: jlpm run eslint:check
- name: Build and check by extension
run: jlpm run lint:check
- name: Check extension installation
if: steps.filter.outputs.extension == 'true'
run: |
pip install . -v
jupyter labextension list 2>&1 | tee labextension.list
cat labextension.list | grep -ie "@jupyterlab-examples/*.*OK"
# There is a JavaScript warning as jupyter-collaboration is not
# installed. And therefore @jupyter/docprovider is not available.
python -m jupyterlab.browser_check
shell: bash
- name: Install galata
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
Expand Down Expand Up @@ -217,7 +218,7 @@ jobs:
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip jupyterlab~=4.0.0 build twine hatch
python -m pip install --upgrade pip jupyterlab~=4.0.0 build
- name: Install the NPM dependencies
if: steps.filter.outputs.extension == 'true'
run: |
Expand All @@ -227,7 +228,7 @@ jobs:
if: steps.filter.outputs.extension == 'true'
run: |
cd server-extension
jlpm run eslint:check
jlpm run lint:check
- name: Build extension as user
if: steps.filter.outputs.extension == 'true'
# Force the usage of the source distribution (good practice)
Expand Down Expand Up @@ -340,9 +341,7 @@ jobs:
run: jlpm
- name: Build all the extensions
run: |
# Check embedded snippets
jlpm lint:check
jlpm run lerna exec --concurrency 4 -- "touch yarn.lock"
# Needed to generate the _version.py files
jlpm run lerna exec --concurrency 4 -- "pip install -e ."
# Check links as last step as new tutorial may set links not yet valid (like file not yet in main)
jlpm run lerna exec --concurrency 4 -- "pytest --check-links"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Use State persistence in an extension.

Add a new button to the notebook toolbar.

[![Toolbar button](toolbar-button/Preview.gif)](toolbar-button)
[![Toolbar button](toolbar-button/preview.gif)](toolbar-button)

### [Widgets](widgets)

Expand Down
1 change: 0 additions & 1 deletion codemirror-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"test": "jest --coverage",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w --sourceMap",
"watch:labextension": "jupyter labextension watch ."
Expand Down
3 changes: 1 addition & 2 deletions codemirror-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions command-palette/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions commands/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions completer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions contentheader/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions context-menu/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions custom-log-console/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions datagrid/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions documents/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: jupyterlab-extension-examples
channels:
- conda-forge
- conda-forge/label/jupyterlab_beta
dependencies:
- jupyterlab >=4.0.0
- nodejs=18
Expand Down
3 changes: 1 addition & 2 deletions hello-world/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
5 changes: 4 additions & 1 deletion hello-world/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "./tsconfig"
"extends": "./tsconfig",
"compilerOptions": {
"types": ["jest"]
}
}
3 changes: 1 addition & 2 deletions kernel-messaging/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions kernel-output/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions launcher/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions log-messages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions main-menu/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 0 additions & 3 deletions metadata-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"test": "jest --coverage",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w --sourceMap",
"watch:labextension": "jupyter labextension watch ."
Expand All @@ -68,7 +67,6 @@
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/testutils": "^4.0.0",
"@types/jest": "^29.2.0",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.0.26",
"@typescript-eslint/eslint-plugin": "^5.55.0",
Expand All @@ -77,7 +75,6 @@
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
Expand Down
3 changes: 1 addition & 2 deletions metadata-form/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions mimerenderer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
1 change: 0 additions & 1 deletion notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"test": "jest --coverage",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
Expand Down
3 changes: 1 addition & 2 deletions notifications/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions react-widget/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
8 changes: 4 additions & 4 deletions server-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ like this (be careful to pick _server_ as _kind_):
> The python name must be a valid Python module name (characters such `-`, `@` or `/` are not allowed).
> It is nice for user to test your extension online, so the _set up Binder_ was set to _Yes_.
The template creates creates files in the current director
The template creates files in the current director
that looks like this:

```bash
Expand Down Expand Up @@ -110,13 +110,13 @@ that looks like this:
├── .prettierignore
├── tsconfig.json # Typescript compilation configuration
├── tsconfig.test.json
├── .yarnrc.yml
├── .yarnrc.yml # Yarn package manager configuration
├── src # Actual code of the extension
│ ├── handler.ts
│ ├── index.ts
│ └── __tests__ # JavaScript unit tests
│ └── jlab_ext_example.spec.ts
│ └── jupyterlab_examples_server.spec.ts
├── style # CSS styling
│ ├── base.css
Expand All @@ -129,7 +129,7 @@ that looks like this:
├── playwright.config.js
├── README.md
├── tests
│ └── jlab_ext_example.spec.ts
│ └── jupyterlab_examples_server.spec.ts
└── yarn.lock
```

Expand Down
3 changes: 1 addition & 2 deletions server-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions settings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions signals/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions state/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
3 changes: 1 addition & 2 deletions toolbar-button/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}
Loading

0 comments on commit b6b2e29

Please sign in to comment.