node/test/fixtures/cjs-module-wrap.js
Andrey Melikhov 6ef4d9ef11 module: increase code coverage of cjs loader
Add test cases to cover uncovered wrap and wrapper getters.

Refs: https://coverage.nodejs.org/coverage-99268b1e996d13a0/lib/internal/modules/cjs/loader.js.html#L153

PR-URL: https://github.com/nodejs/node/pull/27898
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-07-15 20:46:56 -07:00

11 lines
231 B
JavaScript

'use strict';
const assert = require('assert');
const m = require('module');
global.mwc = 0;
m.wrapper[0] += 'global.mwc = (global.mwc || 0 ) + 1;';
require('./not-main-module.js');
assert.strictEqual(mwc, 1);
delete global.mwc;