Browse Source

modernize codeeditor tests

Steven Silvester 5 years ago
parent
commit
2f9a35fa4a

+ 0 - 1
dev_mode/package.json

@@ -367,7 +367,6 @@
       "@jupyterlab/test-application": "../tests/test-application",
       "@jupyterlab/test-apputils": "../tests/test-apputils",
       "@jupyterlab/test-cells": "../tests/test-cells",
-      "@jupyterlab/test-codeeditor": "../tests/test-codeeditor",
       "@jupyterlab/test-codemirror": "../tests/test-codemirror",
       "@jupyterlab/test-completer": "../tests/test-completer",
       "@jupyterlab/test-coreutils": "../tests/test-coreutils",

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

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

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


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

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

+ 9 - 0
packages/codeeditor/package.json

@@ -29,9 +29,14 @@
   },
   "scripts": {
     "build": "tsc -b",
+    "build:test": "tsc --build tsconfig.test.json",
     "clean": "rimraf lib",
     "docs": "typedoc src",
     "prepublishOnly": "npm run build",
+    "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": {
@@ -47,7 +52,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",
     "typedoc": "^0.15.4",
     "typescript": "~3.7.3"
   },

+ 28 - 29
tests/test-codeeditor/src/editor.spec.ts → packages/codeeditor/test/editor.spec.ts

@@ -1,7 +1,6 @@
 // Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
 
-import { expect } from 'chai';
+import 'jest';
 
 import { CodeEditor } from '@jupyterlab/codeeditor';
 
@@ -20,14 +19,14 @@ describe('CodeEditor.Model', () => {
 
   describe('#constructor()', () => {
     it('should create a CodeEditor Model', () => {
-      expect(model).to.be.an.instanceof(CodeEditor.Model);
-      expect(model.value.text).to.equal('');
+      expect(model).toBeInstanceOf(CodeEditor.Model);
+      expect(model.value.text).toBe('');
     });
 
     it('should create a CodeEditor Model with an initial value', () => {
       const other = new CodeEditor.Model({ value: 'Initial text here' });
-      expect(other).to.be.an.instanceof(CodeEditor.Model);
-      expect(other.value.text).to.equal('Initial text here');
+      expect(other).toBeInstanceOf(CodeEditor.Model);
+      expect(other.value.text).toBe('Initial text here');
       other.dispose();
     });
 
@@ -36,9 +35,9 @@ describe('CodeEditor.Model', () => {
         value: 'import this',
         mimeType: 'text/x-python'
       });
-      expect(other).to.be.an.instanceof(CodeEditor.Model);
-      expect(other.mimeType).to.equal('text/x-python');
-      expect(other.value.text).to.equal('import this');
+      expect(other).toBeInstanceOf(CodeEditor.Model);
+      expect(other.mimeType).toBe('text/x-python');
+      expect(other.value.text).toBe('import this');
       other.dispose();
     });
   });
@@ -47,13 +46,13 @@ describe('CodeEditor.Model', () => {
     it('should be emitted when the mime type changes', () => {
       let called = false;
       model.mimeTypeChanged.connect((sender, args) => {
-        expect(sender).to.equal(model);
-        expect(args.oldValue).to.equal('text/plain');
-        expect(args.newValue).to.equal('text/foo');
+        expect(sender).toBe(model);
+        expect(args.oldValue).toBe('text/plain');
+        expect(args.newValue).toBe('text/foo');
         called = true;
       });
       model.mimeType = 'text/foo';
-      expect(called).to.be.true;
+      expect(called).toBe(true);
     });
   });
 
@@ -64,14 +63,14 @@ describe('CodeEditor.Model', () => {
         sender: IObservableString,
         args: IObservableString.IChangedArgs
       ) => {
-        expect(sender).to.equal(model.value);
-        expect(args.type).to.equal('set');
-        expect(args.value).to.equal('foo');
+        expect(sender).toBe(model.value);
+        expect(args.type).toBe('set');
+        expect(args.value).toBe('foo');
         called = true;
       };
       model.value.changed.connect(handler);
       model.value.text = 'foo';
-      expect(called).to.be.true;
+      expect(called).toBe(true);
       model.value.changed.disconnect(handler);
     });
 
