Skip to content

Commit

Permalink
test: improve coverage of SourceTextModule getters
Browse files Browse the repository at this point in the history
  • Loading branch information
juanarbol committed Jan 21, 2021
1 parent e279304 commit 5a34564
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/parallel/test-vm-module-errors.js
Expand Up @@ -235,16 +235,26 @@ function checkInvalidCachedData() {
}

function checkGettersErrors() {
const expecteError = {
code: 'ERR_VM_MODULE_NOT_MODULE',
message: /Provided module is not an instance of Module/
};
const getters = ['identifier', 'context', 'namespace', 'status', 'error'];
getters.forEach((getter) => {
assert.throws(() => {
// eslint-disable-next-line no-unused-expressions
Module.prototype[getter];
}, {
code: 'ERR_VM_MODULE_NOT_MODULE',
message: /Provided module is not an instance of Module/
});
}, expecteError);
assert.throws(() => {
// eslint-disable-next-line no-unused-expressions
SourceTextModule.prototype[getter];
}, expecteError);
});
// `dependencySpecifiers` getter is just part of SourceTextModule
assert.throws(() => {
// eslint-disable-next-line no-unused-expressions
SourceTextModule.prototype.dependencySpecifiers;
}, expecteError);
}

const finished = common.mustCall();
Expand Down

0 comments on commit 5a34564

Please sign in to comment.