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

Init error with TypeScript #3547

Closed
lucassouthern opened this issue Dec 22, 2022 · 0 comments · Fixed by #3548 or codeceptjs/ui#219
Closed

Init error with TypeScript #3547

lucassouthern opened this issue Dec 22, 2022 · 0 comments · Fixed by #3548 or codeceptjs/ui#219

Comments

@lucassouthern
Copy link

lucassouthern commented Dec 22, 2022

What are you trying to achieve?

Running npm run codeceptjs:ui with my typescript setup.

What do you get instead?

lucas-20u2s4lj00:[lucas]:~/Dropbox/Programming/SouthernCode/spring-e2e$ npx create-codeceptjs .
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y


 ╔═╗ ╦═╗ ╔═╗ ╔═╗ ╔╦╗ ╔═╗ 
 ║   ╠╦╝ ║╣  ╠═╣  ║  ║╣  
 ╚═╝ ╩╚═ ╚═╝ ╩ ╩  ╩  ╚═╝ 

 ╔═╗ ╔═╗ ╔╦╗ ╔═╗ ╔═╗ ╔═╗ ╔═╗ ╔╦╗  ╦ ╔═╗ 
 ║   ║ ║  ║║ ║╣  ║   ║╣  ╠═╝  ║   ║ ╚═╗ 
 ╚═╝ ╚═╝ ═╩╝ ╚═╝ ╚═╝ ╚═╝ ╩    ╩  ╚╝ ╚═╝ 


 🔌 Supercharged End 2 End Testing 🌟

Creating CodeceptJS project in /home/my_dir

Powered by Playwright engine
package.json file does not exist in current dir, creating it...
Installing packages:  codeceptjs@3, @codeceptjs/ui, @codeceptjs/examples, @codeceptjs/configure, playwright@1

added 466 packages, and audited 467 packages in 40s

80 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (3 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
Finished installing packages.

What's next?

Try CodeceptJS now with a demo project:
➕ npm run codeceptjs:demo - executes codeceptjs tests for a demo project
➕ npm run codeceptjs:demo:headless - executes codeceptjs tests headlessly (no window shown)
➕ npm run codeceptjs:demo:ui - starts codeceptjs UI application for a demo project

Initialize CodeceptJS for your project:
🔨 npx codeceptjs init - initialize codeceptjs for current project (required)
➕ npm run codeceptjs - runs codeceptjs tests for current project
➕ npm run codeceptjs:headless - executes codeceptjs tests headlessly (no window shown)
➕ npm run codeceptjs:ui - starts codeceptjs UI application for current project

lucas-20u2s4lj00:[lucas]:~/Dropbox/Programming/SouthernCode/spring-e2e$  npx codeceptjs init

  Welcome to CodeceptJS initialization tool
  It will prepare and configure a test environment for you

 Useful links:

  👉 How to start testing ASAP: https://codecept.io/quickstart/#init
  👉 How to select helper: https://codecept.io/basics/#architecture
  👉 TypeScript setup: https://codecept.io/typescript/#getting-started

Installing to /home/my_dir
? Do you plan to write tests in TypeScript? Yes
? Where are your tests located? ./*_test.ts
? What helpers do you want to use? Playwright
? Where should logs, screenshots, and reports to be stored? ./output
? Would you prefer to use promise-based typings for all I.* commands? http://bit.ly/3XI
Mq6n Yes
? Do you want to enable localization for tests? http://bit.ly/3GNUBbh English (no local
ization)
Configure helpers...
? [Playwright] Base url of site to be tested https://teespring.com/
? [Playwright] Show browser window Yes
? [Playwright] Browser in which testing will be performed. Possible options: chromium, 
firefox, webkit or electron chromium

Steps file created at ./steps_file.ts
Config created at /home/my_dir/codecept.conf.ts
Directory for temporary output files created at './output'
Installing packages:  typescript, ts-node, @types/node

added 18 packages, changed 1 package, and audited 485 packages in 3s

80 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (3 moderate, 5 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
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) login
? Filename of a test login_test.ts

Test for login_test.ts was created in /home/my_dir/login_test.ts

--
CodeceptJS Installed! Enjoy supercharged testing! 🤩
Find more information at https://codecept.io

lucas-20u2s4lj00:[lucas]:~/Dropbox/Programming/SouthernCode/spring-e2e$ npm run codeceptjs

> [email protected] codeceptjs
> codeceptjs run --steps

CodeceptJS v3.3.7 #StandWithUkraine
Using test root "/home/my_dir"

login --
  test something
  ✔ OK in 53ms


  OK  | 1 passed   // 615ms
lucas-20u2s4lj00:[lucas]:~/Dropbox/Programming/SouthernCode/spring-e2e$ npm run codeceptjs:ui

> [email protected] codeceptjs:ui
> codecept-ui --app

/home/my_dir/node_modules/codeceptjs/lib/config.js:82
      throw new Error(`Config file ${configFile} does not exist. Execute 'codeceptjs init' to create config`);
            ^

Error: Config file /home/my_dir/codecept.conf.js does not exist. Execute 'codeceptjs init' to create config
    at Function.load (/home/my_dir/node_modules/codeceptjs/lib/config.js:82:13)
    at CodeceptjsFactory.create (/home/my_dir/node_modules/@codeceptjs/ui/lib/model/codeceptjs-factory.js:73:12)
    at Object.<anonymous> (/home/my_dir/node_modules/@codeceptjs/ui/bin/codecept-ui.js:22:19)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Provide test source code if related

// paste test

Details

  • CodeceptJS version: 3.3.7
  • NodeJS Version: 16.17.1
  • Operating System: Artix Linux S6 (Arch)
  • Configuration file:
import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure';
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

export const config: CodeceptJS.MainConfig = {
  tests: './tests/*_test.ts',
  output: './tests/output',
  helpers: {
    Playwright: {
      url: 'http://localhost',
      show: true,
      browser: 'chromium'
    }
  },
  include: {
    I: './steps_file'
  },
  name: 'spring-e2e',
  fullPromiseBased: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant