Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test module #3

Merged
merged 13 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ describe('RequireInTheMiddleSingleton', () => {
'codecov/lib/codecov.js',
onRequireCodecovLibStub
);
requireInTheMiddleSingleton.register('test-non-core-module', onRequireCpxStub);
requireInTheMiddleSingleton.register(
'test-non-core-module',
onRequireCpxStub
);
requireInTheMiddleSingleton.register(
'test-non-core-module/lib/copy-sync.js',
onRequireCpxLibStub
Expand Down Expand Up @@ -120,8 +123,12 @@ describe('RequireInTheMiddleSingleton', () => {

describe('non-core module', () => {
describe('AND module name matches', () => {
const baseDir = path.normalize(path.dirname(require.resolve('codecov')));
const modulePath = path.normalize(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']);
Expand Down Expand Up @@ -149,11 +156,15 @@ describe('RequireInTheMiddleSingleton', () => {

describe('non-core module with sub-path', () => {
describe('AND module name matches', () => {
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 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')
);
it('should call `onRequire`', () => {
const exports = require('test-non-core-module/lib/copy-sync');
assert.deepStrictEqual(exports.__ritmOnRequires, [
Expand All @@ -162,7 +173,12 @@ describe('RequireInTheMiddleSingleton', () => {
]);
sinon.assert.calledWithMatch(
onRequireCpxStub,
{ __ritmOnRequires: ['test-non-core-module', 'test-non-core-module-lib'] },
{
__ritmOnRequires: [
'test-non-core-module',
'test-non-core-module-lib',
],
},
modulePath,
baseDir
);
Expand Down

This file was deleted.

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.

Loading
Loading