cpcwood / jest-erb-transformer

Jest transformer for Embedded Ruby template (`.erb`) files in Ruby projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The transformer is not working

ArmandoChindoy opened this issue · comments

Thats my package.json
{ "scripts": { "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage" }, "dependencies": { "@babel/plugin-proposal-export-default-from": "^7.10.4", "@babel/preset-react": "^7.10.1", "@date-io/date-fns": "^2.11.0", "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@mui/icons-material": "^5.2.5", "@mui/lab": "^5.0.0-alpha.62", "@mui/material": "^5.2.4", "@mui/styled-engine-sc": "^5.1.0", "@mui/x-data-grid": "^5.2.1", "@rails/ujs": "^6.0.3-1", "@rails/webpacker": "5.1.1", "aws-sdk": "^2.728.0", "axios": "^0.19.2", "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "core-js": "^3.6.5", "google-map-react": "^1.1.7", "i18next": "^19.6.3", "jquery": "^3.5.1", "mobx": "^6.3.10", "mobx-react": "^7.2.1", "prop-types": "^15.7.2", "rails-erb-loader": "^5.5.2", "react": "^16.13.1", "react-autosuggest": "^10.1.0", "react-dom": "^16.13.1", "react-dropzone": "^11.0.2", "react-google-maps": "^9.4.5", "react-hook-form": "^7.22.5", "react-i18next": "^11.7.0", "react-lottie": "^1.2.3", "react-redux": "^7.2.0", "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-semantic-ui-datepickers": "^2.13.0", "react_ujs": "^2.6.1", "redoc": "^2.0.0-rc.40", "redux": "^4.0.5", "redux-thunk": "^2.4.1", "reselect": "^4.1.5", "semantic-ui-css": "^2.4.1", "semantic-ui-react": "^1.0.0", "styled-components": "^5.3.3", "styled-components-breakpoint": "^3.0.0-preview.20", "turbolinks": "^5.2.0" }, "devDependencies": { "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.6", "jest": "^28.1.1", "jest-erb-transformer": "^1.2.7", "standard": "^16.0.4", "webpack-dev-server": "^3.11.0" }, "standard": { "ignore": [ "./node_modules/**" ] }, "eslintConfig": { "extends": [ "./node_modules/standard/eslintrc.json" ], "rules": { "camelcase": 0, "no-undef": 0, "no-new-object": 0, "eqeqeq": 0 } }, "jest": { "testPathIgnorePatterns": [ "<rootDir>/config/webpack/test.js" ], "setupFilesAfterEnv": [ "<rootDir>/app/webpacker/__test__/setupTest.js" ], "moduleNameMapper": { "\\.(sass|css)": "<rootDir>/app/webpacker/__mocks__/style.mock.js", "\\.erb": "<rootDir>/app/webpacker/__mocks__/routes.mock.js" }, "moduleFileExtensions": [ "js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node", "erb" ], "transform": { "^.+\\.erb$": [ "jest-erb-transformer", { "application": "rails" } ] } }, "engines": { "node": "14.x" }, "resolutions": { "cheerio": "1.0.0-rc.10" } }

and when i tun yarn test is not working

the issue

`However, Jest was able to find:
'../../utils/rails_routes.js.erb'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node', 'erb'].

See https://jestjs.io/docs/configuration#modulefileextensions-arraystring`

Hey @ArmandoChindoy, do you have a link to the repository you are having problems with? Or a sample repository with the same issue? This would help me debug the issue as it's likely due to config.

@ArmandoChindoy I could not reproduce this issue, so I'm going to close it. Thanks 🙂