@@ -5,23 +5,31 @@ import { pathsToModuleNameMapper } from './paths-to-module-name-mapper'
55const tsconfigMap = {
66 log : [ 'src/util/log' ] ,
77 server : [ 'src/server' ] ,
8+ client : [ 'src/client' , 'src/client/index' ] ,
89 'util/*' : [ 'src/util/*' ] ,
910 'api/*' : [ 'src/api/*' ] ,
1011 'test/*' : [ 'test/*' ] ,
1112 'mocks/*' : [ 'test/mocks/*' ] ,
12- 'test/*/mock' : [ 'test/mocks/*' ] ,
13+ 'test/*/mock' : [ 'test/mocks/*' , 'test/__mocks__/*' ] ,
1314}
1415
1516describe ( 'pathsToModuleNameMapper' , ( ) => {
1617 it ( 'should convert tsconfig mapping' , ( ) => {
1718 expect ( pathsToModuleNameMapper ( tsconfigMap ) ) . toMatchInlineSnapshot ( `
1819Object {
1920 "^api/(.*)$": "src/api/$1",
21+ "^client$": Array [
22+ "src/client",
23+ "src/client/index",
24+ ],
2025 "^log$": "src/util/log",
2126 "^mocks/(.*)$": "test/mocks/$1",
2227 "^server$": "src/server",
2328 "^test/(.*)$": "test/$1",
24- "^test/(.*)/mock$": "test/mocks/$1",
29+ "^test/(.*)/mock$": Array [
30+ "test/mocks/$1",
31+ "test/__mocks__/$1",
32+ ],
2533 "^util/(.*)$": "src/util/$1",
2634}
2735` )
@@ -31,11 +39,18 @@ Object {
3139 expect ( pathsToModuleNameMapper ( tsconfigMap , { prefix : '<rootDir>/' } ) ) . toMatchInlineSnapshot ( `
3240Object {
3341 "^api/(.*)$": "<rootDir>/src/api/$1",
42+ "^client$": Array [
43+ "<rootDir>/src/client",
44+ "<rootDir>/src/client/index",
45+ ],
3446 "^log$": "<rootDir>/src/util/log",
3547 "^mocks/(.*)$": "<rootDir>/test/mocks/$1",
3648 "^server$": "<rootDir>/src/server",
3749 "^test/(.*)$": "<rootDir>/test/$1",
38- "^test/(.*)/mock$": "<rootDir>/test/mocks/$1",
50+ "^test/(.*)/mock$": Array [
51+ "<rootDir>/test/mocks/$1",
52+ "<rootDir>/test/__mocks__/$1",
53+ ],
3954 "^util/(.*)$": "<rootDir>/src/util/$1",
4055}
4156` )
@@ -48,20 +63,16 @@ Object {
4863 pathsToModuleNameMapper ( {
4964 kept : [ 'src/kept' ] ,
5065 'no-target' : [ ] ,
51- 'too-many-target' : [ 'one' , 'two' ] ,
5266 'too/*/many/*/stars' : [ 'to/*/many/*/stars' ] ,
5367 } ) ,
5468 ) . toMatchInlineSnapshot ( `
5569Object {
5670 "^kept$": "src/kept",
57- "^too\\\\-many\\\\-target$": "one",
5871}
5972` )
6073 expect ( log . lines . warn ) . toMatchInlineSnapshot ( `
6174Array [
6275 "[level:40] Not mapping \\"no-target\\" because it has no target.
63- ",
64- "[level:40] Mapping only to first target of \\"too-many-target\\" because it has more than one (2).
6576",
6677 "[level:40] Not mapping \\"too/*/many/*/stars\\" because it has more than one star (\`*\`).
6778",
0 commit comments