@@ -81,13 +80,13 @@ describe('CodeEditor.Model', () => {
         sender: IObservableString,
         args: IObservableString.IChangedArgs
       ) => {
-        expect(args.type).to.equal('insert');
-        expect(args.value).to.equal('foo');
+        expect(args.type).toBe('insert');
+        expect(args.value).toBe('foo');
         called = true;
       };
       model.value.changed.connect(handler);
       model.value.insert(0, 'foo');
-      expect(called).to.be.true;
+      expect(called).toBe(true);
       model.value.changed.disconnect(handler);
     });
 
@@ -98,42 +97,42 @@ describe('CodeEditor.Model', () => {
         sender: IObservableString,
         args: IObservableString.IChangedArgs
       ) => {
-        expect(args.type).to.equal('remove');
-        expect(args.value).to.equal('f');
+        expect(args.type).toBe('remove');
+        expect(args.value).toBe('f');
         called = true;
       };
       model.value.changed.connect(handler);
       model.value.remove(0, 1);
-      expect(called).to.be.true;
+      expect(called).toBe(true);
       model.value.changed.disconnect(handler);
     });
   });
 
   describe('#selections', () => {
     it('should be the selections associated with the model', () => {
-      expect(model.selections.keys().length).to.equal(0);
+      expect(model.selections.keys().length).toBe(0);
     });
   });
 
   describe('#mimeType', () => {
     it('should be the mime type of the model', () => {
-      expect(model.mimeType).to.equal('text/plain');
+      expect(model.mimeType).toBe('text/plain');
       model.mimeType = 'text/foo';
-      expect(model.mimeType).to.equal('text/foo');
+      expect(model.mimeType).toBe('text/foo');
     });
   });
 
   describe('#modelDB', () => {
     it('should get the modelDB object associated with the model', () => {
-      expect(model.modelDB.has('value')).to.be.true;
+      expect(model.modelDB.has('value')).toBe(true);
     });
   });
 
   describe('#isDisposed', () => {
     it('should test whether the model is disposed', () => {
-      expect(model.isDisposed).to.be.false;
+      expect(model.isDisposed).toBe(false);
       model.dispose();
-      expect(model.isDisposed).to.be.true;
+      expect(model.isDisposed).toBe(true);
     });
   });
 });

+ 58 - 51
tests/test-codeeditor/src/jsoneditor.spec.ts → packages/codeeditor/test/jsoneditor.spec.ts

@@ -1,7 +1,6 @@
 // Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
 
-import { expect } from 'chai';
+import 'jest';
 
 import { CodeMirrorEditorFactory } from '@jupyterlab/codemirror';
 
