CodeceptJS
CodeceptJS copied to clipboard
Feat/init codeceptjs with ts
Motivation/Description of the PR
- This change gives you the possibility to init codeceptjs with typescript
thanh@Thanh-MBP14 automation % npx codeceptjs init
Welcome to CodeceptJS initialization tool
It will prepare and configure a test environment for you
Installing to /Users/thanh/Desktop/automation
? Is your project Typescript? yes
? Where are your tests located? ./*_test.js
? What helpers do you want to use? REST
? Where should logs, screenshots, and reports to be stored? ./output
? Do you want localization for tests? (See https://codecept.io/translation/) English (no localization)
Configure helpers...
? [REST] Endpoint of API you are going to test http://localhost:3000/api
Steps file created at ./steps_file.ts
Config created at /Users/thanh/Desktop/automation/codecept.conf.ts
Directory for temporary output files is already created at './output'
tsconfig.json already exists at /Users/thanh/Desktop/automation/tsconfig.json
jsconfig.json already exists at /Users/thanh/Desktop/automation/jsconfig.json
TypeScript Definitions provide autocompletion in Visual Studio Code and other IDEs
Definitions were generated in steps.d.ts
Almost ready... Next step:
Creating a new test...
----------------------
? Feature which is being tested (ex: account, login, etc)
? Filename of a test _test.js
Test for _test.js was created in /Users/thanh/Desktop/automation/_test.js
--
CodeceptJS Installed! Enjoy supercharged testing! 🤩
Find more information at https://codecept.io
--
Please install dependent packages locally: npm install --save-dev typescript ts-node
Type of change
- [x] :rocket: New functionality
Checklist:
- [x] Lint checking (Run
npm run lint) - [x] Local tests are passed (Run
npm test)
I really like the idea but it should be improved:
Filename of a test _test.js
Tests should be created with
tsextension As well as config should becodecept.conf.ts
Updated as requested.
Not sure why the Run Unit tests / build (12.x) failed, I tried on my local, there is no issue
> [email protected] test:runner
> mocha test/runner --recursive
CodeceptJS Timeouts
✓ should stop test when timeout exceeded (5434ms)
✓ should take --no-timeouts option (6307ms)
✓ should ignore timeouts if no timeout (1301ms)
✓ should use global timeouts if timeout is set (1283ms)
✓ should prefer step timeout (3376ms)
✓ should keep timeout with steps (392ms)
6 passing (18s)
Thanks, @PeterNgTr If you tried it and it works for you I'm merging
Thanks, @PeterNgTr
If you tried it and it works for you I'm merging
Yeah, just gave it a try. Working like a charm.