-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(presets): add util functions to create ESM presets
- Loading branch information
Showing
6 changed files
with
408 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,53 @@ | ||
const { JS_EXT_TO_TREAT_AS_ESM, TS_EXT_TO_TREAT_AS_ESM } = require('../dist/constants') | ||
const { | ||
createJestPreset, | ||
createDefaultPreset, | ||
createDefaultEsmPreset, | ||
createJsWithTsPreset, | ||
createJsWithTsEsmPreset, | ||
createJsWithBabelPreset, | ||
createJsWithBabelEsmPreset, | ||
createDefaultLegacyPreset, | ||
createDefaultEsmLegacyPreset, | ||
createJsWithTsLegacyPreset, | ||
createJsWithTsEsmLegacyPreset, | ||
createJsWithBabelLegacyPreset, | ||
createJsWithBabelEsmLegacyPreset, | ||
} = require('../dist/presets/create-jest-preset') | ||
|
||
module.exports = { | ||
get defaults() { | ||
return createDefaultPreset() | ||
}, | ||
get defaultsLegacy() { | ||
return createJestPreset(true, false) | ||
return createDefaultLegacyPreset() | ||
}, | ||
get defaultsESM() { | ||
return createDefaultEsmPreset() | ||
}, | ||
get defaultsESMLegacy() { | ||
return createJestPreset(true, false, { extensionsToTreatAsEsm: TS_EXT_TO_TREAT_AS_ESM }) | ||
return createDefaultEsmLegacyPreset() | ||
}, | ||
get jsWithTs() { | ||
return createJsWithTsPreset() | ||
}, | ||
get jsWithTsLegacy() { | ||
return createJestPreset(true, true) | ||
return createJsWithTsLegacyPreset() | ||
}, | ||
get jsWithTsESM() { | ||
return createJsWithTsEsmPreset() | ||
}, | ||
get jsWithTsESMLegacy() { | ||
return createJestPreset(true, true, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
}) | ||
return createJsWithTsEsmLegacyPreset() | ||
}, | ||
get jsWithBabel() { | ||
return createJsWithBabelPreset() | ||
}, | ||
get jsWithBabelLegacy() { | ||
return createJestPreset(true, false, { | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelLegacyPreset() | ||
}, | ||
get jsWithBabelESM() { | ||
return createJsWithBabelEsmPreset() | ||
}, | ||
get jsWithBabelESMLegacy() { | ||
return createJestPreset(true, false, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
transform: { | ||
'^.+\\.m?[j]sx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelEsmLegacyPreset() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.