Quellcode durchsuchen

Continue setting up test package.

Ian Rose vor 6 Jahren
Ursprung
Commit
2f58260f90

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

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

+ 0 - 1
tests/test-statusbar/karma-cov.conf.js

@@ -1 +0,0 @@
-module.exports = require('../karma-cov.conf');

+ 0 - 1
tests/test-statusbar/karma.conf.js

@@ -1 +0,0 @@
-module.exports = require('../karma.conf');

+ 17 - 10
tests/test-statusbar/package.json

@@ -3,19 +3,26 @@
   "version": "0.5.1",
   "private": true,
   "scripts": {
-    "build": "tsc",
+    "build": "tsc -b",
     "clean": "rimraf build && rimraf coverage",
-    "coverage": "python run-test.py --browsers ChromeHeadless karma-cov.conf.js",
-    "test": "jlpm run test:firefox",
-    "test:chrome": "python run-test.py --browsers=Chrome karma.conf.js",
-    "test:debug": "python run-test.py  --browsers=Chrome --singleRun=false --debug=true --browserNoActivityTimeout=10000000 karma.conf.js",
-    "test:firefox": "python run-test.py --browsers=Firefox karma.conf.js",
-    "test:ie": "python run-test.py  --browsers=IE karma.conf.js",
-    "watch": "python run-test.py --singleRun=false",
-    "watch:src": "tsc -w --listEmittedFiles"
+    "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/statusbar": "^0.7.1",
+    "@jupyterlab/testutils": "^0.3.1",
+    "@phosphor/widgets": "^1.6.0",
+    "chai": "~4.1.2",
+    "jest": "^23.5.0",
+    "ts-jest": "^23.1.4"
   },
   "devDependencies": {
-    "karma": "~2.0.4",
+    "@types/chai": "~4.0.10",
+    "@types/jest": "^23.3.1",
+    "puppeteer": "^1.5.0",
     "rimraf": "~2.6.2",
     "typescript": "~3.1.1"
   }

+ 3 - 5
tests/test-statusbar/run-test.py → tests/test-statusbar/run.py

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

+ 25 - 0
tests/test-statusbar/src/statusbar.spec.ts

@@ -1,2 +1,27 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
+
+import { expect } from 'chai';
+
+import { StatusBar } from '@jupyterlab/statusbar/src';
+
+describe('@jupyterlab/statusbar', () => {
+  describe('StatusBar', () => {
+    let statusBar: StatusBar;
+
+    beforeEach(() => {
+      statusBar = new StatusBar();
+    });
+
+    afterEach(() => {
+      statusBar.dispose();
+    });
+
+    describe('#constructor()', () => {
+      it('should construct a new status bar', () => {
+        const statusBar = new StatusBar();
+        expect(statusBar).to.be.an.instanceof(StatusBar);
+      });
+    });
+  });
+});

+ 11 - 1
tests/test-statusbar/tsconfig.json

@@ -2,7 +2,17 @@
   "extends": "../../tsconfigbase",
   "compilerOptions": {
     "outDir": "build",
+    "types": ["jest"],
+    "composite": false,
     "rootDir": "src"
   },
-  "include": ["src/*"]
+  "include": ["src/*"],
+  "references": [
+    {
+      "path": "../../packages/statusbar"
+    },
+    {
+      "path": "../../testutils"
+    }
+  ]
 }