Skip to content

Commit

Permalink
# This is a combination of 4 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

Added local test pkg

# This is the commit message #2:

add type declaration for test-none-core-module

# This is the commit message #3:

Replaced cpx2 with a local module

# This is the commit message open-telemetry#4:

fixed lint errors
Annosha committed Oct 20, 2024
1 parent be1737f commit 07373ee
Showing 7 changed files with 2,744 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@
"babel-loader": "8.4.1",
"babel-plugin-istanbul": "7.0.0",
"codecov": "3.8.3",
"cpx2": "2.0.0",

"cross-var": "1.1.0",
"karma": "6.4.4",
"karma-chrome-launcher": "3.1.0",
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ describe('RequireInTheMiddleSingleton', () => {
const onRequireFsPromisesStub = makeOnRequiresStub('fs-promises');
const onRequireCodecovStub = makeOnRequiresStub('codecov');
const onRequireCodecovLibStub = makeOnRequiresStub('codecov-lib');
const onRequireCpxStub = makeOnRequiresStub('cpx2');
const onRequireCpxLibStub = makeOnRequiresStub('cpx2-lib');
const onRequireCpxStub = makeOnRequiresStub('test-non-core-module');
const onRequireCpxLibStub = makeOnRequiresStub('test-non-core-module-lib');

before(() => {
requireInTheMiddleSingleton.register('fs', onRequireFsStub);
@@ -53,9 +53,12 @@ describe('RequireInTheMiddleSingleton', () => {
'codecov/lib/codecov.js',
onRequireCodecovLibStub
);
requireInTheMiddleSingleton.register('cpx2', onRequireCpxStub);
requireInTheMiddleSingleton.register(
'cpx2/lib/copy-sync.js',
'test-non-core-module',
onRequireCpxStub
);
requireInTheMiddleSingleton.register(
'test-non-core-module/lib/copy-sync.js',
onRequireCpxLibStub
);
});
@@ -120,8 +123,12 @@ describe('RequireInTheMiddleSingleton', () => {

describe('non-core module', () => {
describe('AND module name matches', () => {
const baseDir = path.dirname(require.resolve('codecov'));
const modulePath = path.join('codecov', 'lib', 'codecov.js');
const baseDir = path.normalize(
path.dirname(require.resolve('codecov'))
);
const modulePath = path.normalize(
path.join('codecov', 'lib', 'codecov.js')
);
it('should call `onRequire`', () => {
const exports = require('codecov');
assert.deepStrictEqual(exports.__ritmOnRequires, ['codecov']);
@@ -149,20 +156,29 @@ describe('RequireInTheMiddleSingleton', () => {

describe('non-core module with sub-path', () => {
describe('AND module name matches', () => {
const baseDir = path.resolve(
path.dirname(require.resolve('cpx2')),
'..'
const baseDir = path.normalize(
path.resolve(
path.dirname(require.resolve('test-non-core-module')),
'..'
)
);
const modulePath = path.normalize(
path.join('test-non-core-module', 'lib', 'copy-sync.js')
);
const modulePath = path.join('cpx2', 'lib', 'copy-sync.js');
it('should call `onRequire`', () => {
const exports = require('cpx2/lib/copy-sync');
const exports = require('test-non-core-module/lib/copy-sync');
assert.deepStrictEqual(exports.__ritmOnRequires, [
'cpx2',
'cpx2-lib',
'test-non-core-module',
'test-non-core-module-lib',
]);
sinon.assert.calledWithMatch(
onRequireCpxStub,
{ __ritmOnRequires: ['cpx2', 'cpx2-lib'] },
{
__ritmOnRequires: [
'test-non-core-module',
'test-non-core-module-lib',
],
},
modulePath,
baseDir
);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,721 changes: 2,698 additions & 23 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -108,7 +108,9 @@
"markdownlint-cli2": "0.13.0",
"prettier": "3.0.3",
"process": "0.11.10",
"require-in-the-middle": "^7.4.0",
"semver": "7.6.3",
"sinon": "^19.0.2",
"typedoc": "0.22.18",
"typedoc-plugin-missing-exports": "1.0.0",
"typedoc-plugin-resolve-crossmodule-references": "0.2.2",

0 comments on commit 07373ee

Please sign in to comment.