Mac Developers: Install Xcode command line tools if you don't already have them.
Windows Developers: Install Node.js globally, may also have to run Spearmint in admin mode.
As of January 2023, spearmint works with node version 19.4.0 electron-devtools-vendor must be at version 1.1 for now due to a bug. React must be version 17 due to a dependency for mui. Fix-path must be version 3.0.0 due to 4.0.0 only being usable with an import statement, which is not supported in electron.jsx.
-
Fork and clone this repository.
-
npm install
-
Create a .env file in the root directory of the project
-
Insert the following lines of code into the .env file
APP_DEV=true BROWSER=non SKIP_PREFLIGHT_CHECK=true MONGO_LINK=mongodb+srv://username:[email protected]/?retryWrites=true&w=majority
-
Set MONGO_LINK to your MongoDB URI or use the URI we provided (ex: mongodb://localhost:27017)
-
Make sure your MongoDB is running if it's hosted locally.
-
npm run rebuild
(different fromnpm rebuild
so please pay attention to that) -
npm run dev
-
To enable hot-module reloading, uncomment line 23 in the electron.jsx file.
// require('electron-reloader')(module);
-
To enable Chrome Dev Tools, uncomment line 71 in the electron.jsx file:
// mainWindow.webContents.openDevTools();
-
To enable React Dev Tools, uncomment lines 285 to 289 in the electron.jsx file:
// .then(() => { // session.defaultSession.loadExtension(REACT_DEVELOPER_TOOLS, { allowFileAccess: true }) // .then((name) => console.log(`Added Extension: ${name}`)) // .catch((err) => console.log(`An error occurred adding an extension: ${err}`)); // })
-
Exporting test files in TypeScript: the tests currently export in JS.
-
Convert codebase to TypeScript: currently, there are some files in TS, and others in JS. It would be great to convert all to TS.
-
Dry refactoring of codebase: A lot of the folders and files for the frontend frameworks testing are the same, and the codebase would GREATLY benefit from refactoring and modularizing those.
-
Persist user data: there is currently sign up and login functionality. V0.13.0 commented out the login functionality because there is currently no user data being persisted. A great feature would be to save tests to work on them later, or create templates for each user.
-
GitHub OAuth is functional, but Google OAuth is currently broken. If you are planning to persist user data, this is an excellent feature to resolve.
-
Add more customization to the tests themseleves such as chaining expects, add the ability to use siblings and children, etc., or having the ability to test more than one component in one test file.
-
Some of test cases needs improvement on UI as they do not have any styling or optimal user experience
Please feel free to add any other features or fixes that you would like or are interested in.
-
Mongo: Mongodb is used for authentication functionality. If you didn't use locally hosted mongodb URI in .env file, you may skip to the X server section.
-
Add
172.17.0.1
and0.0.0.0
to the network interfaces of mongo config file.a. Open
mongod.cfg
(Usually located in C:\Program Files\MongoDB\Server\4.4\bin)# network interfaces net: port: 27017 bindIp: 127.0.0.1, 172.17.0.1, 0.0.0.0
-
Run mongo on port 27017
-
-
X server
After running the mongo on port 27017 and running the x server with display number of 0, follow the steps below.
-
Build the docker image by running the following command
docker build -t [image name] .
-
Run the docker image by using the following command:
`docker run -e DISPLAY='host.docker.internal:0.0' -it -v [directory of project to be tested]:/[directory to create volume] [image name]` - `-e DISPLAY='host.docker.internal:0.0'`: Set environment variable ‘display’ to host.docker.internal:0.0 - `-it`: Run container as interactive - `-v`: Creates a volume and mounts the testing application into the container. (ex: `-v [testing files]:[created volume]`) *Please note that once the spearmint container is running, you can only access the folders that you mounted here.`
Please note that the image uses root user, as shown in the Dockerfile.