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

Using Object.defineProperty on prototypes causes the tests to fail to build #155

Open
FutureAstroMiner opened this issue Apr 20, 2021 · 2 comments

Comments

@FutureAstroMiner
Copy link

Using Object.defineProperty like:

Object.defineProperty(Creep.prototype, 'boosts', {
	get() {
		if (!this._boosts) {
			this._boosts = _.compact(_.unique(_.map(this.body as BodyPartDefinition[], bodyPart => bodyPart.boost)));
		}
		return this._boosts;
	},
	configurable: true,
});

and importing this into the main file causes the test to fail to build with a reference error
ReferenceError: Creep is not defined

@FutureAstroMiner
Copy link
Author

I have been looking around for a solution to this issue but I can't find one.

The alternative is to use Jest as this issue seams to have been fixed by eduter in screeps-typescript-jest-starter but integration tests are not available.

Should Object.defineProperty be done in a different way?

@madrang
Copy link

madrang commented Jun 7, 2022

Try again with

enumerable: false,

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

No branches or pull requests

2 participants