Skip to content

Commit ea6d772

Browse files
fcollonvalFrédéric Collonval
authored andcommitted
Fix karma
1 parent 8b11ae3 commit ea6d772

File tree

8 files changed

+52
-26
lines changed

8 files changed

+52
-26
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ jobs:
5858
python -m pip install --upgrade -v -e ".[test, examples, docs]"
5959
yarn run lint:check
6060
61-
# TODO: re-enable tests
62-
# pytest
63-
# npm run test:ci
61+
pytest
62+
npm run test:ci
6463
6564
# - name: Check docs can be build + links
6665
# run: |

{{cookiecutter.github_project_name}}/docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
'sphinx.ext.napoleon',
3030
'sphinx.ext.todo',
3131
'nbsphinx',
32-
'jupyter_sphinx.execute',
32+
'jupyter_sphinx',
3333
'nbsphinx_link',
3434
]
3535

{{cookiecutter.github_project_name}}/package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"lint:check": "eslint . --ext .ts,.tsx",
4444
"prepack": "yarn run build:lib",
4545
"test": "yarn run test:firefox",
46+
"test:ci": "karma start --browsers=ChromeCI tests/karma.conf.js",
4647
"test:chrome": "karma start --browsers=Chrome tests/karma.conf.js",
4748
"test:debug": "karma start --browsers=Chrome --singleRun=false --debug=true tests/karma.conf.js",
4849
"test:firefox": "karma start --browsers=Firefox tests/karma.conf.js",
@@ -59,8 +60,8 @@
5960
"@phosphor/application": "^1.6.0",
6061
"@phosphor/widgets": "^1.6.0",
6162
"@types/expect.js": "^0.3.29",
62-
"@types/mocha": "^5.2.5",
63-
"@types/node": "^10.11.6",
63+
"@types/mocha": "^8.2.0",
64+
"@types/node": "^14.14.13",
6465
"@types/webpack-env": "^1.13.6",
6566
"@typescript-eslint/eslint-plugin": "^3.6.0",
6667
"@typescript-eslint/parser": "^3.6.0",
@@ -71,25 +72,25 @@
7172
"eslint-plugin-prettier": "^3.1.4",
7273
"expect.js": "^0.3.1",
7374
"fs-extra": "^7.0.0",
74-
"karma": "^3.1.0",
75-
"karma-chrome-launcher": "^2.2.0",
76-
"karma-firefox-launcher": "^1.1.0",
77-
"karma-ie-launcher": "^1.0.0",
78-
"karma-mocha": "^1.3.0",
75+
"karma": "^5.2.3",
76+
"karma-chrome-launcher": "^3.1.0",
77+
"karma-coverage": "^2.0.1",
78+
"karma-firefox-launcher": "^2.1.0",
79+
"karma-mocha": "^2.0.1",
7980
"karma-mocha-reporter": "^2.2.5",
80-
"karma-typescript": "^5.0.3",
81-
"karma-typescript-es6-transform": "^5.0.3",
81+
"karma-typescript": "^5.2.0",
82+
"karma-typescript-es6-transform": "^5.2.0",
8283
"mkdirp": "^0.5.1",
83-
"mocha": "^5.2.0",
84+
"mocha": "^8.2.1",
8485
"npm-run-all": "^4.1.3",
8586
"prettier": "^2.0.5",
8687
"rimraf": "^2.6.2",
87-
"source-map-loader": "^0.2.4",
88+
"source-map-loader": "^1.1.3",
8889
"style-loader": "^1.0.0",
89-
"ts-loader": "^5.2.1",
90+
"ts-loader": "^8.0.0",
9091
"typescript": "~4.1.3",
91-
"webpack": "^5",
92-
"webpack-cli": "^4"
92+
"webpack": "^5.0.0",
93+
"webpack-cli": "^4.0.0"
9394
},
9495
"jupyterlab": {
9596
"extension": "lib/plugin",

{{cookiecutter.github_project_name}}/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
'sphinx>=1.5',
106106
'recommonmark',
107107
'sphinx_rtd_theme',
108-
'nbsphinx>=0.2.13,<0.4.0',
108+
'nbsphinx',
109109
'jupyter_sphinx',
110110
'nbsphinx-link',
111111
'pytest_check_links',

{{cookiecutter.github_project_name}}/src/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) {{ cookiecutter.author_name }}
22
// Distributed under the terms of the Modified BSD License.
33

4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore
46
// eslint-disable-next-line @typescript-eslint/no-var-requires
57
const data = require('../package.json');
68

{{cookiecutter.github_project_name}}/tests/karma.conf.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ module.exports = function (config) {
2525
singleRun: true,
2626
logLevel: config.LOG_INFO,
2727

28+
customLaunchers: {
29+
ChromeCI: {
30+
base: 'ChromeHeadless',
31+
flags: ['--no-sandbox']
32+
}
33+
},
2834

2935
karmaTypescriptConfig: {
3036
tsconfig: 'tests/tsconfig.json',
37+
coverageOptions: {
38+
instrumentation: false
39+
},
3140
reports: {
3241
"text-summary": "",
3342
"html": "coverage",
@@ -37,8 +46,20 @@ module.exports = function (config) {
3746
}
3847
},
3948
bundlerOptions: {
49+
sourceMap: false, // Disabled due to error/bug
50+
acornOptions: {
51+
ecmaVersion: 8,
52+
},
4053
transforms: [
41-
require("karma-typescript-es6-transform")()
54+
require("karma-typescript-es6-transform")({
55+
presets: [
56+
["@babel/preset-env", {
57+
targets: {
58+
browsers: ["last 2 Chrome versions"]
59+
},
60+
}]
61+
]
62+
})
4263
]
4364
}
4465
}

{{cookiecutter.github_project_name}}/tests/src/utils.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import * as widgets from '@jupyter-widgets/base';
55
import * as services from '@jupyterlab/services';
6-
import * as Backbone from 'backbone';
76

87
let numComms = 0;
98

@@ -53,7 +52,7 @@ class DummyManager extends widgets.ManagerBase<HTMLElement> {
5352
this.el = window.document.createElement('div');
5453
}
5554

56-
display_view(msg: services.KernelMessage.IMessage, view: Backbone.View<Backbone.Model>, options: any) {
55+
display_view(msg: services.KernelMessage.IMessage, view: widgets.DOMWidgetView, options: any) {
5756
// TODO: make this a spy
5857
// TODO: return an html element
5958
return Promise.resolve(view).then(view => {

{{cookiecutter.github_project_name}}/tests/tsconfig.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
"compilerOptions": {
33
"declaration": true,
44
"noImplicitAny": true,
5-
"lib": ["dom", "es5", "es2015.promise", "es2015.iterable"],
6-
"noEmitOnError": true,
5+
"lib": ["dom", "es6"],
6+
"noEmitOnError": false,
77
"strictNullChecks": true,
88
"module": "commonjs",
99
"moduleResolution": "node",
10-
"target": "ES5",
10+
"target": "ES6",
1111
"outDir": "build",
12+
"rootDir": "src",
1213
"skipLibCheck": true,
13-
"sourceMap": true
14+
"sourceMap": true,
15+
"types": [
16+
"mocha"
17+
]
1418
},
1519
"include": [
1620
"src/*.ts",

0 commit comments

Comments
 (0)