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',()=>{
124
+
args[1]='/foo/bar.js'
125
+
typescript.options.allowJs=false
126
+
constlogs=logTargetMock()
127
+
logs.clear()
128
+
expect(process()).toBe(INPUT)
129
+
expect(logs.lines.warn).toMatchInlineSnapshot(`
130
+
Array [
131
+
"[level:40] Got a \`.js\` file to compile while \`allowJs\` option is not set to \`true\` (file: /foo/bar.js). To fix this:
132
+
- if you want TypeScript to process JS files, set \`allowJs\` to \`true\` in your TypeScript config (usually tsconfig.json)
133
+
- 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
134
+
",
135
+
]
136
+
`)
137
+
})
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
+
`)
114
159
})
115
160
116
161
it('should not pass the instrument option to babel-jest',()=>{
Copy file name to clipboardExpand all lines: src/util/messages.ts
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,9 @@ export enum Errors {
12
12
NotMappingPathWithEmptyMap='Not mapping "{{path}}" because it has no target.',
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
+
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