Chatbots for Google Chat.
- Node.js 18.x
- NPM 9.x
To install Node.js and NPM, try nvm
- Clone the repository
- Run
npm cito install dependencies
The project is now ready to run.
Run npm run build to build the project.
It will create a dist folder with the compiled code. For each bot there will be a single file.
Eg: dist/attendance.js for the attendance bot.
Jest is used as a test runner.
- Run
npm testto start the tests.
To create a new bot, create a new folder with the name of the bot in the bots folder.
Eg: bots/attendance
Inside the folder create a js file, the name of the file should be the name of the bot.
Eg: bots/attendance/attendance.js
The file should export a function that will be called when the bot is triggered.
Eg:
module.exports = function attendance() {
// Bot code
};Create a test file with the same name as the bot file, but with the .test.js extension.
Eg: bots/attendance/attendance.test.js
The test file should import the bot function and run it in tests.
Eg:
const attendance = require('./attendance');
describe('attendance', () => {
it('should return a message', () => {
const message = attendance();
expect(message).toBe('Hello World!');
});
});This project uses eslint as a linter. The configuration is in .eslintrc.js.
To run the linter, run npm run lint.
This project uses husky to run pre-commit hooks. Linter is run on every commit.
Open the project in VSCode.
Type Ctrl + Shift + X to open the extensions panel. Type @recommended and install the recommended extensions.
StrykerJS is configured to run on this project, when you want to test your tests with mutation testing (not continuously).
To run mutation testing on the whole project :
npm run test:mutateOr the real underlying command
stryker runTo run mutation testing on a specific folder :
npm run test:mutate -- --mutate "path/to/my/folder/**/!(*.test).js"Or the real underlying command
stryker run --mutate "path/to/my/folder/**/!(*.test).js"