Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

jest aliases typescript storybook

// tsconfig.json
{
 ...
 "baseUrl": "src",
 "paths": {
    "@alias/*": [ 'path/to/alias/*' ]
 }
 ...
}

//then your jest.config.js needs to provide those paths in moduleNameMapper in the following format:
// jest.config.js
module.exports = {
    'roots': [
        '<rootDir>/src'
    ],
    'transform': {
        '^.+.tsx?$': 'ts-jest'
    },
    'moduleNameMapper': {
         '@alias/(.*)': '<rootDir>/src/path/to/alias/$1'
    }
};

//Example tsconfig.json
{
	"baseUrl": "./",
	"paths": {
      "@/*": ["src/*"],
    },
}

//Example jest.config.json
"moduleNameMapper": {
  "@/(.*)": "<rootDir>/src/$1",
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: How to disabele and enable the button when it valid 
Typescript :: can subclass method infere exceptions of its superclass method 
Typescript :: read_contacts android 
Typescript :: where can I find reports of "reports and data" for free reddit quora 
Typescript :: marine traffic embeeded map in basic html 
Typescript :: Integer Which of the following can be described as the decision whether to obtain the necessary software from internal or external sources?and Development Environment meaning 
Typescript :: how to convert js to ts 
Typescript :: whats the next sonic game 
Typescript :: positional arguments dart 
Typescript :: spread types may only be created from object types firebase 
Typescript :: sorting list of multiple in an ascending order 
Typescript :: singleton design pattern typescript 
Typescript :: flutter: Error: google_fonts was unable to load font LobsterTwo-Bold because the following exception occured: 
Typescript :: How to check that tuple contains unique elements 
Typescript :: add and edit in ionic page 
Typescript :: jquery to typescript converter 
Typescript :: c# check type implements generic interface 
Typescript :: selenium components 
Typescript :: python search all txts in a folder 
Typescript :: how to separate a string into 2 lists of numbers and letters python 
Typescript :: how to make auto conversion of blogger texts with fonts installed in blog theme 
Cpp :: ‘setprecision’ was not declared in this scope 
Cpp :: flutter margins 
Cpp :: how to complie with c++ 17 
Cpp :: c++ system delay 
Cpp :: colourful text in c++ 
Cpp :: c++ ros subscriber 
Cpp :: find max value in image c++ 
Cpp :: stock a file in a vector cpp 
Cpp :: C++ Fahrenheit to Kelvin 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =