Skip to content

Commit

Permalink
chore: jest and yarn (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Arregui authored Jun 16, 2023
1 parent fdd5824 commit 43c8b65
Show file tree
Hide file tree
Showing 99 changed files with 5,190 additions and 14,396 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: clean
run: make clean
run: make clean
- name: install
run: npm ci
run: yarn install --frozen-lockfile
- name: lint
run: npm run lint:check
run: yarn lint:check
- name: build & test
run: make ci
run: make ci
- name: print diff if failed
if: ${{ failure() }}
run: cp dist/temp/eth-connect.api.md report/eth-connect.api.md && git diff
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
with:
node-version: 18.x
- name: clean
run: make clean
run: make clean
- name: install
run: npm ci
run: yarn install --frozen-lockfile
- name: build & test & publish
run: make ci
run: make ci
- name: print diff if failed
if: ${{ failure() }}
run: cp dist/temp/eth-connect.api.md report/eth-connect.api.md && git diff
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: clean
run: make clean
run: make clean
- name: install
run: npm ci
run: yarn install --frozen-lockfile
- name: lint
run: npm run lint:check
run: yarn lint:check
- name: build & test
run: make ci
run: make ci
- name: print diff if failed
if: ${{ failure() }}
run: cp dist/temp/eth-connect.api.md report/eth-connect.api.md && git diff
Expand Down
18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
NODE = @node
TSC = $(NODE) --max-old-space-size=4096 node_modules/.bin/tsc
MOCHA = $(NODE) --max-old-space-size=4096 node_modules/.bin/mocha
NYC = $(NODE) --max-old-space-size=4096 node_modules/.bin/nyc
ROLLUP = $(NODE) --max-old-space-size=4096 node_modules/.bin/rollup
COVERALLS = $(NODE) --max-old-space-size=4096 node_modules/.bin/coveralls

ifneq ($(CI), true)
LOCAL_ARG = --local --verbose --diagnostics
Expand Down Expand Up @@ -46,17 +42,7 @@ watch:
${TSC} --project tsconfig.json --watch

test:
node --experimental-modules --es-module-specifier-resolution=node node_modules/.bin/nyc node_modules/mocha/bin/_mocha --timeout 60000
test-fast:
node --inspect --experimental-modules node_modules/.bin/_mocha $(TEST_ARGS)
test-fast-bail:
node --inspect --experimental-modules node_modules/.bin/_mocha --bail $(TEST_ARGS)

test-coveralls:
${NYC} report --reporter=text-lcov | ${COVERALLS} --verbose

test-codecov:
${NYC} report --reporter=text-lcov > coverage.lcov
yarn test

local-node:
# ensure ethereum/client-go image
Expand All @@ -83,7 +69,7 @@ kill-docker:
# stop the node
@(docker container kill geth-dev && docker container rm geth-dev) || true

ci: | build local-node test test-codecov kill-docker
ci: | build local-node test kill-docker

test-local: | build local-node test kill-docker

Expand Down
16 changes: 16 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
globals: {
"ts-jest": {
tsconfig: "test/tsconfig.json",
},
},
moduleFileExtensions: ["ts", "js"],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
coverageDirectory: "coverage",
collectCoverageFrom: ["src/**/*.ts", "src/**/*.js"],
coveragePathIgnorePatterns: ["/node_modules/"],
testMatch: ["**/*.spec.(ts)"],
testEnvironment: "node",
}
Loading

0 comments on commit 43c8b65

Please sign in to comment.