Skip to content

Commit

Permalink
Merge pull request #1170 from gautaz/master
Browse files Browse the repository at this point in the history
fix for #1169: getPrototypeOf instead of __proto__
  • Loading branch information
icebob committed Jan 2, 2023
2 parents 8c8d6d6 + 0a51aca commit ef2fe8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Disable proto
if: ${{ matrix.node-version != '10.x' }}
run: export NODE_OPTIONS=--disable-proto=delete

- name: Install dependencies
run: npm ci

Expand Down
6 changes: 3 additions & 3 deletions src/service-broker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1775,14 +1775,14 @@ class ServiceBroker {
return schema;
}
// Depending how the schema was create the correct constructor name (from base class) will be locate on __proto__.
target = utils.getConstructorName(schema.__proto__);
target = utils.getConstructorName(Object.getPrototypeOf(schema));
if (serviceName === target) {
Object.setPrototypeOf(schema.__proto__, this.ServiceFactory);
Object.setPrototypeOf(Object.getPrototypeOf(schema), this.ServiceFactory);
return schema;
}
// This is just to handle some idiosyncrasies from Jest.
if (schema._isMockFunction) {
target = utils.getConstructorName(schema.prototype.__proto__);
target = utils.getConstructorName(Object.getPrototypeOf(schema.prototype));
if (serviceName === target) {
Object.setPrototypeOf(schema, this.ServiceFactory);
return schema;
Expand Down

0 comments on commit ef2fe8c

Please sign in to comment.