@@ -65,105 +64,107 @@ describe('codeeditor', () => {
     describe('#constructor', () => {
       it('should create a new metadata editor', () => {
         const newEditor = new JSONEditor({ editorFactory });
-        expect(newEditor).to.be.an.instanceof(JSONEditor);
+        expect(newEditor).toBeInstanceOf(JSONEditor);
       });
     });
 
     describe('#headerNode', () => {
       it('should be the header node used by the editor', () => {
-        expect(Array.from(editor.headerNode.classList)).to.contain(
-          'jp-JSONEditor-header'
+        expect(Array.from(editor.headerNode.classList)).toEqual(
+          expect.arrayContaining(['jp-JSONEditor-header'])
         );
       });
     });
 
     describe('#editorHostNode', () => {
       it('should be the editor host node used by the editor', () => {
-        expect(Array.from(editor.editorHostNode.classList)).to.contain(
-          'jp-JSONEditor-host'
+        expect(Array.from(editor.editorHostNode.classList)).toEqual(
+          expect.arrayContaining(['jp-JSONEditor-host'])
         );
       });
     });
 
     describe('#revertButtonNode', () => {
       it('should be the revert button node used by the editor', () => {
-        expect(editor.revertButtonNode.querySelector("[data-icon$='undo']")).to
-          .exist;
+        expect(
+          editor.revertButtonNode.querySelector("[data-icon$='undo']")
+        ).toBeDefined();
       });
     });
 
     describe('#commitButtonNode', () => {
       it('should be the commit button node used by the editor', () => {
-        expect(editor.commitButtonNode.querySelector("[data-icon$='check']")).to
-          .exist;
+        expect(
+          editor.commitButtonNode.querySelector("[data-icon$='check']")
+        ).toBeDefined();
       });
     });
 
     describe('#source', () => {
       it('should be the source of the metadata', () => {
-        expect(editor.source).to.equal(null);
+        expect(editor.source).toBe(null);
       });
 
       it('should be settable', () => {
         const source = new ObservableJSON();
         editor.source = source;
-        expect(editor.source).to.equal(source);
+        expect(editor.source).toBe(source);
       });
 
       it('should update the text area value', () => {
         const model = editor.model;
-        expect(model.value.text).to.equal('No data!');
+        expect(model.value.text).toBe('No data!');
         editor.source = new ObservableJSON();
-        expect(model.value.text).to.equal('{}');
+        expect(model.value.text).toBe('{}');
       });
     });
 
     describe('#isDirty', () => {
       it('should test whether the editor value is dirty', () => {
-        expect(editor.isDirty).to.be.false;
+        expect(editor.isDirty).toBe(false);
         Widget.attach(editor, document.body);
         editor.model.value.text = 'a';
-        expect(editor.isDirty).to.be.true;
+        expect(editor.isDirty).toBe(true);
       });
 
       it('should be dirty if the value changes while focused', () => {
         editor.source = new ObservableJSON();
         Widget.attach(editor, document.body);
         editor.editor.focus();
-        expect(editor.isDirty).to.be.false;
+        expect(editor.isDirty).toBe(false);
         editor.source.set('foo', 1);
-        expect(editor.isDirty).to.be.true;
+        expect(editor.isDirty).toBe(true);
       });
 
       it('should not be set if not focused', () => {
         editor.source = new ObservableJSON();
         Widget.attach(editor, document.body);
-        expect(editor.isDirty).to.be.false;
+        expect(editor.isDirty).toBe(false);
         editor.source.set('foo', 1);
-        expect(editor.isDirty).to.be.false;
+        expect(editor.isDirty).toBe(false);
       });
     });
 
     describe('model.value.changed', () => {
       it('should add the error flag if invalid JSON', () => {
         editor.model.value.text = 'foo';
-        expect(editor.hasClass('jp-mod-error')).to.be.true;
+        expect(editor.hasClass('jp-mod-error')).toBe(true);
       });
 
       it('should show the commit button if the value has changed', () => {
         editor.model.value.text = '{"foo": 2}';
         editor.model.value.text = '{"foo": 1}';
-        expect(editor.commitButtonNode.hidden).to.be.false;
+        expect(editor.commitButtonNode.hidden).toBe(false);
       });
 
       it('should not show the commit button if the value is invalid', () => {
         editor.model.value.text = 'foo';
-        expect(editor.commitButtonNode.hidden).to.be.true;
+        expect(editor.commitButtonNode.hidden).toBe(true);
       });
 
       it('should show the revert button if the value has changed', () => {
         editor.model.value.text = 'foo';
-        expect(editor.revertButtonNode.hidden).to.be.false;
+        expect(editor.revertButtonNode.hidden).toBe(false);
       });
     });
 
@@ -176,7 +177,7 @@ describe('codeeditor', () => {
         it('should handle blur events on the host node', () => {
           editor.editor.focus();
           simulate(editor.editorHostNode, 'blur');
-          expect(editor.events).to.contain('blur');
+          expect(editor.events).toEqual(expect.arrayContaining(['blur']));
         });
 
         it('should revert to current data if there was no change', () => {
@@ -184,9 +185,9 @@ describe('codeeditor', () => {
           editor.editor.focus();
           editor.source.set('foo', 1);
           const model = editor.model;
-          expect(model.value.text).to.equal('{}');
+          expect(model.value.text).toBe('{}');
           simulate(editor.editorHostNode, 'blur');
-          expect(model.value.text).to.equal('{\n    "foo": 1\n}');
+          expect(model.value.text).toBe('{\n    "foo": 1\n}');
         });
 
         it('should not revert to current data if there was a change', () => {
@@ -194,25 +195,25 @@ describe('codeeditor', () => {
           editor.model.value.text = 'foo';
           editor.source.set('foo', 1);
           const model = editor.model;
-          expect(model.value.text).to.equal('foo');
+          expect(model.value.text).toBe('foo');
           simulate(editor.editorHostNode, 'blur');
-          expect(model.value.text).to.equal('foo');
-          expect(editor.commitButtonNode.hidden).to.be.true;
-          expect(editor.revertButtonNode.hidden).to.be.false;
+          expect(model.value.text).toBe('foo');
+          expect(editor.commitButtonNode.hidden).toBe(true);
+          expect(editor.revertButtonNode.hidden).toBe(false);
         });
       });
 
       describe('click', () => {
         it('should handle click events on the revert button', () => {
           simulate(editor.revertButtonNode, 'click');
-          expect(editor.events).to.contain('click');
+          expect(editor.events).toEqual(expect.arrayContaining(['click']));
         });
 
         it('should revert the current data', () => {
           editor.source = new ObservableJSON();
           editor.model.value.text = 'foo';
           simulate(editor.revertButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('{}');
+          expect(editor.model.value.text).toBe('{}');
         });
 
         it('should handle programmatic changes', () => {
@@ -220,12 +221,12 @@ describe('codeeditor', () => {
           editor.model.value.text = 'foo';
           editor.source.set('foo', 1);
           simulate(editor.revertButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('{\n    "foo": 1\n}');
+          expect(editor.model.value.text).toBe('{\n    "foo": 1\n}');
         });
 
         it('should handle click events on the commit button', () => {
           simulate(editor.commitButtonNode, 'click');
-          expect(editor.events).to.contain('click');
+          expect(editor.events).toEqual(expect.arrayContaining(['click']));
         });
 
         it('should bail if it is not valid JSON', () => {
@@ -233,7 +234,7 @@ describe('codeeditor', () => {
           editor.model.value.text = 'foo';
           editor.source.set('foo', 1);
           simulate(editor.commitButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('foo');
+          expect(editor.model.value.text).toBe('foo');
         });
 
         it('should override a key that was set programmatically', () => {
@@ -241,7 +242,7 @@ describe('codeeditor', () => {
           editor.model.value.text = '{"foo": 2}';
           editor.source.set('foo', 1);
           simulate(editor.commitButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('{\n    "foo": 2\n}');
+          expect(editor.model.value.text).toBe('{\n    "foo": 2\n}');
         });
 
         it('should allow a programmatic key to update', () => {
@@ -252,7 +253,7 @@ describe('codeeditor', () => {
           editor.source.set('foo', 2);
           simulate(editor.commitButtonNode, 'click');
           const expected = '{\n    "foo": 2,\n    "bar": 2\n}';
-          expect(editor.model.value.text).to.equal(expected);
+          expect(editor.model.value.text).toBe(expected);
         });
 
         it('should allow a key to be added by the user', () => {
@@ -263,7 +264,7 @@ describe('codeeditor', () => {
           editor.source.set('foo', 2);
           simulate(editor.commitButtonNode, 'click');
           const value = '{\n    "foo": 2,\n    "bar": 2,\n    "baz": 3\n}';
-          expect(editor.model.value.text).to.equal(value);
+          expect(editor.model.value.text).toBe(value);
         });
 
         it('should allow a key to be removed by the user', () => {
@@ -272,7 +273,7 @@ describe('codeeditor', () => {
           editor.source.set('bar', 1);
           editor.model.value.text = '{"foo": 1}';
           simulate(editor.commitButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('{\n    "foo": 1\n}');
+          expect(editor.model.value.text).toBe('{\n    "foo": 1\n}');
         });
 
         it('should allow a key to be removed programmatically that was not set by the user', () => {
@@ -282,7 +283,7 @@ describe('codeeditor', () => {
           editor.model.value.text = '{"foo": 1, "bar": 3}';
           editor.source.delete('foo');
           simulate(editor.commitButtonNode, 'click');
-          expect(editor.model.value.text).to.equal('{\n    "bar": 3\n}');
+          expect(editor.model.value.text).toBe('{\n    "bar": 3\n}');
         });
 
         it('should keep a key that was removed programmatically that was changed by the user', () => {
@@ -293,7 +294,7 @@ describe('codeeditor', () => {
           editor.source.set('foo', null);
           simulate(editor.commitButtonNode, 'click');
           const expected = '{\n    "foo": 2,\n    "bar": 3\n}';
-          expect(editor.model.value.text).to.equal(expected);
+          expect(editor.model.value.text).toBe(expected);
         });
       });
     });
@@ -301,12 +302,14 @@ describe('codeeditor', () => {
     describe('#onAfterAttach()', () => {
       it('should add event listeners', () => {
         Widget.attach(editor, document.body);
-        expect(editor.methods).to.contain('onAfterAttach');
+        expect(editor.methods).toEqual(
+          expect.arrayContaining(['onAfterAttach'])
+        );
         editor.editor.focus();
         simulate(editor.editorHostNode, 'blur');
         simulate(editor.revertButtonNode, 'click');
         simulate(editor.commitButtonNode, 'click');
-        expect(editor.events).to.eql(['blur', 'click', 'click']);
+        expect(editor.events).toEqual(['blur', 'click', 'click']);
       });
     });
 
@@ -316,7 +319,9 @@ describe('codeeditor', () => {
         Widget.attach(editor, document.body);
         editor.show();
         await framePromise();
-        expect(editor.methods).to.contain('onUpdateRequest');
+        expect(editor.methods).toEqual(
+          expect.arrayContaining(['onUpdateRequest'])
+        );
       });
     });
 
@@ -324,12 +329,14 @@ describe('codeeditor', () => {
       it('should remove event listeners', () => {
         Widget.attach(editor, document.body);
         Widget.detach(editor);
-        expect(editor.methods).to.contain('onBeforeDetach');
+        expect(editor.methods).toEqual(
+          expect.arrayContaining(['onBeforeDetach'])
+        );
         editor.editor.focus();
         simulate(editor.editorHostNode, 'blur');
         simulate(editor.revertButtonNode, 'click');
         simulate(editor.commitButtonNode, 'click');
-        expect(editor.events).to.eql([]);
+        expect(editor.events).toEqual([]);
       });
     });
 
@@ -337,7 +344,7 @@ describe('codeeditor', () => {
       it('should update the value', () => {
         editor.source = new ObservableJSON();
         editor.source.set('foo', 1);
-        expect(editor.model.value.text).to.equal('{\n    "foo": 1\n}');
+        expect(editor.model.value.text).toBe('{\n    "foo": 1\n}');
       });
 
       it('should bail if the input is dirty', () => {
@@ -345,7 +352,7 @@ describe('codeeditor', () => {
         editor.source = new ObservableJSON();
         editor.model.value.text = 'ha';
         editor.source.set('foo', 2);
-        expect(editor.model.value.text).to.equal('ha');
+        expect(editor.model.value.text).toBe('ha');
       });
 
       it('should bail if the input is focused', () => {
@@ -354,7 +361,7 @@ describe('codeeditor', () => {
         editor.source = new ObservableJSON();
         editor.editor.focus();
         editor.source.set('foo', 2);
-        expect(editor.model.value.text).to.equal('{}');
+        expect(editor.model.value.text).toBe('{}');
       });
     });
   });

+ 24 - 23
tests/test-codeeditor/src/widget.spec.ts → packages/codeeditor/test/widget.spec.ts

@@ -1,7 +1,6 @@
 // Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
 
-import { expect } from 'chai';
+import 'jest';
 
 import { Message, MessageLoop } from '@lumino/messaging';
 
@@ -82,41 +81,41 @@ describe('CodeEditorWrapper', () => {
 
   describe('#constructor()', () => {
     it('should be a CodeEditorWrapper', () => {
-      expect(widget).to.be.an.instanceof(CodeEditorWrapper);
+      expect(widget).toBeInstanceOf(CodeEditorWrapper);
     });
 
     it('should add a focus listener', () => {
       widget.node.tabIndex = -1;
       simulate(widget.node, 'focus');
       const editor = widget.editor as LogEditor;
-      expect(editor.events).to.contain('focus');
+      expect(editor.events).toEqual(expect.arrayContaining(['focus']));
     });
   });
 
   describe('#editor', () => {
     it('should be a a code editor', () => {
-      expect(widget.editor.getOption('lineNumbers')).to.be.false;
+      expect(widget.editor.getOption('lineNumbers')).toBe(false);
     });
   });
 
   describe('#dispose()', () => {
     it('should dispose of the resources used by the widget', () => {
-      expect(widget.isDisposed).to.be.false;
+      expect(widget.isDisposed).toBe(false);
       widget.dispose();
-      expect(widget.isDisposed).to.be.true;
+      expect(widget.isDisposed).toBe(true);
       widget.dispose();
-      expect(widget.isDisposed).to.be.true;
+      expect(widget.isDisposed).toBe(true);
     });
 
     it('should remove the focus listener', () => {
       const editor = widget.editor as LogEditor;
-      expect(editor.isDisposed).to.be.false;
+      expect(editor.isDisposed).toBe(false);
       widget.dispose();
-      expect(editor.isDisposed).to.be.true;
+      expect(editor.isDisposed).toBe(true);
 
       widget.node.tabIndex = -1;
       simulate(widget.node, 'focus');
-      expect(editor.events).to.not.contain('focus');
+      expect(editor.events).toEqual(expect.not.arrayContaining(['focus']));
     });
   });
 
@@ -127,7 +126,7 @@ describe('CodeEditorWrapper', () => {
         const editor = widget.editor as LogEditor;
         editor.methods = [];
         simulate(editor.editor.getInputField(), 'focus');
-        expect(editor.methods).to.eql([]);
+        expect(editor.methods).toEqual([]);
       });
 
       it('should refresh if editor was resized', () => {
@@ -136,7 +135,7 @@ describe('CodeEditorWrapper', () => {
         MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);
         editor.methods = [];
         simulate(editor.editor.getInputField(), 'focus');
-        expect(editor.methods).to.deep.equal(['refresh']);
+        expect(editor.methods).toEqual(['refresh']);
       });
     });
   });
@@ -145,8 +144,10 @@ describe('CodeEditorWrapper', () => {
     it('should focus the editor', () => {
       Widget.attach(widget, document.body);
       MessageLoop.sendMessage(widget, Widget.Msg.ActivateRequest);
-      expect(widget.methods).to.contain('onActivateRequest');
-      expect(widget.editor.hasFocus()).to.be.true;
+      expect(widget.methods).toEqual(
+        expect.arrayContaining(['onActivateRequest'])
+      );
+      expect(widget.editor.hasFocus()).toBe(true);
     });
   });
 
@@ -155,7 +156,7 @@ describe('CodeEditorWrapper', () => {
       Widget.attach(widget, document.body);
       const editor = widget.editor as LogEditor;
       await framePromise();
-      expect(editor.methods).to.contain('refresh');
+      expect(editor.methods).toEqual(expect.arrayContaining(['refresh']));
     });
   });
 
@@ -164,11 +165,11 @@ describe('CodeEditorWrapper', () => {
       widget.hide();
       Widget.attach(widget, document.body);
       const editor = widget.editor as LogEditor;
-      expect(editor.methods).to.not.contain('refresh');
+      expect(editor.methods).toEqual(expect.not.arrayContaining(['refresh']));
       widget.show();
-      expect(widget.methods).to.contain('onAfterShow');
+      expect(widget.methods).toEqual(expect.arrayContaining(['onAfterShow']));
       await framePromise();
-      expect(editor.methods).to.contain('refresh');
+      expect(editor.methods).toEqual(expect.arrayContaining(['refresh']));
     });
   });
 
@@ -177,7 +178,7 @@ describe('CodeEditorWrapper', () => {
       const msg = new Widget.ResizeMessage(10, 10);
       const editor = widget.editor as LogEditor;
       MessageLoop.sendMessage(widget, msg);
-      expect(editor.methods).to.contain('setSize');
+      expect(editor.methods).toEqual(expect.arrayContaining(['setSize']));
     });
 
     it('should refresh the editor', () => {
@@ -186,7 +187,7 @@ describe('CodeEditorWrapper', () => {
       editor.focus();
       editor.methods = [];
       MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);
-      expect(editor.methods).to.contain('refresh');
+      expect(editor.methods).toEqual(expect.arrayContaining(['refresh']));
     });
 
     it('should defer the refresh until focused', () => {
@@ -194,9 +195,9 @@ describe('CodeEditorWrapper', () => {
       Widget.attach(widget, document.body);
       editor.methods = [];
       MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);
-      expect(editor.methods).to.eql([]);
+      expect(editor.methods).toEqual([]);
       simulate(editor.editor.getInputField(), 'focus');
-      expect(editor.methods).to.eql(['refresh']);
+      expect(editor.methods).toEqual(['refresh']);
     });
   });
 });

+ 33 - 0
packages/codeeditor/tsconfig.test.json

@@ -0,0 +1,33 @@
+{
+  "extends": "../../tsconfigbase.test",
+  "include": ["src/*", "test/*"],
+  "references": [
+    {
+      "path": "../coreutils"
+    },
+    {
+      "path": "../nbformat"
+    },
+    {
+      "path": "../observables"
+    },
+    {
+      "path": "../ui-components"
+    },
+    {
+      "path": "../../testutils"
+    },
+    {
+      "path": "../coreutils"
+    },
+    {
+      "path": "../nbformat"
+    },
+    {
+      "path": "../observables"
+    },
+    {
+      "path": "../ui-components"
+    }
+  ]
+}

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

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

+ 0 - 33
tests/test-codeeditor/package.json

@@ -1,33 +0,0 @@
-{
-  "name": "@jupyterlab/test-codeeditor",
-  "version": "2.1.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/codeeditor": "^2.1.0",
-    "@jupyterlab/codemirror": "^2.1.0",
-    "@jupyterlab/observables": "^3.1.0",
-    "@jupyterlab/testutils": "^2.1.0",
-    "@lumino/messaging": "^1.3.3",
-    "@lumino/widgets": "^1.11.1",
-    "chai": "^4.2.0",
-    "jest": "^25.2.3",
-    "jest-junit": "^10.0.0",
-    "simulate-event": "~1.4.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-codeeditor/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 - 24
tests/test-codeeditor/tsconfig.json

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