Skip to content

Commit

Permalink
chore(blank): update config for babel and jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Feb 21, 2024
1 parent 74c6811 commit 4140677
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
1 change: 1 addition & 0 deletions blank/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
],
],
plugins: [
require('@babel/plugin-transform-modules-commonjs'),
require('@babel/plugin-transform-runtime'),
],
}
18 changes: 18 additions & 0 deletions blank/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const path = require('path')

module.exports = {
rootDir: "tests",
transform: {
"^.+\\.jsx?$": [
"babel-jest",
{ "configFile": path.resolve(__dirname, "babel.config.js") },
],
},
transformIgnorePatterns: [
"/node_modules/(?!@botonic).+\\.(js|jsx|ts|tsx)$"
],
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(scss|css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
}
36 changes: 15 additions & 21 deletions blank/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,46 @@
"deploy": "botonic deploy -c build",
"test": "jest"
},
"jest": {
"rootDir": "tests",
"transformIgnorePatterns": [
"/node_modules/(?!@botonic).+\\.(js|jsx|ts|tsx|mjs)$"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(scss|css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.23.9",
"@botonic/react": "0.25.0-alpha.4"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@hot-loader/react-dom": "^16.14.0",
"analytics-node": "^3.5.0",
"babel-jest": "^29.7.0",
"babel-loader": "^8.3.0",
"babel-loader": "^9.1.3",
"chokidar": "^3.6.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.2.7",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.10.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0",
"imagemin-gifsicle": "^6.0.1",
"imagemin-jpegtran": "^6.0.0",
"imagemin-optipng": "^7.1.0",
"imagemin-svgo": "^7.1.0",
"imagemin-gifsicle": "^7.0.0",
"imagemin-jpegtran": "^7.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^10.0.1",
"imagemin-webpack": "^5.1.1",
"jest": "^29.7.0",
"null-loader": "^4.0.1",
"process": "^0.11.10",
"react-hot-loader": "4.12.21",
"sass": "^1.71.0",
"sass-loader": "^10.5.2",
"style-loader": "^2.0.0",
"sass": "^1.71.1",
"sass-loader": "^14.1.1",
"style-loader": "^3.3.4",
"terser": "^5.27.2",
"terser-webpack-plugin": "^5.3.10",
"ts-node": "^10.9.2",
"typescript": "^4.9.5",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "5.0.2"
},
"engines": {
"node": ">=20.0.0"
}
}
11 changes: 6 additions & 5 deletions blank/tests/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { routes } from '../src/routes'

const app = new NodeApp({ routes, locales, plugins, ...config })

const i = new BotonicInputTester(app)
const o = new BotonicOutputTester(app)
const session = { user: { id: '123' } }
const input = new BotonicInputTester(app)
const output = new BotonicOutputTester(app)

test('TEST: (404) NOT FOUND', async () => {
await expect(i.text('whatever')).resolves.toBe(
o.text("I don't understand you")
)
console.log(input)
const response = await input.text('whatever', session)
expect(response).toBe(output.text("I don't understand you"))
})

0 comments on commit 4140677

Please sign in to comment.