Skip to content

CodeceptJS 4.x - Path aliases are not handled properly by the codeceptjs engine #5361

@nlespiaucq

Description

@nlespiaucq

🚩 [4.0.1-beta.23]

Due to multiple teams, we're using som aliases to avoid long import path and handle more easily scope changes.
Aliases work with both ts-node and tsx; moreover it used to work with codeceptjs x ts-node.
But for some reason, it doesn't work with codeceptjs x tsx - I guess there may be a limitation (?) on the internal transpiler.

How to reproduce:

n.lespiaucq@JXQ1VH4T69 examples-ts % npx tsx test.ts
todoMvcUrl: https://todomvc.com/examples/react/dist/

n.lespiaucq@JXQ1VH4T69 examples-ts % npx codeceptjs run
ts-node package is required to parse codecept.conf.ts config correctly
CodeceptJS v3.7.5 #StandWithUkraine
Using test root "/Users/n.lespiaucq/Documents/xxx/examples-ts"

Create Todos with BDD --
✖ Create a single todo item @bdd in 40ms

-- FAILURES:

  1. Create Todos with BDD
    Create a single todo item @bdd:

Could not include object undefined from module '/Users/n.lespiaucq/Documents/xxx/examples-ts/todomvc-tests/pages/todos.page.ts'
Unexpected token ':'
SyntaxError: Unexpected token ':'
at compileSourceTextModule (node:internal/modules/esm/utils:346:16)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:316:18)
...
Error: Could not include object undefined from module '/Users/n.lespiaucq/Documents/xxx/examples-ts/todomvc-tests/pages/todos.page.ts'
Unexpected token ':'
SyntaxError: Unexpected token ':'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions