You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should warn when trying to process js but allowJs is false',()=>{
@@ -136,6 +136,28 @@ Array [
136
136
`)
137
137
})
138
138
139
+
it('should warn when trying to process unknown file types',()=>{
140
+
args[1]='/foo/bar.jest'
141
+
constlogs=logTargetMock()
142
+
logs.clear()
143
+
expect(process()).toBe(INPUT)
144
+
expect(logs.lines.warn).toMatchInlineSnapshot(`
145
+
Array [
146
+
"[level:40] Got a unknown file type to compile (file: /foo/bar.jest). To fix this, in your Jest config change the \`transform\` key which value is \`ts-jest\` so that it does not match this kind of files anymore.
147
+
",
148
+
]
149
+
`)
150
+
logs.clear()
151
+
babel={process: jest.fn(s=>`babel:${s}`)}
152
+
expect(process()).toBe(`babel:${INPUT}`)
153
+
expect(logs.lines.warn).toMatchInlineSnapshot(`
154
+
Array [
155
+
"[level:40] Got a unknown file type to compile (file: /foo/bar.jest). To fix this, in your Jest config change the \`transform\` key which value is \`ts-jest\` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the \`transform\` option with value \`babel-jest\` which key matches this type of files.
156
+
",
157
+
]
158
+
`)
159
+
})
160
+
139
161
it('should not pass the instrument option to babel-jest',()=>{
Copy file name to clipboardExpand all lines: src/util/messages.ts
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ export enum Errors {
13
13
MappingOnlyFirstTargetOfPath='Mapping only to first target of "{{path}}" because it has more than one ({{count}}).',
14
14
CannotPatchBabelCore6='Error while trying to patch babel-core/lib/transformation/file: {{error}}',
15
15
GotJsFileButAllowJsFalse='Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore',
16
+
GotUnknownFileTypeWithoutBabel='Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.',
17
+
GotUnknownFileTypeWithBabel='Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files.',
0 commit comments