From 50b8e57f68f624dd9f8d09f670fea7cdf90e4e0f Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Wed, 12 May 2021 09:54:28 -0400 Subject: [PATCH 1/8] Get tests to work This commit introduces a Git submodule to the repo --- .gitmodules | 3 +++ ckeditor5 | 1 + package.json | 6 ++++-- tests/automath.js | 2 +- tests/math.js | 2 +- tests/mathui.js | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .gitmodules create mode 160000 ckeditor5 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b192fa8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ckeditor5"] + path = ckeditor5 + url = https://github.com/ckeditor/ckeditor5 diff --git a/ckeditor5 b/ckeditor5 new file mode 160000 index 0000000..dbc9133 --- /dev/null +++ b/ckeditor5 @@ -0,0 +1 @@ +Subproject commit dbc91339cb30e6ced2f008ac586f5806e85a780c diff --git a/package.json b/package.json index f2db2a3..2298105 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "devDependencies": { "@ckeditor/ckeditor5-basic-styles": "^27.1.0", "@ckeditor/ckeditor5-dev-tests": "^24.4.2", + "@ckeditor/ckeditor5-dev-webpack-plugin": "^24.4.2", "@ckeditor/ckeditor5-editor-inline": "^27.1.0", "@ckeditor/ckeditor5-essentials": "^27.1.0", "@ckeditor/ckeditor5-paragraph": "^27.1.0", @@ -32,12 +33,13 @@ "eslint-config-ckeditor5": "^3.1.0", "html-webpack-plugin": "^5.3.1", "husky": "^4.2.5", + "karma-webpack": "^4.0.2", "lint-staged": "^10.2.6", "mini-css-extract-plugin": "^1.6.0", "raw-loader": "^4.0.2", "stylelint": "^13.5.0", "stylelint-config-ckeditor5": "^2.0.1", - "webpack": "^5.36.2", + "webpack": "^4.43.0", "webpack-cli": "^4.6.0", "webpack-dev-server": "^3.11.2" }, @@ -61,7 +63,7 @@ "lint": "eslint --quiet src/**/*.js", "lint:fix": "eslint --quiet src/**/*.js --fix", "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'", - "test": "node node_modules/@ckeditor/ckeditor5-dev-tests/bin/test.js", + "test": "node node_modules/.bin/ckeditor5-dev-tests --files=ckeditor5", "start": "node node_modules/.bin/webpack serve --mode development" }, "lint-staged": { diff --git a/tests/automath.js b/tests/automath.js index dde6357..ea2ed16 100644 --- a/tests/automath.js +++ b/tests/automath.js @@ -1,6 +1,6 @@ import Mathematics from '../src/math'; import AutoMath from '../src/automath'; -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; +import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import Undo from '@ckeditor/ckeditor5-undo/src/undo'; diff --git a/tests/math.js b/tests/math.js index 83da62b..866d3dd 100644 --- a/tests/math.js +++ b/tests/math.js @@ -1,4 +1,4 @@ -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; +import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; import Mathematics from '../src/math'; import MathEditing from '../src/mathediting'; import MathUI from '../src/mathui'; diff --git a/tests/mathui.js b/tests/mathui.js index 97de3be..8666d70 100644 --- a/tests/mathui.js +++ b/tests/mathui.js @@ -1,7 +1,7 @@ /* globals document, Event */ -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; -import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; +import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; +import testUtils from '../ckeditor5/packages/ckeditor5-core/tests/_utils/utils'; import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; From 6e462817946f27f3594ee077137afdb867f22b22 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Wed, 12 May 2021 10:27:41 -0400 Subject: [PATCH 2/8] Fix dev server --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2298105..4f58ea4 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "@ckeditor/ckeditor5-essentials": "^27.1.0", "@ckeditor/ckeditor5-paragraph": "^27.1.0", "@ckeditor/ckeditor5-theme-lark": "^27.1.0", - "css-loader": "^5.2.4", + "css-loader": "4", "eslint": "^7.1.0", "eslint-config-ckeditor5": "^3.1.0", - "html-webpack-plugin": "^5.3.1", + "html-webpack-plugin": "4", "husky": "^4.2.5", "karma-webpack": "^4.0.2", "lint-staged": "^10.2.6", From ff183c60fd496fcc49c0176e8c86b69c9dd2bd8c Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Wed, 12 May 2021 13:15:10 -0400 Subject: [PATCH 3/8] Add coverage folder produced by test script to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 08c992e..1d6c3a4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/ package-lock.json yarn.lock public +coverage From e9e58aa7a95e12e3776165aac5239c9c6426e1b6 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sun, 16 May 2021 16:02:47 -0400 Subject: [PATCH 4/8] Add testing instructions to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 8811631..5e5e6b2 100644 --- a/README.md +++ b/README.md @@ -230,3 +230,8 @@ To enter a development loop with hot reload support: - http://localhost:8080 [ckeditor 5 inspector]: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/development-tools.html#ckeditor-5-inspector + +### Tests + +Use `yarn test`, optionally with `--coverage`, `--watch`, or `--source-map`, to run tests. +You will need to have run `git submodule init` and `git submodule update` first. From 3895bf243facbdb3c803ea2a10ae65ad2d28a985 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 21 May 2021 14:41:59 -0400 Subject: [PATCH 5/8] Update submodule documentation to only fetch needed files --- .gitmodules | 2 ++ README.md | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index b192fa8..4694089 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,5 @@ [submodule "ckeditor5"] path = ckeditor5 url = https://github.com/ckeditor/ckeditor5 + update = checkout + shallow = true diff --git a/README.md b/README.md index 5e5e6b2..504a68a 100644 --- a/README.md +++ b/README.md @@ -233,5 +233,17 @@ To enter a development loop with hot reload support: ### Tests -Use `yarn test`, optionally with `--coverage`, `--watch`, or `--source-map`, to run tests. +Run the below commands from the repo root directory to fetch files needed to run tests (you will only need to do this once): + +``` +git submodule deinit ckeditor5 +rm -rf ckeditor5 +git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 +rm -rf .git/modules/ckeditor5 +git submodule absorbgitdirs +git -C ckeditor5 sparse-checkout set 'packages/ckeditor5-core/tests/_utils/**' +git submodule update --init --force --checkout ckeditor5 +``` + +Then, use `yarn test`, optionally with `--coverage`, `--watch`, or `--source-map`, to run tests. You will need to have run `git submodule init` and `git submodule update` first. From c16ced5baf078edede258b84bec9c0116781a3e0 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 21 May 2021 17:12:30 -0400 Subject: [PATCH 6/8] Use `pretest` script to set up submodule instead of manually running commands --- README.md | 14 +------------- package.json | 1 + 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 504a68a..110a0ed 100644 --- a/README.md +++ b/README.md @@ -233,17 +233,5 @@ To enter a development loop with hot reload support: ### Tests -Run the below commands from the repo root directory to fetch files needed to run tests (you will only need to do this once): - -``` -git submodule deinit ckeditor5 -rm -rf ckeditor5 -git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 -rm -rf .git/modules/ckeditor5 -git submodule absorbgitdirs -git -C ckeditor5 sparse-checkout set 'packages/ckeditor5-core/tests/_utils/**' -git submodule update --init --force --checkout ckeditor5 -``` - -Then, use `yarn test`, optionally with `--coverage`, `--watch`, or `--source-map`, to run tests. +To run tests, use `yarn test`, optionally with `--coverage`, `--watch`, or `--source-map`, to run tests. You will need to have run `git submodule init` and `git submodule update` first. diff --git a/package.json b/package.json index 4f58ea4..afdc21d 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "lint": "eslint --quiet src/**/*.js", "lint:fix": "eslint --quiet src/**/*.js --fix", "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'", + "pretest": "bash -c 'if [ ! -e ckeditor5/.git ]; then git submodule deinit ckeditor5 && rm -rf ckeditor5 && git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 && rm -rf .git/modules/ckeditor5 && git submodule absorbgitdirs && git -C ckeditor5 sparse-checkout set packages/ckeditor5-core/tests/_utils && git submodule update --init --force --checkout ckeditor5; fi'", "test": "node node_modules/.bin/ckeditor5-dev-tests --files=ckeditor5", "start": "node node_modules/.bin/webpack serve --mode development" }, From 9f4872e3a88dc926a16cf0b69e7a9769483a19c1 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 21 May 2021 23:57:52 -0400 Subject: [PATCH 7/8] Transition away from submodule for test files --- .gitignore | 1 + .gitmodules | 5 ----- ckeditor5 | 1 - package.json | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .gitmodules delete mode 160000 ckeditor5 diff --git a/.gitignore b/.gitignore index 1d6c3a4..376a272 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ package-lock.json yarn.lock public coverage +ckeditor5/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4694089..0000000 --- a/.gitmodules +++ /dev/null @@ -1,5 +0,0 @@ -[submodule "ckeditor5"] - path = ckeditor5 - url = https://github.com/ckeditor/ckeditor5 - update = checkout - shallow = true diff --git a/ckeditor5 b/ckeditor5 deleted file mode 160000 index dbc9133..0000000 --- a/ckeditor5 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dbc91339cb30e6ced2f008ac586f5806e85a780c diff --git a/package.json b/package.json index afdc21d..6258289 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "lint": "eslint --quiet src/**/*.js", "lint:fix": "eslint --quiet src/**/*.js --fix", "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'", - "pretest": "bash -c 'if [ ! -e ckeditor5/.git ]; then git submodule deinit ckeditor5 && rm -rf ckeditor5 && git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 && rm -rf .git/modules/ckeditor5 && git submodule absorbgitdirs && git -C ckeditor5 sparse-checkout set packages/ckeditor5-core/tests/_utils && git submodule update --init --force --checkout ckeditor5; fi'", + "pretest": "bash -c 'if [ ! -e ckeditor5/.git ]; then git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 && git -C ckeditor5 sparse-checkout set packages/ckeditor5-core/tests/_utils && git -C ckeditor5 checkout master; fi'", "test": "node node_modules/.bin/ckeditor5-dev-tests --files=ckeditor5", "start": "node node_modules/.bin/webpack serve --mode development" }, From b6b028074f2f6c14da1864124030388cd41ae880 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Mon, 24 May 2021 19:04:18 -0400 Subject: [PATCH 8/8] Add symlink in node_modules to make tests work --- .vscode/settings.json | 2 ++ package.json | 2 +- tests/automath.js | 2 +- tests/math.js | 2 +- tests/mathui.js | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/package.json b/package.json index 6258289..37afda9 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "lint": "eslint --quiet src/**/*.js", "lint:fix": "eslint --quiet src/**/*.js --fix", "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'", - "pretest": "bash -c 'if [ ! -e ckeditor5/.git ]; then git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 && git -C ckeditor5 sparse-checkout set packages/ckeditor5-core/tests/_utils && git -C ckeditor5 checkout master; fi'", + "pretest": "bash -c 'if [ ! -e node_modules/@ckeditor/ckeditor5-core/tests/_utils ]; then git clone --no-checkout --depth=1 --filter=blob:none https://github.com/ckeditor/ckeditor5 && git -C ckeditor5 sparse-checkout set packages/ckeditor5-core packages/ckeditor5-core/tests/_utils && git -C ckeditor5 checkout master && ln -sfrT ckeditor5/packages/ckeditor5-core/tests node_modules/@ckeditor/ckeditor5-core/tests ; fi'", "test": "node node_modules/.bin/ckeditor5-dev-tests --files=ckeditor5", "start": "node node_modules/.bin/webpack serve --mode development" }, diff --git a/tests/automath.js b/tests/automath.js index ea2ed16..dde6357 100644 --- a/tests/automath.js +++ b/tests/automath.js @@ -1,6 +1,6 @@ import Mathematics from '../src/math'; import AutoMath from '../src/automath'; -import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import Undo from '@ckeditor/ckeditor5-undo/src/undo'; diff --git a/tests/math.js b/tests/math.js index 866d3dd..83da62b 100644 --- a/tests/math.js +++ b/tests/math.js @@ -1,4 +1,4 @@ -import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import Mathematics from '../src/math'; import MathEditing from '../src/mathediting'; import MathUI from '../src/mathui'; diff --git a/tests/mathui.js b/tests/mathui.js index 8666d70..97de3be 100644 --- a/tests/mathui.js +++ b/tests/mathui.js @@ -1,7 +1,7 @@ /* globals document, Event */ -import ClassicTestEditor from '../ckeditor5/packages/ckeditor5-core/tests/_utils/classictesteditor'; -import testUtils from '../ckeditor5/packages/ckeditor5-core/tests/_utils/utils'; +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; +import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';