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

fix(instrumenter): support anonymous function names #2388

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

nicojs
Copy link
Member

@nicojs nicojs commented Aug 17, 2020

Do a best-effort attempt to minimize side effects from instrumentation by maintaining the fn.name property when placing mutants in code.

Instrument these:

const foo = function () { }
const bar = () => {}
const Baz = class { }
const foo = { bar: function () { } }

Like this:

const foo = true? function foo () { }: ...;
const bar = true? (() => { const bar = () =>{}; return bar } {})() : ...;
const Baz = true? class Baz { } : ...;
const foo = true? function bar() {}

Fixes #2362

Do a best effort to maintain the `fn.name` property the same when placing mutants in code.

Instrument these:

```ts
const foo = function () { }
const bar = () => {}
const Baz = class { }
```

Like this:

```ts
const foo = true? function foo () { }: ...;
const bar = true? (() => { const bar = () =>{}; return bar } {})() : ...;
const Baz = true? class Baz { } : ...;
```
@nicojs nicojs merged commit c7d150a into epic/mutation-switching Aug 17, 2020
@simondel simondel deleted the fix/support-function-names branch September 28, 2020 12:21
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.

Stryker v4 Instrumentor breaks enzyme snapshots
1 participant