Stryker: Error when run stryker with MochaTestRunner - ReferenceError: ready is not defined

Created on 25 Nov 2019  ยท  16Comments  ยท  Source: stryker-mutator/stryker

Summary

Error when trying to running stryker. The test try to execute but failed quickly with the error:

19:46:40 (90212) DEBUG MochaTestRunner Starting Mocha test run
undefined:4
return (ready);
^

ReferenceError: ready is not defined
    at eval (eval at deserialize (/home/jess/Projects/work/undefined/backend/gupy-api-darthvader/node_modules/surrial/src/index.js:17:18), <anonymous>:4:1)
    at Object.deserialize (/home/jess/Projects/work/undefined/backend/gupy-api-darthvader/node_modules/surrial/src/index.js:18:19)
    at ChildProcess.worker.on (/home/jess/Projects/work/undefined/backend/gupy-api-darthvader/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxy.js:123:43)
    at ChildProcess.emit (events.js:182:13)
    at emit (internal/child_process.js:812:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Stryker config

module.exports = function(config){
  config.set({
    mutator: 'javascript',
    mutate: ['./components/**/*.test.js'],
    packageManager: 'npm',
    reporters: ['clear-text', 'progress'],
    testRunner: 'mocha',
    testFramework: 'mocha',
    coverageAnalysis: 'off',
    mochaOptions: {
      spec: ['./components/**/*.test.js'],
      opts: './test/mocha.opts',
    },
  });
}

Test runner config

Mocha.opts

--timeout=50000
--reporter=progress
--require ts-node/register
--require ./test/MochaBootstrap.js
--require ./test/mocha.env.js
--exit

Stryker environment

โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected]
โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected] deduped
โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ””โ”€โ”€ @stryker-mutator/[email protected] deduped
โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected] deduped
โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected] deduped
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected] deduped

+-- [email protected]

Test runner environment

# Test command
"NODE_ENV=${NODE_ENV:=test} mocha 'components/**/*.test.js'"

Mocha.opts

--timeout=50000
--reporter=progress
--require ts-node/register
--require ./test/MochaBootstrap.js
--require ./test/mocha.env.js
--exit

Your Environment

| software | version(s)
| ---------------- | -------
| node | 10.14.1
| npm | 6.4.1
| Operating System | Linux

Add stryker.log


๐Ÿ› Bug

All 16 comments

Reproduction project would increase your chances of others reproducing and possibly fixing your issue.

I would also recommend you consider trying the command test runner. I have had better luck with the command test runner in quite a few cases.

Totally agree with Brody. The issue is probably caused that mocha opts are not read correctly. If you can provide some reproduction of it, we could debug it faster.

@kmdrGroch e @brodybits How I can provide some reproduction? I really don't know how to do this. :disappointed:

If your project isn't private, you could provide link to it. If it's private, try writing similar app (just smaller one, but with the same configuration)

Okay @kmdrGroch . My project it's private.
I need to write a similar application? :open_mouth:
When you say similar it's the features or structure?

Structure. I just need the same configuration. I really don't care about features / your code. It normally doesn't brake anything :)

The easiest thing is to remove all files from your SRC and TEST folder, provide some simple one source file and test file.

Okay @kmdrGroch . I'll try this and share the repository as soon as possible.

Hello, I come back. ;)

I create an example repo: https://github.com/jtlimo/stryker-example
but doesn't throw any error :/

In real life project, I receive some warnings that I guess is the problem.

16:56:19 (31931) TRACE ChildProcessProxy WARNING: NODE_ENV value of 'test' did not match any deployment config file names.
16:56:19 (31931) TRACE ChildProcessProxy WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode

at eval (eval at deserialize (/home/jlima/Documentos/Projects/undefined/backend/gupy-api-darthvader/node_modules/surrial/src/index.js:17:18), :4:1)

is a stricted but the warnings says my code doesnt runs stricted code? confused

Hello @kmdrGroch some idea why this error occur?

If need more information, I will try to find out a way to put here

They are just warnings... They shouldn't make anything fail. Please provide more data or failing code

OK @kmdrGroch I'll try to reproduce the error on example repository, but it's difficult to reproduce.

Without finding the exact error it's hard to fix it :<

Does this error still occur?

@kmdrGroch for now this error is not occur, but I issued this new error:

https://github.com/stryker-mutator/stryker/issues/2185

Hi! I'm closing this issue for now. We'll continue in #2185

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Djaler picture Djaler  ยท  20Comments

nosideeffects picture nosideeffects  ยท  32Comments

trollepierre picture trollepierre  ยท  18Comments

anthony-telljohann picture anthony-telljohann  ยท  19Comments

Lakitna picture Lakitna  ยท  42Comments