Skip to content

call() scope does not override imported symbols #116

@huafu

Description

@huafu

I've wrote a Typescript transformer for ucode as well as typings so that one can write ucode code with strict typings. I've also wrote a test library with spies and stubs so that ucode projects can have unit tests also written in Typescript. it's going to be on my public Github once ready (or at least when in a more advanced stage).
For the spies and stubs, I'm using the call function which is pretty handy. Tho there is one blocking issue:

// my_lib.uc
import { to_stub } from './other_lib.uc';

function fn_to_test() {
  // ...
  to_stub("hello");
  // ...
}

export { fn_to_test };
// my_lib.spec.uc
call(fn_to_test, { to_stub: () => null });

here I was expecting fn_to_test to use the dummy () => null when calling to_stub instead of the one imported from my_lib.uc.
I guess it's the normal behavior, tho it'd be nice if the scope given to call() could override imported symbols as well as globals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions