Skip to content

Commit

Permalink
build(all): fix test setup
Browse files Browse the repository at this point in the history
- remove babel
- usw swc transform
- fix wallaby config
- remove coverage thresholds due to swc-project/swc#3854
- generate coverage report as PR comment instead
  • Loading branch information
unstubbable committed Feb 13, 2024
1 parent 2ce1988 commit 3f4bf39
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 91 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ jobs:
NODE_OPTIONS: --max-old-space-size=4096
run: yarn test:integration --no-cache --maxWorkers 2

coverage:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Coverage Report
uses: ArtiomTr/jest-coverage-report-action@v2

compile-lint-verify:
runs-on: ubuntu-latest
env:
Expand Down
13 changes: 0 additions & 13 deletions babel.config.js

This file was deleted.

4 changes: 1 addition & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = {
// Covered by the integration test 'module-loader-amd'
'!**/packages/module-loader-amd/src/index.ts',
],
coverageThreshold: {
global: {branches: 100, functions: 100, lines: 100, statements: 100},
},
globalSetup: 'jest-environment-puppeteer/setup',
globalTeardown: 'jest-environment-puppeteer/teardown',
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
Expand All @@ -26,4 +23,5 @@ module.exports = {
modulePathIgnorePatterns: ['/lib'],
setupFilesAfterEnv: ['expect-puppeteer'],
testMatch: ['<rootDir>/packages/*/src/**/*.test.{ts,tsx}'],
transform: {'^.+\\.tsx?$': '@swc/jest'},
};
14 changes: 14 additions & 0 deletions jest.config.wallaby.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @ts-check

/**
* @type {import('jest').Config}
*/
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
testMatch: [
'<rootDir>/packages/*/src/**/*.test.{ts,tsx}',
'!packages/{dom,demos}/**/*',
],
transform: {'^.+\\.tsx?$': '@swc/jest'},
};
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@
"watch:website": "lerna exec --scope @feature-hub/website -- docusaurus-start"
},
"devDependencies": {
"@babel/core": "^7.23.0",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.22.20",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-angular": "^17.0.0",
"@size-limit/file": "^11.0.1",
"@size-limit/webpack": "^11.0.1",
"@swc/jest": "^0.2.36",
"@types/cheerio": "^0.22.9",
"@types/git-rev-sync": "^2.0.0",
"@types/jest": "^29.5.5",
Expand All @@ -55,7 +50,6 @@
"aws-cdk": "^2.69.0",
"aws-cdk-lib": "^2.69.0",
"aws-simple": "^18.2.0",
"babel-jest": "^29.7.0",
"cheerio": "^1.0.0-rc.2",
"constructs": "^10.0.0",
"cross-env": "^7.0.2",
Expand Down
3 changes: 0 additions & 3 deletions packages/demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"build:todomvc": "yarn webpack --config src/todomvc/webpack-config.js --mode production"
},
"dependencies": {
"@babel/core": "^7.23.0",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
"@blueprintjs/core": "^5.0.0",
"@feature-hub/async-ssr-manager": "^3.5.0",
"@feature-hub/core": "^3.4.1",
Expand Down
29 changes: 3 additions & 26 deletions wallaby.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
// @ts-check

function setup({projectCacheDir, testFramework}) {
const jestConfig = require('./jest.config');

delete jestConfig.globalSetup;
delete jestConfig.globalTeardown;

jestConfig.moduleNameMapper = {
'^@feature-hub/([^/]+)$': projectCacheDir + '/packages/$1/src',
};

testFramework.configure(jestConfig);
}

module.exports = (wallaby) => ({
files: [
'jest.config.js',
'packages/*/src/**/*.{ts,tsx,snap}',
'!packages/{dom,demos}/**/*',
'!packages/*/src/**/*.test.{ts,tsx}',
],
tests: ['packages/*/src/**/*.test.{ts,tsx}', '!packages/{dom,demos}/**/*'],
env: {type: 'node', runner: 'node'},
setup,
testFramework: 'jest',
compilers: {
'**/*.ts?(x)': wallaby.compilers.babel(),
module.exports = () => ({
testFramework: {
configFile: './jest.config.wallaby.js',
},
});
74 changes: 35 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.20.tgz#8df6e96661209623f1975d66c35ffca66f3306d0"
integrity sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw==

"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.0", "@babel/core@^7.5.5":
"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.5.5":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.0.tgz#f8259ae0e52a123eb40f552551e647b506a94d83"
integrity sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==
Expand Down Expand Up @@ -803,7 +803,7 @@
lru-cache "^5.1.1"
semver "^6.3.1"

"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.22.11", "@babel/helper-create-class-features-plugin@^7.22.15", "@babel/helper-create-class-features-plugin@^7.22.5":
"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.22.11", "@babel/helper-create-class-features-plugin@^7.22.5":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz#97a61b385e57fe458496fad19f8e63b63c867de4"
integrity sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg==
Expand Down Expand Up @@ -890,7 +890,7 @@
dependencies:
"@babel/types" "^7.22.5"

"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295"
integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==
Expand Down Expand Up @@ -920,7 +920,7 @@
dependencies:
"@babel/types" "^7.22.5"

"@babel/helper-skip-transparent-expression-wrappers@^7.20.0", "@babel/helper-skip-transparent-expression-wrappers@^7.22.5":
"@babel/helper-skip-transparent-expression-wrappers@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz#007f15240b5751c537c40e77abb4e89eeaaa8847"
integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==
Expand Down Expand Up @@ -997,7 +997,7 @@
"@babel/helper-skip-transparent-expression-wrappers" "^7.22.5"
"@babel/plugin-transform-optional-chaining" "^7.22.15"

"@babel/plugin-proposal-class-properties@^7.18.6", "@babel/plugin-proposal-class-properties@^7.5.5":
"@babel/plugin-proposal-class-properties@^7.5.5":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3"
integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==
Expand All @@ -1014,15 +1014,6 @@
"@babel/plugin-syntax-object-rest-spread" "^7.8.0"
"@babel/plugin-transform-parameters" "^7.12.1"

"@babel/plugin-proposal-optional-chaining@^7.21.0":
version "7.21.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea"
integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==
dependencies:
"@babel/helper-plugin-utils" "^7.20.2"
"@babel/helper-skip-transparent-expression-wrappers" "^7.20.0"
"@babel/plugin-syntax-optional-chaining" "^7.8.3"

"@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2":
version "7.21.0-placeholder-for-preset-env.2"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703"
Expand Down Expand Up @@ -1161,7 +1152,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.14.5"

"@babel/plugin-syntax-typescript@^7.22.5", "@babel/plugin-syntax-typescript@^7.7.2":
"@babel/plugin-syntax-typescript@^7.7.2":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz#aac8d383b062c5072c647a31ef990c1d0af90272"
integrity sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==
Expand Down Expand Up @@ -1356,7 +1347,7 @@
"@babel/helper-module-transforms" "^7.23.0"
"@babel/helper-plugin-utils" "^7.22.5"

"@babel/plugin-transform-modules-commonjs@^7.22.15", "@babel/plugin-transform-modules-commonjs@^7.23.0":
"@babel/plugin-transform-modules-commonjs@^7.22.15":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.0.tgz#b3dba4757133b2762c00f4f94590cf6d52602481"
integrity sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==
Expand Down Expand Up @@ -1566,16 +1557,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.22.5"

"@babel/plugin-transform-typescript@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz#15adef906451d86349eb4b8764865c960eb54127"
integrity sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==
dependencies:
"@babel/helper-annotate-as-pure" "^7.22.5"
"@babel/helper-create-class-features-plugin" "^7.22.15"
"@babel/helper-plugin-utils" "^7.22.5"
"@babel/plugin-syntax-typescript" "^7.22.5"

"@babel/plugin-transform-unicode-escapes@^7.22.10":
version "7.22.10"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.10.tgz#c723f380f40a2b2f57a62df24c9005834c8616d9"
Expand Down Expand Up @@ -1615,7 +1596,7 @@
core-js "^2.6.5"
regenerator-runtime "^0.13.2"

"@babel/preset-env@^7.22.20", "@babel/preset-env@^7.5.5":
"@babel/preset-env@^7.5.5":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.20.tgz#de9e9b57e1127ce0a2f580831717f7fb677ceedb"
integrity sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg==
Expand Down Expand Up @@ -1710,7 +1691,7 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"

"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.22.15":
"@babel/preset-react@^7.0.0":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.22.15.tgz#9a776892b648e13cc8ca2edf5ed1264eea6b6afc"
integrity sha512-Csy1IJ2uEh/PecCBXXoZGAZBeCATTuePzCSB7dLYWS0vOEj6CNpjxIhW4duWwZodBNueH7QO14WbGn8YyeuN9w==
Expand All @@ -1722,17 +1703,6 @@
"@babel/plugin-transform-react-jsx-development" "^7.22.5"
"@babel/plugin-transform-react-pure-annotations" "^7.22.5"

"@babel/preset-typescript@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.0.tgz#cc6602d13e7e5b2087c811912b87cf937a9129d9"
integrity sha512-6P6VVa/NM/VlAYj5s2Aq/gdVg8FSENCg3wlZ6Qau9AcPaoF5LbN1nyGlR9DTRIw9PpxI94e+ReydsJHcjwAweg==
dependencies:
"@babel/helper-plugin-utils" "^7.22.5"
"@babel/helper-validator-option" "^7.22.15"
"@babel/plugin-syntax-jsx" "^7.22.5"
"@babel/plugin-transform-modules-commonjs" "^7.23.0"
"@babel/plugin-transform-typescript" "^7.22.15"

"@babel/register@^7.5.5":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.5.5.tgz#40fe0d474c8c8587b28d6ae18a03eddad3dac3c1"
Expand Down Expand Up @@ -2146,6 +2116,13 @@
slash "^3.0.0"
strip-ansi "^6.0.0"

"@jest/create-cache-key-function@^29.7.0":
version "29.7.0"
resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0"
integrity sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==
dependencies:
"@jest/types" "^29.6.3"

"@jest/environment@^27.5.1":
version "27.5.1"
resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.5.1.tgz#d7425820511fe7158abbecc010140c3fd3be9c74"
Expand Down Expand Up @@ -3436,6 +3413,20 @@
resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.1.tgz#e8d066c653883238c291d8fdd8b36ed932e87920"
integrity sha512-xVRaR4u9hcYjFvcSg71Lz5Bo4//CyjAAfMxa7UsaDSYxAshflUkVJWiyVWrfxC59z2kP1IzI4/1BEpnhI9o3Mw==

"@swc/counter@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9"
integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==

"@swc/jest@^0.2.36":
version "0.2.36"
resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.36.tgz#2797450a30d28b471997a17e901ccad946fe693e"
integrity sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==
dependencies:
"@jest/create-cache-key-function" "^29.7.0"
"@swc/counter" "^0.1.3"
jsonc-parser "^3.2.0"

"@swc/types@^0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.5.tgz#043b731d4f56a79b4897a3de1af35e75d56bc63a"
Expand Down Expand Up @@ -9993,6 +9984,11 @@ jsonc-parser@3.2.0, jsonc-parser@^3.0.0:
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==

jsonc-parser@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a"
integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
Expand Down

0 comments on commit 3f4bf39

Please sign in to comment.