question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot set property id of #<Test> which has only a getter

See original GitHub issue

What are you trying to achieve?

After initializing a CodeceptJS project, when trying to run the tests, I have an exception (see below)

What do you get instead?

TypeError: Cannot set property id of #<Test> which has only a getter
    at {root}/node_modules/codeceptjs/lib/mochaFactory.js:53:46
    at Array.forEach (<anonymous>)
    at Suite.eachTest ({root}/node_modules/mocha/lib/suite.js:438:14)
    at {root}/node_modules/mocha/lib/suite.js:440:11
    at Array.forEach (<anonymous>)
    at Suite.eachTest ({root}/node_modules/mocha/lib/suite.js:439:15)
    at Mocha.mocha.loadFiles ({root}/node_modules/codeceptjs/lib/mochaFactory.js:53:21)
    at CodeceptjsFactory.reloadSuites ({root}/node_modules/@codeceptjs/ui/lib/model/codeceptjs-factory.js:141:11)
    at Object.reloadSuites ({root}/node_modules/@codeceptjs/ui/lib/model/scenario-repository.js:217:30)
    at module.exports ({root}/node_modules/@codeceptjs/ui/lib/api/list-scenarios.js:9:22)

Details

  • CodeceptJS version: 3.0.0
  • NodeJS Version: 14.3.0
  • Operating System: OSX 10.15.5
  • Configuration file:
const { setHeadlessWhen } = require('@codeceptjs/configure');

// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

exports.config = {
  tests: './tests/*_test.js',
  output: './output',
  helpers: {
    Puppeteer: {
      url: 'http://localhost',
      show: true,
      windowSize: '1200x900'
    }
  },
  include: {
    I: './steps_file.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'hello-codecept',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gianpajcommented, Nov 22, 2020

upgrading from 3.0.0 to 3.0.1, fixed it for me

1reaction
bitcodercommented, Nov 4, 2020

with 3.0.1 it works… maybe the template is being created with wrong package dependency…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "cannot set property name of which has only a getter"
Nowhere in the code have I tried to set a property. Either way, it seems to throw the error before running my tests....
Read more >
TypeError: setting getter-only property "x" - JavaScript | MDN
There is an attempt to set a new value to a property for which only a getter is specified. While this will be...
Read more >
TypeError: setting getter-only property "x" - JavaScript
There is an attempt to set a new value to a property for which only a getter is specified. While this will be...
Read more >
JavaScript TypeError - Setting getter-only property "x"
Cause of the Error: The user is trying to set a new value to a property for which only a getter is defined....
Read more >
TypeError: setting getter-only property "x" - Javascript MDN 文档
There is an attempt to set a new value to a property for which only a getter is specified. While this will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found