fix(UnitTests): Fixing "Cannot find module @cornerstonejs/core" error while running unit tests (#5148)

This commit is contained in:
Vinícius Alves de Faria Resende authored and GitHub committed 2025-07-11 16:36:49 -04:00
1 parent 277cef2168
commit 4a59126dd9
9 files changed
+181 -164

No files matched your search

+1 -3
View File
@@ -1,13 +1,11 @@
const base = require('../../jest.config.base.js');
const pkg = require('./package');
module.exports = {
...base,
name: pkg.name,
displayName: pkg.name,
moduleNameMapper: {
...base.moduleNameMapper,
'@ohif/(.*)': '<rootDir>/../../platform/$1/src',
'^@cornerstonejs/(.*)$': '<rootDir>/../../node_modules/@cornerstonejs/$1/dist/esm',
},
// rootDir: "../.."
// testMatch: [
+3 -1
View File
@@ -29,7 +29,9 @@
"dev:dicom-pdf": "yarn run dev",
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
"build:package-1": "yarn run build",
"start": "yarn run dev"
"start": "yarn run dev",
"test:unit": "jest --watchAll",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.11.0-beta.81",
@@ -200,7 +200,7 @@ describe('getDirectURL', () => {
const result = getDirectURL(config, params);
expect(mockedGetBulkdataValue).toHaveBeenCalledWith(config, params);
expect(mockedGetBulkdataValue).not.toHaveBeenCalled();
expect(mockedCreateRenderedRetrieve).toHaveBeenCalledWith(config, params);
expect(result).toBe(renderedRetrieveURL);
});
@@ -1,4 +1,6 @@
import toNumber from '@ohif/core/src/utils/toNumber';
import { utils } from '@ohif/core';
const { toNumber } = utils;
/**
* Check if the frames in a series has different dimensions