sourcecred/config/jest/fileTransform.js
William Chargin 0b4fea1c4f
flow: add typing to Jest transform modules (#790)
Test Plan:
`yarn flow` passes, and the [Jest docs][1] suggest that the added type
annotations are correct.

[1]: https://jestjs.io/docs/en/configuration#transform-object-string-string

wchargin-branch: flow-jest-transforms
2018-09-06 13:30:33 -07:00

12 lines
327 B
JavaScript

// @flow
const path = require("path");
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src /*: string */, filename /*: string */) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};