diff --git a/.circleci/config.yml b/.circleci/config.yml index 0bddfec..3d03814 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,13 +93,17 @@ jobs: test: docker: - image: cimg/node:16.18 + parallelism: 4 + resource_class: large working_directory: ~/cunningham steps: - *checkout_cunningham - *restore_node_modules + - attach_workspace: + at: ~/cunningham - run: name: Run test suites over all workspaces - command: yarn test + command: yarn test-ci # ---- Internationalization ---- crowdin-upload: @@ -222,4 +226,4 @@ workflows: requires: - build - lint - - test \ No newline at end of file + - test diff --git a/package.json b/package.json index 01139dc..390681a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build": "turbo run build", "dev": "turbo run dev --parallel", "test": "turbo run test", + "test-ci": "turbo run test-ci", "lint": "turbo run lint", "deploy": "turbo run deploy", "format": "prettier --write \"**/*.{ts,tsx,md}\"" diff --git a/packages/react/package.json b/packages/react/package.json index 033ad4d..9c91b40 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -33,6 +33,7 @@ "build-theme": "cunningham -o src -g css,ts,js", "preview": "vite preview", "test": "FORCE_COLOR=1 vitest run", + "test-ci": "VITEST_MIN_THREADS=1 VITEST_MAX_THREADS=3 FORCE_COLOR=1 vitest run --shard $(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL", "test-watch": "vitest", "coverage": "vitest run --coverage", "storybook": "storybook dev -p 6006", diff --git a/packages/tokens/package.json b/packages/tokens/package.json index ac3a29c..b3141cb 100644 --- a/packages/tokens/package.json +++ b/packages/tokens/package.json @@ -25,11 +25,12 @@ "scripts": { "lint": "eslint . 'src/**/*.{ts,tsx}'", "dev": "nodemon --watch 'src/bin' --ext '*' --exec 'yarn build'", - "build-bin": "cd src/bin && tsc -p tsconfig.json && tsc-alias && chmod +x ../../dist/bin/Main.js", + "build-bin": "cd src/bin && rm -rf ../../dist/bin && tsc -p tsconfig.build.json && tsc-alias && chmod +x ../../dist/bin/Main.js", "build-lib": "cp dist/cunningham-tokens.ts src/lib && cd src/lib && tsc -p tsconfig.json", "build": "yarn build-bin && yarn build-default-theme && yarn build-lib && cd ../.. && ln -sf ../../packages/tokens/dist/bin/Main.js node_modules/.bin/cunningham", "build-default-theme": "./dist/bin/Main.js -o dist -s html -g scss,css,js,ts --utility-classes", - "test": "FORCE_COLOR=1 jest --runInBand --verbose src" + "test": "FORCE_COLOR=1 jest --runInBand --verbose src", + "test-ci": "FORCE_COLOR=1 jest -w 3 --shard $(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL src" }, "dependencies": { "chalk": "4.1.2", diff --git a/packages/tokens/src/bin/tsconfig.build.json b/packages/tokens/src/bin/tsconfig.build.json new file mode 100644 index 0000000..c4cfa85 --- /dev/null +++ b/packages/tokens/src/bin/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "./__mocks__", + "./tests", + "**/*.spec.ts", + ] +} diff --git a/packages/tokens/src/bin/tsconfig.json b/packages/tokens/src/bin/tsconfig.json index c10559d..dd90337 100644 --- a/packages/tokens/src/bin/tsconfig.json +++ b/packages/tokens/src/bin/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "@openfun/typescript-configs/node.json", "include": [ - "**/*", + "**/*" ], "compilerOptions": { "baseUrl": "./", @@ -9,6 +9,6 @@ "*": ["*"] }, "resolveJsonModule": true, - "outDir": "../../dist/bin", - } -} \ No newline at end of file + "outDir": "../../dist/bin" + }, +} diff --git a/turbo.json b/turbo.json index a39f23d..c552bf4 100644 --- a/turbo.json +++ b/turbo.json @@ -27,6 +27,15 @@ "test/**/*.tsx" ] }, + "test-ci": { + "outputs": [], + "inputs": [ + "src/**/*.tsx", + "src/**/*.ts", + "test/**/*.ts", + "test/**/*.tsx" + ] + }, "deploy": { "dependsOn": [ "build", diff --git a/yarn.lock b/yarn.lock index 7436633..30cb18d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4654,7 +4654,7 @@ resolved "https://registry.yarnpkg.com/@tanstack/table-core/-/table-core-8.9.3.tgz#991da6b015f6200fdc841c48048bee5e197f6a46" integrity sha512-NpHZBoHTfqyJk0m/s/+CSuAiwtebhYK90mDuf5eylTvgViNOujiaOaxNDxJkQQAsVvHWZftUGAx1EfO1rkKtLg== -"@testing-library/dom@9.3.1": +"@testing-library/dom@^9.0.0", "@testing-library/dom@9.3.1": version "9.3.1" resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.1.tgz#8094f560e9389fb973fe957af41bf766937a9ee9" integrity sha512-0DGPd9AR3+iDTjGoMpxIkAsUihHZ3Ai6CneU6bRRrffXMgzCdlNk43jTrD2/5LT6CBb3MWTP8v510JzYtahD2w== @@ -4668,20 +4668,6 @@ lz-string "^1.5.0" pretty-format "^27.0.2" -"@testing-library/dom@^9.0.0": - version "9.3.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.0.tgz#ed8ce10aa5e05eb6eaf0635b5b8975d889f66075" - integrity sha512-Dffe68pGwI6WlLRYR2I0piIkyole9cSBH5jGQKCGMRpHW5RHCqAUaqc2Kv0tUyd4dU4DLPKhJIjyKOnjv4tuUw== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/runtime" "^7.12.5" - "@types/aria-query" "^5.0.1" - aria-query "^5.0.0" - chalk "^4.1.0" - dom-accessibility-api "^0.5.9" - lz-string "^1.5.0" - pretty-format "^27.0.2" - "@testing-library/jest-dom@5.16.5": version "5.16.5" resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.5.tgz#3912846af19a29b2dbf32a6ae9c31ef52580074e"