Set up jest with babel. Add failing test to see if it passes CI

pull/1/head
rebuilt 4 years ago
parent 1808c00b01
commit 771371d081

@ -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

@ -0,0 +1,7 @@
export default class Jester {
constructor(){}
hello(){
return "Hello"
}
}

@ -0,0 +1,5 @@
'use strict';
module.exports = {
presets: ['@babel/preset-env'],
};

@ -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

@ -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)
})
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save