Skip to content

Commit

Permalink
Merge pull request #17 from rjclaasen/master
Browse files Browse the repository at this point in the history
Hotfix jest config load changes in Jest 27
  • Loading branch information
cpcwood authored Jul 1, 2021
2 parents bef1c0e + 7e305b3 commit 36b50d5
Show file tree
Hide file tree
Showing 4 changed files with 862 additions and 552 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function processFile (fileContent, filePath, config) {

module.exports = {
process (fileContent, filePath, jestConfig) {
const config = loadConfig(filePath, jestConfig)
const config = loadConfig(filePath, jestConfig.config)
return processFile(fileContent, filePath, config)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^26.0.1",
"jest": "^27.0.5"
"jest-erb-transformer": "./"
}
}
22 changes: 12 additions & 10 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ const path = require('path')

function transformErb (filePath, testConfiguration = {}) {
const jestConfig = {
transform: [
[
'\\.js.erb$',
path.join(__dirname, 'index.js'),
testConfiguration
],
[
'\\.na\\.erb$',
path.join(__dirname, 'index.js')
config: {
transform: [
[
'\\.js.erb$',
path.join(__dirname, 'index.js'),
testConfiguration
],
[
'\\.na\\.erb$',
path.join(__dirname, 'index.js')
]
]
]
}
}
const fileContent = fs.readFileSync(filePath).toString()
return process(fileContent, filePath, jestConfig)
Expand Down
Loading

0 comments on commit 36b50d5

Please sign in to comment.