From 919efbf5397bdb0a6bd1b8ab61be0c2c49d70b7a Mon Sep 17 00:00:00 2001 From: Matt Henderson Date: Wed, 17 Apr 2024 10:05:23 -0700 Subject: [PATCH 1/4] resolve jupyter warning about being out of date, split test build out, reduce log messages, minor cleanup --- .eslintignore | 3 + babel.config.js | 7 +- jest.config.js | 44 +- package.json | 41 +- pyproject.toml | 2 +- src/components/JobSubmitForm.tsx | 6 +- src/components/SqueueDataTable.tsx | 6 +- src/handler.ts | 4 +- src/index.ts | 20 +- src/slurmWidget.tsx | 11 +- style/index.js | 1 + tsconfig.json | 20 +- yarn.lock | 10905 ++++++++------------------- 13 files changed, 3430 insertions(+), 7640 deletions(-) diff --git a/.eslintignore b/.eslintignore index 5c99ba7..445ebe7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,6 @@ dist coverage **/*.d.ts tests + +**/__tests__ +ui-tests \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index 6432e2b..a12698c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1 @@ -module.exports = { - presets: [ - ['@babel/preset-env', { targets: { node: 'current' } }], - '@babel/preset-typescript', - ], -}; \ No newline at end of file +module.exports = require('@jupyterlab/testutils/lib/babel.config'); \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 613daf3..eb83717 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,10 +1,38 @@ +const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config'); + +const jlabConfig = jestJupyterLab(__dirname); + +const { + moduleFileExtensions, + moduleNameMapper, + preset, + setupFilesAfterEnv, + setupFiles, + testPathIgnorePatterns, + transform +} = jlabConfig; + module.exports = { - preset: 'ts-jest/presets/js-with-babel', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'], - globals: { - 'ts-jest': { - tsConfig: 'tsconfig.json' - } - }, + moduleFileExtensions, + moduleNameMapper, + preset, + setupFilesAfterEnv, + setupFiles, + testPathIgnorePatterns, + transform, + automock: false, + collectCoverageFrom: [ + 'src/**/*.{ts,tsx}', + '!src/**/*.d.ts', + '!src/**/.ipynb_checkpoints/*' + ], + coverageDirectory: 'coverage', + coverageReporters: ['lcov', 'text'], + globals: { + 'ts-jest': { + tsconfig: 'tsconfig.json' + } + }, + testRegex: 'src/.*/.*.spec.ts[x]?$', + transformIgnorePatterns: ['/node_modules/(?!@jupyterlab/.+)'] }; diff --git a/package.json b/package.json index 180b961..640badc 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jupyterlab-slurm", - "version": "3.0.2", + "version": "3.1.0", "description": "A JupyterLab extension to interface with the Slurm workload manager.", "keywords": [ "jupyter", @@ -56,34 +56,28 @@ "watch:src": "tsc -w" }, "dependencies": { - "@jupyterlab/application": "^3.0.10", - "@jupyterlab/apputils": "^3.0.6", - "@jupyterlab/coreutils": "^5.0.4", - "@jupyterlab/filebrowser": "^3.0.8", - "@jupyterlab/launcher": "^3.0.6", - "@jupyterlab/services": "^6.0.6", - "@jupyterlab/testutils": "^2.1.2", - "@lumino/widgets": "1.19.0", - "@types/bootstrap": "^4.3.0", - "@types/lodash": "^4.14.138", - "@types/node": "^11.13.7", - "@types/react": "^17.0.4", - "@types/styled-components": "^5.1.10", - "bootstrap": "^4.2.1", + "@jupyterlab/application": "^3.0.0", + "@jupyterlab/launcher": "^3.0.0", + "@jupyterlab/filebrowser": "^3.0.0", + "@jupyterlab/ui-components": "^3.0.0", + "@jupyterlab/coreutils": "^5.0.0", + "@jupyterlab/services": "^6.0.0", "lodash": "^4.17.15", - "popper.js": "^1.15.0", - "react": "^17.0.1", - "react-bootstrap": "^1.0.1", + "react-popper": "^1.3.11", "react-data-table-component": "^6.11.7", - "react-dom": "^17.0.1", "react-icons": "^4.2.0", "react-spinners": "^0.11.0", "styled-components": "^5.3.0", - "uuid": "^8.1.0" + "uuid": "^8.1.0", + "bootstrap": "^4.6.2", + "react-bootstrap": "^1.0.1" }, "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", "@jupyterlab/builder": "^3.0.0", - "@types/jest": "^26.0.3", + "@types/lodash": "^4.14.138", + "@types/styled-components": "^5.1.10", "@types/uuid": "^8.3.0", "@typescript-eslint/eslint-plugin": "^4.28.1", "@typescript-eslint/parser": "^4.28.1", @@ -94,12 +88,10 @@ "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", - "jest": "^26.1.0", "mkdirp": "^1.0.3", "npm-run-all": "^4.1.5", "prettier": "^2.1.1", "rimraf": "^3.0.2", - "ts-jest": "^26.1.1", "typescript": "~4.1.3", "yarn-deduplicate": "^1.1.1" }, @@ -119,6 +111,7 @@ "outputDir": "jupyterlab_slurm/labextension" }, "resolutions": { - "@lumino/widgets": "~1.19.0" + "@jupyterlab/rendermime-interfaces": "^3.0.0 <= 3.6.3", + "@types/react": "^17.0.4" } } diff --git a/pyproject.toml b/pyproject.toml index ba04c53..5aa6d81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"] +requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc13,==3.*", "jupyterlab_pygments<0.3.0", "setuptools>=40.8.0", "wheel"] build-backend = "setuptools.build_meta" diff --git a/src/components/JobSubmitForm.tsx b/src/components/JobSubmitForm.tsx index 478c10c..eb9388d 100755 --- a/src/components/JobSubmitForm.tsx +++ b/src/components/JobSubmitForm.tsx @@ -23,7 +23,7 @@ namespace types { export type State = { filebrowser: FileBrowser; - fileitems: JSX.Element[]; + fileitems: React.JSX.Element[]; inputType: string; inputPathSelectType: string; filepath: string; @@ -56,7 +56,7 @@ export default class JobSubmitForm extends React.Component< * component was clicked on and is now visible). If changed * to true, it calls the updateFileitems() function */ - componentDidUpdate(prevProps: types.Props, prevState: types.State): void { + componentDidUpdate(prevProps: types.Props): void { if (prevProps.active !== this.props.active) { if (this.props.active) { this.updateFileitems(); @@ -69,7 +69,7 @@ export default class JobSubmitForm extends React.Component< * and creates an array of