MCPcopy
hub / github.com/mongodb/node-mongodb-native / _create

Function _create

test/tools/runner/metadata_ui.js:93–119  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

91 * @param {any} opts
92 */
93 var _create = function (opts) {
94 var testData = _parseArgs(opts.args);
95
96 // Creating the Suite object
97 var newSuite = Suite.create(suites[0], testData.title);
98 newSuite.pending = Boolean(opts.pending);
99 newSuite.file = file;
100 suites.unshift(newSuite);
101 if (opts.isOnly) {
102 newSuite.parent._onlySuites = newSuite.parent._onlySuites.concat(newSuite);
103 mocha.options.hasOnly = true;
104 }
105 // Inherit parent metadata if metadata is not explicitly provided
106 newSuite.metadata = testData.metadata || suites[1]?.metadata || {};
107 if (typeof testData.fn === 'function') {
108 testData.fn.call(newSuite);
109 suites.shift();
110 } else if (typeof testData.fn === 'undefined' && !newSuite.pending) {
111 throw new Error(
112 'Suite "' +
113 newSuite.fullTitle() +
114 '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.'
115 );
116 }
117
118 return newSuite;
119 };
120
121 // Remaining logic is adaapted from the bdd interface
122 // https://github.com/mochajs/mocha/blob/master/lib/interfaces/bdd.js

Callers 1

metadata_ui.jsFile · 0.70

Calls 3

_parseArgsFunction · 0.85
unshiftMethod · 0.80
shiftMethod · 0.45

Tested by

no test coverage detected