Manually set mime type for TypeScript files

This commit is contained in:
Mordy Tikotzky 2017-07-12 20:27:09 -04:00 committed by MICHAEL JACKSON
parent c68dac5f33
commit f91bf5abd7
2 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,7 @@ const mime = require('mime')
const TextFiles = /\/?(\.[a-z]*rc|\.git[a-z]*|\.[a-z]*ignore)$/i
mime.define({
'text/plain': ['license', 'readme', 'changes', 'authors', 'makefile'],
'text/plain': ['license', 'readme', 'changes', 'authors', 'makefile', 'ts'],
})
const getContentType = (file) =>

View File

@ -22,4 +22,9 @@ it('gets a contextType of text/plain for .git* files', () => {
it('gets a contextType of text/plain for .*ignore files', () => {
expect(getContentType('.eslintignore')).toBe('text/plain');
expect(getContentType('.anythingignore')).toBe('text/plain');
});
it('gets a contextType of text/plain for .ts files', () => {
expect(getContentType('app.ts')).toBe('text/plain');
expect(getContentType('app.d.ts')).toBe('text/plain');
});