-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enzyme Internal Error: configured enzyme adapter did not inherit from the EnzymeAdapter base class #2003
Comments
Try this change: -"setupTestFrameworkScriptFile": "/src/test/test-setup.js",
+"setupTestFrameworkScriptFile": "<rootDir>/src/test/test-setup.js", and if it doesn't help, please create a sample repo demonstrating the issue, we are happy to take a look. |
It is already prefixed with I also get these errors before the EnzymeAdapter Errors. I don't why it thinks test-setup.js is a test. I am specifying only spec files as tests. [Error] Some long running code has been detected: one of your files is taking more than 5000ms to execute. |
Please create a sample repo demonstrating the issue, we are happy to take a look. It's likely that no real source/test files are required to reproduce it, just configs/setup. |
I have same error. I trying to create a sample demo demonstrating the issue. When I make new app with create-react-app + jest + enzyme + wallaby, everything works correctly. I copy my *.js and *.test.js to new folder and it works. My project suddenly broken again. This is the repo demonstrating the issue: https://github.com/blogwebpl/przewoznik.info-client Error: Enzyme Internal Error: configured enzyme adapter did not inherit from the EnzymeAdapter base class |
We downloaded the sample repo and everything seems to be working for us. The steps we took were:
Result:
This is the same as what we see when running yarn test:
Could you please try cloning the repo to a fresh directory to see if that fixes your problem? |
You're right. Cloned repo result: But... Original repo yesterday result: Today after restart computer (macOS 10.14.3) everythinhg is fine. Original repo result: Maybe something is cached ? There is something else. When I run Code Studio like this:
When I run like this:
And then switch to client folder (using Projects+ plugin) JonathanYates could you try run your editor from command line in project direcotry ? |
Unfortunately I can't really create a repo as this is work project and everything is locked down here. I'd get into trouble if I did. But I can share with you my setup which I have tried on a simple project with bare minimum files and setup. This is all I have: package.json {
"name": "wallaby-test",
"version": "0.0.0",
"description": "wallaby-test",
"scripts": {
"test": "jest",
"test:watch": "npm run test -- --watch"
},
"dependencies": {
"react": "^16.8.3",
"react-dom": "^16.8.3"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/plugin-proposal-class-properties": "^7.3.3",
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@babel/register": "^7.0.0",
"@types/enzyme": "^3.9.0",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.6",
"@types/react": "^16.8.4",
"@types/react-dom": "^16.8.2",
"babel-core": "^6.26.3",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.9.1",
"jest": "^24.1.0",
"react-hot-loader": "^4.7.1"
},
"jest": {
"verbose": true,
"moduleDirectories": [
"node_modules",
"src"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"setupFilesAfterEnv": [
"<rootDir>/src/test-setup.js"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.tsx?$": "babel-jest"
},
"testMatch": [
"<rootDir>/src/**/*spec.(ts|tsx|js)"
],
"testPathIgnorePatterns": [
"<rootDir>/node_modules/"
]
}
} wallaby.js module.exports = function(wallaby) {
return {
files: [
"src/**/*.js",
"src/**/*.jsx",
"!src/**/*.spec.js",
"!src/**/*.spec.jsx"
],
tests: ["src/**/*.spec.js", "src/**/*.spec.jsx"],
env: {
type: "node",
runner: "node"
},
compilers: {
"**/*.js": wallaby.compilers.babel({
presets: ["@babel/react", "@babel/preset-env"],
plugins: [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
})
},
testFramework: "jest"
};
}; then in src: test-setp.js const Enzyme = require("enzyme");
const Adapter = require("enzyme-adapter-react-16");
Enzyme.configure({ adapter: new Adapter() }); and one test called foo.spec.js describe('foo', () => {
it('should be foo', () => {
const foo = 'foo';
expect(foo).toBe('foo');
})
}) If I run npm test I get:
But if I start Wallaby I get same error:
|
We have followed your instructions and still can't duplicate the problem. I've created a sample repo with all of the content/artifacts that you provided (https://github.com/wallabyjs/issues-2003). Can you please try cloning and see if it's working for you? If this is working for you and you are unable to provide us with a means to duplicate, the next thing for you to do is to diff the two projects to see what's different. You've probably already seen these links, but we did find that others had similar problems with Enzyme in the past with conflicting package versions: |
Thanks for creating the sample repo. I have cloned the repo, done npm install and then run jest and get this output. PASS src/foo.spec.js (8.924s) Test Suites: 1 passed, 1 total But if I run Wallaby (v1.0.114) in VS Code (v1.31.1) I get this error, which is different from before: [Info] Started Wallaby.js Core v1.0.658 |
Not sure if this is relevant but I am running VS Code in Portable Mode (https://code.visualstudio.com/docs/editor/portable) due to the corporate environment here which allows extensions to be installed to the data directory. |
Please check if you have any of the following folders on disk:
and if you do, try deleting them and restarting Wallaby. If it doesn't help, please
|
Hi. None of those folders exist. I am running on a VM so difficult to test on another computer. This is running Windows 7. Node version: v8.11.1 Could you please try running from VS Code Portable? Perhaps Wallaby Core isn't getting updated correctly or something? |
We'll try it (in a few hours on another Windows machine), but it is unlikely to be the issue - Wallaby Core looks up-to-date from your log file. Could you please zip and attach the |
Unfortunately I can't do that here. |
Could you please send an email with the requested archive to [email protected]? |
Sorry we are not allowed to send external emails. |
Dropbox/Google drive upload? Getting the folder seems to be the only way for us to be able reproduce the issue. |
Closing this issue as we require more detail to reproduce the issue. As per previous comment, please contact us outside of this public forum for more assistance if you can't share details publicly, we're happy to help. |
Issue description or question
I am getting the following error when trying to run Wallaby in VSCode:
Runtime error: Error: Enzyme Internal Error: configured enzyme adapter did not inherit from the EnzymeAdapter base class
[Error] at validateAdapter (I:\dev\xap-prod-svc-web\xap-prod-svc-web-web\node_modules\enzyme\build\validateAdapter.js:25:11)
[Error] at Object.merge [as configure] (I:\dev\xap-prod-svc-web\xap-prod-svc-web-web\node_modules\enzyme\build\configuration.js:28:38)
[Error] at Object.configure (E:\cv_UserTemp\software\VSCode-win32-x64-1.30.2\data\extensions\wallabyjs.wallaby-vscode-1.0.113\projects\8c5d0afc2633a088\instrumented\src\test\test-setup.js:9:30)
I am configuring the EnzymeAdapter in src/test/test-setup.js as follows:
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
And I am specifying the setup File in package.json in the jest config as follows:
"setupTestFrameworkScriptFile": "/src/test/test-setup.js",
I don't get any errors when I run Jest using yarn test, which just runs jest.
I have the following as the relevent devDependencies:
This is my package.json jest config:
"jest": {
"verbose": true,
"moduleDirectories": [
"node_modules",
"src"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"gql",
"graphql"
],
"setupTestFrameworkScriptFile": "/src/test/test-setup.js",
"transform": {
"\.(gql|graphql)$": "/src/test/jest-transform-graphql",
"^.+\.js$": "babel-jest",
"^.+\.tsx?$": "babel-jest"
},
"testMatch": [
"/src/**/*spec.(ts|tsx|js)"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"transformIgnorePatterns": [
"/node_modules/(?!seamless-immutable|react).+\.js$"
],
"moduleNameMapper": {
"\.(css|less|sass|scss)$": "/src/test/mocks/styleMock.js",
"\.(gif|ttf|eot|svg)$": "/src/test/mocks/fileMock.js"
}
}
Wallaby.js configuration file
Code editor or IDE name and version
Visual Studio Code v1.30.2
OS name and version
Windows 7
The text was updated successfully, but these errors were encountered: