Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to c8 #996

Merged
merged 7 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"all": true,
"src": ["./src"],
"include": ["lib/**"],
"reporter": ["lcov", "text"]
}
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ permissions:
contents: read # to fetch code (actions/checkout)

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
cache: 'yarn'
- name: Install dependencies
run: yarn
- name: Lint
run: yarn run lint
test:
name: Test - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}
strategy:
Expand All @@ -30,10 +17,6 @@ jobs:
- node-version: "14.15.0" # The minimum supported node version
webpack-version: latest
os: ubuntu-latest
- node-version: latest
webpack-version: latest
os: ubuntu-latest
coverage: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -48,13 +31,29 @@ jobs:
run: yarn add -D webpack@${{ matrix.webpack-version }}
- name: Build babel-loader
run: yarn run build
env:
BABEL_ENV: test
- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: yarn test-only

lint-coverage:
name: Lint and Coverage - ${{ matrix.os }} - Node ${{ matrix.node-version }}, Webpack 5
strategy:
matrix:
os: [ubuntu-latest]
node-version: [latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn
- name: Run lint and coverage tests
run: yarn test
- name: Submit coverage data to codecov
uses: codecov/codecov-action@v1
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

8 changes: 2 additions & 6 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"presets": [
["@babel/preset-env", {
"loose": true,
"bugfixes": true,
"modules": false
}]
],
"env": {
"test": {
"plugins": ["istanbul"]
}
}
]
}
11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
"@babel/preset-env": "^7.19.4",
"ava": "^3.13.0",
"babel-eslint": "^10.1.0",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-react-intl": "^8.2.25",
"cross-env": "^7.0.2",
"c8": "^8.0.0",
"eslint": "^7.13.0",
"eslint-config-babel": "^9.0.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"nyc": "^15.1.0",
"pnp-webpack-plugin": "^1.6.4",
"prettier": "^2.1.2",
"react": "^17.0.1",
Expand All @@ -52,8 +50,8 @@
"precommit": "lint-staged",
"prepublish": "yarn run clean && yarn run build",
"preversion": "yarn run test",
"test": "yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only",
"test-only": "nyc ava"
"test": "yarn run lint && yarn run build --source-maps && c8 yarn run test-only",
"test-only": "ava"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -118,8 +116,5 @@
"node ./scripts/yarn-install.js",
"git add yarn.lock"
]
},
"resolutions": {
"nyc/node-preload": "0.2.0"
}
}