Test runners:
Execute test and summarise results (Mocha)
Assertion Libraries:
Define test logic and conditions (Chai)
Does both?
Jest
Headless Browsers: E2E Testing
Simulates browser interaction . e.g Puppeteer
Types of Test?
{
"name": "App Name",
"version": "0.0.1",
"main": "app.js",
"scripts": {
"start": "webpack app.js --mode development --watch",
"test": "echo \"Error: no test specified\" && exit 1",
},
"keywords": [
"testing",
"javascript",
"jest"
]
}
Types of Test?
{
"name": "App Name",
"version": "0.0.1",
"main": "app.js",
"scripts": {
"start": "webpack app.js --mode development --watch",
"test": "jest",
},
"keywords": [
"testing",
"javascript",
"jest"
]
}
https://jestjs.io/docs/en/getting-started
https://jestjs.io/docs/en/getting-started
Types of Test?
// yarn add jest
// util.test.js
// util.speck.js
// import generateText component
const { generateText } = require('./util');
test('component should do this and this', () => {
const text = generateText('Papa Dadson', 24);
expect(text).toBe('Papa Dadson is 24 years old');
})
Add a basic test with JEST to a VUE/React application you have built