-1

try to import store with ~ Then i changed import from "~stores/dictionaries/address-space/administrationDistrictStore" to "stores/dictionaries/address-space/administrationDistrictStore" and it works import without ~ (error here - another ~import inside the store file) So jest or test-utils can`t read imports with ~ or the root folder is installed incorrectly, how i can fix that? My solution tree: solution tree tests and path to the stores my test

I tried to set modulePaths but it didn`t help jest.config.js

I expecting that imports in components I test will work correctly

defourten
  • 9
  • 2
  • If you want that to work correctly, please adhere to the pathname resolution rules of your operating system and the systems you run on it, e.g. nodejs. As you were hit by surprise better relate to the specification of pathnames on your operating system (which you have not shared in your question). Otherwise you risk to specify pathnames that might be different than you expect. E.g. ~ at the beginning of a pathname expands on a POSIX compatible system and the result is a non-existent file or directory then as you could demonstrate in your question. Perhaps adding a slash afterwards helps. – hakre Jul 20 '23 at 11:07

1 Answers1

0

My problem was related with aliases for folders and skipped folders in names in the node_modules, if you have some like this: aliases

try to set this in the jest.config.js

config

transformIgnorePatterns for node_module aliases, moduleNameMapper for aliases in the project

defourten
  • 9
  • 2