GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: improve coverage of `SourceTextModule` getters · nodejs/node@de6dca1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-vm-module-errors.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-vm-module-errors.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-vm-module-errors.js
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,26 @@ function checkInvalidCachedData() {
235235
}
236236

237237
function checkGettersErrors() {
238+
const expectedError = {
239+
code: 'ERR_VM_MODULE_NOT_MODULE',
240+
message: /Provided module is not an instance of Module/
241+
};
238242
const getters = ['identifier', 'context', 'namespace', 'status', 'error'];
239243
getters.forEach((getter) => {
240244
assert.throws(() => {
241245
// eslint-disable-next-line no-unused-expressions
242246
Module.prototype[getter];
243-
}, {
244-
code: 'ERR_VM_MODULE_NOT_MODULE',
245-
message: /Provided module is not an instance of Module/
246-
});
247+
}, expectedError);
248+
assert.throws(() => {
249+
// eslint-disable-next-line no-unused-expressions
250+
SourceTextModule.prototype[getter];
251+
}, expectedError);
247252
});
253+
// `dependencySpecifiers` getter is just part of SourceTextModule
254+
assert.throws(() => {
255+
// eslint-disable-next-line no-unused-expressions
256+
SourceTextModule.prototype.dependencySpecifiers;
257+
}, expectedError);
248258
}
249259

250260
const finished = common.mustCall();

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.