mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 13:38:18 -08:00
Set up jest with babel. Add failing test to see if it passes CI
This commit is contained in:
parent
1808c00b01
commit
771371d081
8 changed files with 7736 additions and 3 deletions
2
.github/workflows/build-and-test.yml
vendored
2
.github/workflows/build-and-test.yml
vendored
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
run: bundle install
|
||||
- name: Create DB
|
||||
run: bundle exec rake db:test:prepare
|
||||
- name: Run tests
|
||||
- name: Run rails tests
|
||||
run: bundle exec rake
|
||||
- name: Install javascript dependencies
|
||||
run: yarn install
|
||||
|
|
|
|||
7
app/assets/javascripts/jester.js
Normal file
7
app/assets/javascripts/jester.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default class Jester {
|
||||
constructor(){}
|
||||
|
||||
hello(){
|
||||
return "Hello"
|
||||
}
|
||||
}
|
||||
5
babel.config.js
Normal file
5
babel.config.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
presets: ['@babel/preset-env'],
|
||||
};
|
||||
17
package.json
17
package.json
|
|
@ -2,9 +2,24 @@
|
|||
"name": "app",
|
||||
"private": "true",
|
||||
"dependencies": {
|
||||
"@babel/preset-env": "^7.15.8",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"esbuild": "^0.13.6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
|
||||
"build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^27.2.5"
|
||||
},
|
||||
"jest": {
|
||||
"roots": [
|
||||
"./spec/javascript"
|
||||
],
|
||||
"moduleDirectories": [
|
||||
"node_modules",
|
||||
"app/assets/javascripts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ set -eux
|
|||
|
||||
git rev-parse --show-toplevel
|
||||
|
||||
bundle exec rake && git push
|
||||
bundle exec rake && yarn test && git push
|
||||
|
|
|
|||
15
spec/javascript/hello_jest.spec.js
Normal file
15
spec/javascript/hello_jest.spec.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import Jester from "jester"
|
||||
|
||||
describe('this test should pass', () => {
|
||||
test('very first test', () => {
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
test('Jester.hello returns greeting', () =>{
|
||||
const jester = new Jester()
|
||||
expect(jester.hello()).toBe("Hello")
|
||||
})
|
||||
test('fail', () => {
|
||||
expect(false).toBe(true)
|
||||
})
|
||||
})
|
||||
3926
yarn-error.log
Normal file
3926
yarn-error.log
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue