Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed running automated and manual tests written in TS #773

Closed
wants to merge 2 commits into from

Conversation

oleq
Copy link
Member

@oleq oleq commented Jun 7, 2022

Suggested merge commit message (convention)

Feature (tests): Allowed running automated and manual tests written in TS. Closes ckeditor/ckeditor5#11888.

@oleq oleq changed the base branch from master to ck/11717-ts-in-manual-tests June 7, 2022 10:30
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 88.626% when pulling 5915dbf on ck/11888-tests-in-ts into 0234336 on ck/11717-ts-in-manual-tests.

@pomek
Copy link
Member

pomek commented Jun 7, 2022

While I didn't have any issues running manual tests, I could not figure out how to enable automated tests.

Please, take a look at the attached errors:

ERROR in ./packages/ckeditor5-utils/tests/dom/iswindow.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts.
    at makeSourceMapAndFinish (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/ts-loader/dist/index.js:52:18)
    at successLoader (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/ts-loader/dist/index.js:39:5)
    at Object.loader (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/ts-loader/dist/index.js:22:5)
 @ ./build/.automated-tests/entry-point.js 2:0-97

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
14:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(14,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
15:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(15,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
16:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(16,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
17:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(17,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
18:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(18,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
19:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(19,3)
      TS2304: Cannot find name 'expect'.

ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts
29:2-8
[tsl] ERROR in /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-utils/tests/dom/iswindow.ts(29,3)
      TS2304: Cannot find name 'expect'.

I've tried to import @types/mocha in the generated entry-point file and directly in the test. Unfortunately, with no luck. Updating the tsconfig.json file with types: [ ... ] didn't help too.

Would you like to share any tips that might resolve my issues?

@pomek
Copy link
Member

pomek commented Jun 7, 2022

In CKEditor 5 I was using the #ck/epic/11708-migrate-typescript-mvp branch.

@oleq
Copy link
Member Author

oleq commented Jun 8, 2022

Just to be clear, you just renamed the automated test iswindow.js to iswindow.ts

If so, this is OK that mocha does not work yet. In this PR I wanted to unblock further work but I didn't spend time on the framework (mocha, sinon, etc.). We'll cover this in the future but for now it is enough that the runner considers .ts files.

Base automatically changed from ck/11717-ts-in-manual-tests to master June 8, 2022 09:42
@pomek
Copy link
Member

pomek commented Aug 22, 2022

When compiling a manual test, tsc prints unrelated errors. It should not process automated tests.

image

@oleq
Copy link
Member Author

oleq commented Aug 24, 2022

🤔 This PR enables things on the webpack level. Bringing TS support for chai (and sinon, and... other libs) is another thing. But maybe you're right, maybe this PR got too broad at some wildcard.

@pomek
Copy link
Member

pomek commented Jun 5, 2023

Closing in favor of #886.

@pomek pomek closed this Jun 5, 2023
@pomek pomek deleted the ck/11888-tests-in-ts branch June 5, 2023 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TS] Allow running tests written in TS (automated, manual)
3 participants