Browse Source

modernize logconsole tests

Steven Silvester 5 years ago
parent
commit
06b2b335ec

+ 11 - 0
packages/logconsole/.vscode/launch.json

@@ -0,0 +1,11 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "type": "node",
+            "request": "attach",
+            "name": "Attach",
+            "port": 9229
+        }
+    ]
+}

+ 0 - 0
tests/test-logconsole/babel.config.js → packages/logconsole/babel.config.js


+ 2 - 0
packages/logconsole/jest.config.js

@@ -0,0 +1,2 @@
+const func = require('@jupyterlab/testutils/lib/jest-config-new');
+module.exports = func(__dirname);

+ 10 - 1
packages/logconsole/package.json

@@ -27,9 +27,14 @@
   },
   "scripts": {
     "build": "tsc -b",
+    "build:test": "tsc --build tsconfig.test.json",
     "clean": "rimraf lib",
     "prepublishOnly": "npm run build",
-    "watch": "tsc -w --listEmittedFiles"
+    "test": "jest",
+    "test:cov": "jest --collect-coverage",
+    "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
+    "test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
+    "watch": "tsc -b --watch"
   },
   "dependencies": {
     "@jupyterlab/coreutils": "^4.1.0",
@@ -44,7 +49,11 @@
     "@lumino/widgets": "^1.11.1"
   },
   "devDependencies": {
+    "@jupyterlab/testutils": "^2.1.0",
+    "@types/jest": "^24.0.23",
+    "jest": "^25.2.3",
     "rimraf": "~3.0.0",
+    "ts-jest": "^25.2.1",
     "typescript": "~3.7.3"
   },
   "publishConfig": {

+ 2 - 0
tests/test-logconsole/src/logger.spec.ts → packages/logconsole/test/logger.spec.ts

@@ -1,4 +1,6 @@
 // Copyright (c) Jupyter Development Team.
+
+import 'jest';
 // Distributed under the terms of the Modified BSD License.
 
 import {

+ 2 - 0
tests/test-logconsole/src/registry.spec.ts → packages/logconsole/test/registry.spec.ts

@@ -1,4 +1,6 @@
 // Copyright (c) Jupyter Development Team.
+
+import 'jest';
 // Distributed under the terms of the Modified BSD License.
 
 import { LoggerRegistry } from '@jupyterlab/logconsole';

+ 2 - 0
tests/test-logconsole/src/widget.spec.ts → packages/logconsole/test/widget.spec.ts

@@ -1,4 +1,6 @@
 // Copyright (c) Jupyter Development Team.
+
+import 'jest';
 // Distributed under the terms of the Modified BSD License.
 
 import { LoggerRegistry, LogConsolePanel } from '@jupyterlab/logconsole';

+ 42 - 0
packages/logconsole/tsconfig.test.json

@@ -0,0 +1,42 @@
+{
+  "extends": "../../tsconfigbase.test",
+  "compilerOptions": {
+    "strictNullChecks": false
+  },
+  "include": ["src/*", "test/*"],
+  "references": [
+    {
+      "path": "../coreutils"
+    },
+    {
+      "path": "../nbformat"
+    },
+    {
+      "path": "../outputarea"
+    },
+    {
+      "path": "../rendermime"
+    },
+    {
+      "path": "../services"
+    },
+    {
+      "path": "../../testutils"
+    },
+    {
+      "path": "../coreutils"
+    },
+    {
+      "path": "../nbformat"
+    },
+    {
+      "path": "../outputarea"
+    },
+    {
+      "path": "../rendermime"
+    },
+    {
+      "path": "../services"
+    }
+  ]
+}

+ 0 - 2
tests/test-logconsole/jest.config.js

@@ -1,2 +0,0 @@
-const func = require('@jupyterlab/testutils/lib/jest-config');
-module.exports = func('logconsole', __dirname);

+ 0 - 30
tests/test-logconsole/package.json

@@ -1,30 +0,0 @@
-{
-  "name": "@jupyterlab/test-logconsole",
-  "version": "2.2.0",
-  "private": true,
-  "scripts": {
-    "build": "tsc -b",
-    "clean": "rimraf build && rimraf coverage",
-    "coverage": "python run.py --coverage",
-    "test": "python run.py",
-    "watch": "python run.py --debug",
-    "watch:all": "python run.py --debug --watchAll",
-    "watch:src": "tsc -b --watch"
-  },
-  "dependencies": {
-    "@jupyterlab/logconsole": "^2.1.0",
-    "@jupyterlab/rendermime": "^2.1.0",
-    "@jupyterlab/testutils": "^2.1.0",
-    "@lumino/signaling": "^1.3.5",
-    "@lumino/widgets": "^1.11.1",
-    "jest": "^25.2.3",
-    "jest-junit": "^10.0.0",
-    "ts-jest": "^25.2.1"
-  },
-  "devDependencies": {
-    "@types/chai": "^4.2.7",
-    "@types/jest": "^24.0.23",
-    "rimraf": "~3.0.0",
-    "typescript": "~3.7.3"
-  }
-}

+ 0 - 8
tests/test-logconsole/run.py

@@ -1,8 +0,0 @@
-# Copyright (c) Jupyter Development Team.
-# Distributed under the terms of the Modified BSD License.
-
-import os.path as osp
-from jupyterlab.tests.test_app import run_jest
-
-if __name__ == '__main__':
-    run_jest(osp.dirname(osp.realpath(__file__)))

+ 0 - 21
tests/test-logconsole/tsconfig.json

@@ -1,21 +0,0 @@
-{
-  "extends": "../../tsconfigbase",
-  "compilerOptions": {
-    "outDir": "build",
-    "types": ["jest"],
-    "composite": false,
-    "rootDir": "src"
-  },
-  "include": ["src/*"],
-  "references": [
-    {
-      "path": "../../packages/logconsole"
-    },
-    {
-      "path": "../../packages/rendermime"
-    },
-    {
-      "path": "../../testutils"
-    }
-  ]
-}