From f41396862079334af9440d64aad61238f936e815 Mon Sep 17 00:00:00 2001 From: David Hu Date: Mon, 2 May 2022 23:36:41 -0400 Subject: [PATCH] migrate from circle-ci to github actions for tests (#466) --- .circleci/config.yml | 29 ------ .github/workflows/tests.yml | 89 +++++++++++++++++++ .../__snapshots__/BarLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/BeatLoader-tests.tsx.snap | 24 +++-- .../__snapshots__/BounceLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/CircleLoader-tests.tsx.snap | 44 +++++---- .../ClimbingBoxLoader-tests.tsx.snap | 86 +++--------------- .../__snapshots__/ClipLoader-tests.tsx.snap | 8 +- .../__snapshots__/ClockLoader-tests.tsx.snap | 16 ++-- .../__snapshots__/DotLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/FadeLoader-tests.tsx.snap | 68 +++++++------- .../__snapshots__/GridLoader-tests.tsx.snap | 60 ++++++------- .../__snapshots__/HashLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/MoonLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/PacmanLoader-tests.tsx.snap | 52 +++++------ .../PropagateLoader-tests.tsx.snap | 52 +++++------ .../__snapshots__/PuffLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/PulseLoader-test.tsx.snap | 26 +++--- .../__snapshots__/RingLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/RiseLoader-tests.tsx.snap | 36 ++++---- .../__snapshots__/RotateLoader-tests.tsx.snap | 20 ++--- .../__snapshots__/ScaleLoader-tests.tsx.snap | 42 ++++----- .../__snapshots__/SkewLoader-tests.tsx.snap | 8 +- .../__snapshots__/SquareLoader-tests.tsx.snap | 8 +- .../__snapshots__/SyncLoader-tests.tsx.snap | 26 +++--- __tests__/sharedSpecs/lengthSpecs.tsx | 3 + jest.config.js | 3 +- package.json | 2 +- 28 files changed, 376 insertions(+), 466 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/tests.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 001c45b3..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 # use CircleCI 2.0 -jobs: # a collection of steps - build: # runs not using Workflows must have a `build` job as entry point - working_directory: ~/react-spinners # directory where steps will run - docker: # run the steps with Docker - - image: circleci/node:latest # ...with this image as the primary container; this is where all `steps` will run - steps: # a collection of executable commands - - checkout # special step to check out source code to working directory - - restore_cache: - name: Restore Yarn Package Cache - keys: - - yarn-packages-{{ checksum "yarn.lock" }} - - run: - name: Install Dependencies - command: yarn install --immutable - - save_cache: - name: Save Yarn Package Cache - key: yarn-packages-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn - - run: - name: Lint issues - command: yarn run lint - - run: - name: Jest tests - command: yarn run jest --silent - - run: - name: Report coverage - command: yarn run coveralls diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..eae222c2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,89 @@ +name: tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: "npm" + - run: npm install --global yarn + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn install + if: steps.yarn-cache.outputs.cache-hit != 'true' + - run: yarn run clean + - run: yarn run test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: "npm" + - run: npm install --global yarn + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn install + if: steps.yarn-cache.outputs.cache-hit != 'true' + - run: yarn run clean + - run: yarn run lint + + demo-site: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: "npm" + - run: npm install --global yarn + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn install + if: steps.yarn-cache.outputs.cache-hit != 'true' + - run: yarn run clean + - run: yarn run build:demo + - name: check if there are changes + id: changes + uses: UnicornGlobal/has-changes-action@v1.0.11 + - name: error has changes + if: steps.changes.outputs.changed == 1 + run: echo "Commit docs changes by running yarn run build:demo" diff --git a/__tests__/__snapshots__/BarLoader-tests.tsx.snap b/__tests__/__snapshots__/BarLoader-tests.tsx.snap index d99b3b78..2728ecdc 100644 --- a/__tests__/__snapshots__/BarLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/BarLoader-tests.tsx.snap @@ -35,7 +35,7 @@ exports[`BarLoader common specs should match snapshot 1`] = ` } } -.emotion-018btcsr { +.emotion-0 { position: relative; width: 100px; height: 4px; @@ -45,7 +45,7 @@ exports[`BarLoader common specs should match snapshot 1`] = ` background-clip: padding-box; } -.emotion-09u87m4 { +.emotion-1 { position: absolute; height: 4px; overflow: hidden; @@ -61,7 +61,7 @@ exports[`BarLoader common specs should match snapshot 1`] = ` animation: animation-0 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; } -.emotion-05pouuy { +.emotion-2 { position: absolute; height: 4px; overflow: hidden; @@ -89,15 +89,11 @@ exports[`BarLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/BeatLoader-tests.tsx.snap b/__tests__/__snapshots__/BeatLoader-tests.tsx.snap index 038828d6..106ed8b8 100644 --- a/__tests__/__snapshots__/BeatLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/BeatLoader-tests.tsx.snap @@ -37,7 +37,7 @@ exports[`BeatLoader common specs should match snapshot 1`] = ` } } -.emotion-0110do72 { +.emotion-1 { display: inline-block; background-color: #000000; width: 15px; @@ -50,7 +50,7 @@ exports[`BeatLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01by9rry { +.emotion-2 { display: inline-block; background-color: #000000; width: 15px; @@ -75,18 +75,14 @@ exports[`BeatLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - + className="emotion-1" + /> + + `; diff --git a/__tests__/__snapshots__/BounceLoader-tests.tsx.snap b/__tests__/__snapshots__/BounceLoader-tests.tsx.snap index 01fce2c2..d9c67f4f 100644 --- a/__tests__/__snapshots__/BounceLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/BounceLoader-tests.tsx.snap @@ -33,13 +33,13 @@ exports[`BounceLoader common specs should match snapshot 1`] = ` } } -.emotion-0mz0q36 { +.emotion-0 { position: relative; width: 60px; height: 60px; } -.emotion-014hgwh { +.emotion-1 { position: absolute; height: 60px; width: 60px; @@ -54,7 +54,7 @@ exports[`BounceLoader common specs should match snapshot 1`] = ` animation: animation-0 2.1s 1s infinite ease-in-out; } -.emotion-01fymig2 { +.emotion-2 { position: absolute; height: 60px; width: 60px; @@ -80,15 +80,11 @@ exports[`BounceLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/CircleLoader-tests.tsx.snap b/__tests__/__snapshots__/CircleLoader-tests.tsx.snap index 259ceb15..f6f3044c 100644 --- a/__tests__/__snapshots__/CircleLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/CircleLoader-tests.tsx.snap @@ -116,13 +116,13 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` } } -.emotion-0yrmx0p { +.emotion-0 { position: relative; width: 50px; height: 50px; } -.emotion-018jumju { +.emotion-1 { position: absolute; height: 50px; width: 50px; @@ -140,7 +140,7 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` animation: animation-0 1s 0s infinite linear; } -.emotion-01ix8i79 { +.emotion-2 { position: absolute; height: 45px; width: 45px; @@ -158,7 +158,7 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` animation: animation-0 1s 0.2s infinite linear; } -.emotion-0mdd9ud { +.emotion-3 { position: absolute; height: 40px; width: 40px; @@ -176,7 +176,7 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` animation: animation-0 1s 0.4s infinite linear; } -.emotion-0qbu4to { +.emotion-4 { position: absolute; height: 35px; width: 35px; @@ -194,7 +194,7 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` animation: animation-0 1s 0.6000000000000001s infinite linear; } -.emotion-01wtwgn9 { +.emotion-5 { position: absolute; height: 30px; width: 30px; @@ -223,24 +223,20 @@ exports[`CircleLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - + className="emotion-1" + /> + + + + `; diff --git a/__tests__/__snapshots__/ClimbingBoxLoader-tests.tsx.snap b/__tests__/__snapshots__/ClimbingBoxLoader-tests.tsx.snap index 3e0b1ec8..981ba0f2 100644 --- a/__tests__/__snapshots__/ClimbingBoxLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/ClimbingBoxLoader-tests.tsx.snap @@ -80,13 +80,13 @@ exports[`ClimbingBoxLoader common specs should match snapshot 1`] = ` } } -.emotion-0fpqs8j { +.emotion-0 { position: relative; width: 7.1em; height: 7.1em; } -.emotion-019shb47 { +.emotion-1 { position: absolute; top: 50%; left: 50%; @@ -97,7 +97,7 @@ exports[`ClimbingBoxLoader common specs should match snapshot 1`] = ` font-size: 15px; } -.emotion-0bujqyr { +.emotion-2 { position: absolute; left: 0; bottom: -0.1em; @@ -116,7 +116,7 @@ exports[`ClimbingBoxLoader common specs should match snapshot 1`] = ` animation: animation-0 2.5s infinite cubic-bezier(0.79, 0, 0.47, 0.97); } -.emotion-0o4f6ni { +.emotion-3 { position: absolute; width: 7.1em; height: 7.1em; @@ -140,80 +140,14 @@ exports[`ClimbingBoxLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - - + className="emotion-2" + /> + diff --git a/__tests__/__snapshots__/ClipLoader-tests.tsx.snap b/__tests__/__snapshots__/ClipLoader-tests.tsx.snap index 782d2a0e..38287050 100644 --- a/__tests__/__snapshots__/ClipLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/ClipLoader-tests.tsx.snap @@ -24,7 +24,7 @@ exports[`ClipLoader common specs should match snapshot 1`] = ` } } -.emotion-0q3o1l2 { +.emotion-0 { background: transparent!important; width: 35px; height: 35px; @@ -48,10 +48,6 @@ exports[`ClipLoader common specs should match snapshot 1`] = ` > - - + /> `; diff --git a/__tests__/__snapshots__/ClockLoader-tests.tsx.snap b/__tests__/__snapshots__/ClockLoader-tests.tsx.snap index aba188a0..032f1083 100644 --- a/__tests__/__snapshots__/ClockLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/ClockLoader-tests.tsx.snap @@ -19,7 +19,7 @@ exports[`ClockLoader common specs should match snapshot 1`] = ` } } -.emotion-032xao6 { +.emotion-0 { position: relative; width: 50px; height: 50px; @@ -28,14 +28,14 @@ exports[`ClockLoader common specs should match snapshot 1`] = ` border-radius: 50%; } -.emotion-032xao6:after, -.emotion-032xao6:before { +.emotion-0:after, +.emotion-0:before { position: absolute; content: ""; background-color: #000000; } -.emotion-032xao6:after { +.emotion-0:after { width: 20.833333333333336px; height: 2px; top: 24px; @@ -45,7 +45,7 @@ exports[`ClockLoader common specs should match snapshot 1`] = ` animation: animation-0 2s linear infinite; } -.emotion-032xao6:before { +.emotion-0:before { width: 16.666666666666668px; height: 2px; top: 24px; @@ -64,10 +64,6 @@ exports[`ClockLoader common specs should match snapshot 1`] = ` > - - + /> `; diff --git a/__tests__/__snapshots__/DotLoader-tests.tsx.snap b/__tests__/__snapshots__/DotLoader-tests.tsx.snap index 709bf328..97508b42 100644 --- a/__tests__/__snapshots__/DotLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/DotLoader-tests.tsx.snap @@ -42,7 +42,7 @@ exports[`DotLoader common specs should match snapshot 1`] = ` } } -.emotion-01kttl6 { +.emotion-0 { position: relative; width: 60px; height: 60px; @@ -52,7 +52,7 @@ exports[`DotLoader common specs should match snapshot 1`] = ` animation: animation-0 2s 0s infinite linear; } -.emotion-09m4dtm { +.emotion-1 { position: absolute; top: 0; bottom: auto; @@ -66,7 +66,7 @@ exports[`DotLoader common specs should match snapshot 1`] = ` animation: animation-1 2s 0s infinite linear; } -.emotion-0rv9a72 { +.emotion-2 { position: absolute; top: auto; bottom: 0; @@ -91,15 +91,11 @@ exports[`DotLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/FadeLoader-tests.tsx.snap b/__tests__/__snapshots__/FadeLoader-tests.tsx.snap index 95b610b1..5c84ddba 100644 --- a/__tests__/__snapshots__/FadeLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/FadeLoader-tests.tsx.snap @@ -81,7 +81,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` } } -.emotion-0kud8pv { +.emotion-0 { position: relative; font-size: 0; top: 20px; @@ -90,7 +90,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` height: 60px; } -.emotion-0ls5g3w { +.emotion-1 { position: absolute; width: 5px; height: 15px; @@ -107,7 +107,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` left: 0; } -.emotion-09mx5xc { +.emotion-2 { position: absolute; width: 5px; height: 15px; @@ -128,7 +128,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` transform: rotate(-45deg); } -.emotion-0fkrw1z { +.emotion-3 { position: absolute; width: 5px; height: 15px; @@ -149,7 +149,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` transform: rotate(90deg); } -.emotion-0w0winf { +.emotion-4 { position: absolute; width: 5px; height: 15px; @@ -170,7 +170,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` transform: rotate(45deg); } -.emotion-01caczn4 { +.emotion-5 { position: absolute; width: 5px; height: 15px; @@ -187,7 +187,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` left: 0; } -.emotion-06e71m9 { +.emotion-6 { position: absolute; width: 5px; height: 15px; @@ -208,7 +208,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` transform: rotate(-45deg); } -.emotion-01ngsrc8 { +.emotion-7 { position: absolute; width: 5px; height: 15px; @@ -229,7 +229,7 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` transform: rotate(90deg); } -.emotion-01e93agn { +.emotion-8 { position: absolute; width: 5px; height: 15px; @@ -264,33 +264,29 @@ exports[`FadeLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - - - - + className="emotion-1" + /> + + + + + + + `; diff --git a/__tests__/__snapshots__/GridLoader-tests.tsx.snap b/__tests__/__snapshots__/GridLoader-tests.tsx.snap index 7cda49c8..bf52d6f5 100644 --- a/__tests__/__snapshots__/GridLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/GridLoader-tests.tsx.snap @@ -26,12 +26,12 @@ exports[`GridLoader common specs should match snapshot 1`] = ` } } -.emotion-0xsm5rw { +.emotion-0 { width: 57px; font-size: 0; } -.emotion-0102g1jc { +.emotion-1 { display: inline-block; background-color: #000000; width: 15px; @@ -56,36 +56,32 @@ exports[`GridLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - - - - - + className="emotion-1" + /> + + + + + + + + `; diff --git a/__tests__/__snapshots__/HashLoader-tests.tsx.snap b/__tests__/__snapshots__/HashLoader-tests.tsx.snap index adbea38d..75f892d3 100644 --- a/__tests__/__snapshots__/HashLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/HashLoader-tests.tsx.snap @@ -43,7 +43,7 @@ exports[`HashLoader common specs should match snapshot 1`] = ` } } -.emotion-0606pct { +.emotion-0 { position: relative; width: 50px; height: 50px; @@ -53,7 +53,7 @@ exports[`HashLoader common specs should match snapshot 1`] = ` transform: rotate(165deg); } -.emotion-013gcv1c { +.emotion-1 { position: absolute; content: ""; top: 50%; @@ -72,7 +72,7 @@ exports[`HashLoader common specs should match snapshot 1`] = ` animation: animation-0 2s infinite; } -.emotion-0c0c1dy { +.emotion-2 { position: absolute; content: ""; top: 50%; @@ -102,15 +102,11 @@ exports[`HashLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/MoonLoader-tests.tsx.snap b/__tests__/__snapshots__/MoonLoader-tests.tsx.snap index 0be86710..c6e3b40c 100644 --- a/__tests__/__snapshots__/MoonLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/MoonLoader-tests.tsx.snap @@ -19,7 +19,7 @@ exports[`MoonLoader common specs should match snapshot 1`] = ` } } -.emotion-01683kmo { +.emotion-0 { position: relative; width: 77.14285714285714px; height: 77.14285714285714px; @@ -29,7 +29,7 @@ exports[`MoonLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-042s4e8 { +.emotion-1 { width: 8.571428571428571px; height: 8.571428571428571px; border-radius: 100%; @@ -43,7 +43,7 @@ exports[`MoonLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-0mhu5ag { +.emotion-2 { width: 60px; height: 60px; border-radius: 100%; @@ -64,15 +64,11 @@ exports[`MoonLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/PacmanLoader-tests.tsx.snap b/__tests__/__snapshots__/PacmanLoader-tests.tsx.snap index f210b3ee..d78f6862 100644 --- a/__tests__/__snapshots__/PacmanLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/PacmanLoader-tests.tsx.snap @@ -85,14 +85,14 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` } } -.emotion-0113v409 { +.emotion-0 { position: relative; font-size: 0; height: 25px; width: 25px; } -.emotion-0e1cvz7 { +.emotion-1 { width: 0; height: 0; border-right: 25px solid transparent; @@ -107,7 +107,7 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01p1b5e4 { +.emotion-2 { width: 0; height: 0; border-right: 25px solid transparent; @@ -122,7 +122,7 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-05j85ug { +.emotion-3 { width: 8.333333333333334px; height: 8.333333333333334px; background-color: #000000; @@ -141,7 +141,7 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01cna3gb { +.emotion-4 { width: 8.333333333333334px; height: 8.333333333333334px; background-color: #000000; @@ -160,7 +160,7 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-0e4u31e { +.emotion-5 { width: 8.333333333333334px; height: 8.333333333333334px; background-color: #000000; @@ -179,7 +179,7 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-030u7o4 { +.emotion-6 { width: 8.333333333333334px; height: 8.333333333333334px; background-color: #000000; @@ -210,27 +210,23 @@ exports[`PacmanLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - - + className="emotion-1" + /> + + + + + `; diff --git a/__tests__/__snapshots__/PropagateLoader-tests.tsx.snap b/__tests__/__snapshots__/PropagateLoader-tests.tsx.snap index 3289f809..b10c17ad 100644 --- a/__tests__/__snapshots__/PropagateLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/PropagateLoader-tests.tsx.snap @@ -167,11 +167,11 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` } } -.emotion-010p2e9r { +.emotion-0 { position: relative; } -.emotion-0119vicx { +.emotion-1 { position: absolute; font-size: 5px; width: 15px; @@ -184,7 +184,7 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-07qd4qk { +.emotion-2 { position: absolute; font-size: 5px; width: 15px; @@ -197,7 +197,7 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-01ol73ma { +.emotion-3 { position: absolute; font-size: 5px; width: 15px; @@ -210,7 +210,7 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-01ch7kc6 { +.emotion-4 { position: absolute; font-size: 5px; width: 15px; @@ -223,7 +223,7 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-01bs6bws { +.emotion-5 { position: absolute; font-size: 5px; width: 15px; @@ -236,7 +236,7 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` animation-fill-mode: forwards; } -.emotion-0jq7hsu { +.emotion-6 { position: absolute; font-size: 5px; width: 15px; @@ -260,27 +260,23 @@ exports[`PropagateLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - - + className="emotion-1" + /> + + + + + `; diff --git a/__tests__/__snapshots__/PuffLoader-tests.tsx.snap b/__tests__/__snapshots__/PuffLoader-tests.tsx.snap index 685f344e..7353d834 100644 --- a/__tests__/__snapshots__/PuffLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/PuffLoader-tests.tsx.snap @@ -53,13 +53,13 @@ exports[`PuffLoader common specs should match snapshot 1`] = ` } } -.emotion-0mz0q36 { +.emotion-0 { position: relative; width: 60px; height: 60px; } -.emotion-01jt58b5 { +.emotion-1 { position: absolute; height: 60px; width: 60px; @@ -82,7 +82,7 @@ exports[`PuffLoader common specs should match snapshot 1`] = ` animation-delay: -1s; } -.emotion-0i1b41b { +.emotion-2 { position: absolute; height: 60px; width: 60px; @@ -116,15 +116,11 @@ exports[`PuffLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/PulseLoader-test.tsx.snap b/__tests__/__snapshots__/PulseLoader-test.tsx.snap index 7a906570..b373bea1 100644 --- a/__tests__/__snapshots__/PulseLoader-test.tsx.snap +++ b/__tests__/__snapshots__/PulseLoader-test.tsx.snap @@ -79,7 +79,7 @@ exports[`PulseLoader common specs should match snapshot 1`] = ` } } -.emotion-01wl1zro { +.emotion-1 { background-color: #000000; width: 15px; height: 15px; @@ -92,7 +92,7 @@ exports[`PulseLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-0nfvbbo { +.emotion-2 { background-color: #000000; width: 15px; height: 15px; @@ -105,7 +105,7 @@ exports[`PulseLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01xsdpkx { +.emotion-3 { background-color: #000000; width: 15px; height: 15px; @@ -130,18 +130,14 @@ exports[`PulseLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - + className="emotion-1" + /> + + `; diff --git a/__tests__/__snapshots__/RingLoader-tests.tsx.snap b/__tests__/__snapshots__/RingLoader-tests.tsx.snap index e90b941c..7985d059 100644 --- a/__tests__/__snapshots__/RingLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/RingLoader-tests.tsx.snap @@ -33,13 +33,13 @@ exports[`RingLoader common specs should match snapshot 1`] = ` } } -.emotion-01n5ab60 { +.emotion-0 { width: 60px; height: 60px; position: relative; } -.emotion-0hajlmr { +.emotion-1 { position: absolute; top: 0; left: 0; @@ -55,7 +55,7 @@ exports[`RingLoader common specs should match snapshot 1`] = ` animation: animation-0 2s 0s infinite linear; } -.emotion-0vrt42o { +.emotion-2 { position: absolute; top: 0; left: 0; @@ -82,15 +82,11 @@ exports[`RingLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/RiseLoader-tests.tsx.snap b/__tests__/__snapshots__/RiseLoader-tests.tsx.snap index 1256723c..1534109f 100644 --- a/__tests__/__snapshots__/RiseLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/RiseLoader-tests.tsx.snap @@ -75,7 +75,7 @@ exports[`RiseLoader common specs should match snapshot 1`] = ` } } -.emotion-01yp393e { +.emotion-1 { background-color: #000000; width: 15px; height: 15px; @@ -88,7 +88,7 @@ exports[`RiseLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-010df5wf { +.emotion-2 { background-color: #000000; width: 15px; height: 15px; @@ -113,24 +113,20 @@ exports[`RiseLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - + className="emotion-1" + /> + + + + `; diff --git a/__tests__/__snapshots__/RotateLoader-tests.tsx.snap b/__tests__/__snapshots__/RotateLoader-tests.tsx.snap index fb221e4c..e97d8814 100644 --- a/__tests__/__snapshots__/RotateLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/RotateLoader-tests.tsx.snap @@ -24,7 +24,7 @@ exports[`RotateLoader common specs should match snapshot 1`] = ` } } -.emotion-018iqsyx { +.emotion-0 { background-color: #000000; width: 15px; height: 15px; @@ -37,7 +37,7 @@ exports[`RotateLoader common specs should match snapshot 1`] = ` animation: animation-0 1s 0s infinite cubic-bezier(0.7, -0.13, 0.22, 0.86); } -.emotion-01ho6u3f { +.emotion-1 { background-color: #000000; width: 15px; height: 15px; @@ -48,7 +48,7 @@ exports[`RotateLoader common specs should match snapshot 1`] = ` left: -28px; } -.emotion-017du8st { +.emotion-2 { background-color: #000000; width: 15px; height: 15px; @@ -71,15 +71,11 @@ exports[`RotateLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - + className="emotion-1" + /> + `; diff --git a/__tests__/__snapshots__/ScaleLoader-tests.tsx.snap b/__tests__/__snapshots__/ScaleLoader-tests.tsx.snap index af25df75..d9cfd330 100644 --- a/__tests__/__snapshots__/ScaleLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/ScaleLoader-tests.tsx.snap @@ -116,7 +116,7 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` } } -.emotion-0129peub { +.emotion-1 { background-color: #000000; width: 4px; height: 35px; @@ -129,7 +129,7 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-0prnvxp { +.emotion-2 { background-color: #000000; width: 4px; height: 35px; @@ -142,7 +142,7 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-08el4s5 { +.emotion-3 { background-color: #000000; width: 4px; height: 35px; @@ -155,7 +155,7 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01hf2v34 { +.emotion-4 { background-color: #000000; width: 4px; height: 35px; @@ -168,7 +168,7 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-0tx0a7l { +.emotion-5 { background-color: #000000; width: 4px; height: 35px; @@ -195,24 +195,20 @@ exports[`ScaleLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - - - + className="emotion-1" + /> + + + + `; diff --git a/__tests__/__snapshots__/SkewLoader-tests.tsx.snap b/__tests__/__snapshots__/SkewLoader-tests.tsx.snap index 851cfd19..717e9bb5 100644 --- a/__tests__/__snapshots__/SkewLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/SkewLoader-tests.tsx.snap @@ -31,7 +31,7 @@ exports[`SkewLoader common specs should match snapshot 1`] = ` } } -.emotion-07woid0 { +.emotion-0 { width: 0; height: 0; border-left: 20px solid transparent; @@ -53,10 +53,6 @@ exports[`SkewLoader common specs should match snapshot 1`] = ` > - - + /> `; diff --git a/__tests__/__snapshots__/SquareLoader-tests.tsx.snap b/__tests__/__snapshots__/SquareLoader-tests.tsx.snap index 5744524a..58f1a4df 100644 --- a/__tests__/__snapshots__/SquareLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/SquareLoader-tests.tsx.snap @@ -31,7 +31,7 @@ exports[`SquareLoader common specs should match snapshot 1`] = ` } } -.emotion-0lb4qgw { +.emotion-0 { background-color: #000000; width: 50px; height: 50px; @@ -51,10 +51,6 @@ exports[`SquareLoader common specs should match snapshot 1`] = ` > - - + /> `; diff --git a/__tests__/__snapshots__/SyncLoader-tests.tsx.snap b/__tests__/__snapshots__/SyncLoader-tests.tsx.snap index da69d698..15ec52ae 100644 --- a/__tests__/__snapshots__/SyncLoader-tests.tsx.snap +++ b/__tests__/__snapshots__/SyncLoader-tests.tsx.snap @@ -70,7 +70,7 @@ exports[`SyncLoader common specs should match snapshot 1`] = ` } } -.emotion-01j1i60w { +.emotion-1 { background-color: #000000; width: 15px; height: 15px; @@ -83,7 +83,7 @@ exports[`SyncLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-0wbrves { +.emotion-2 { background-color: #000000; width: 15px; height: 15px; @@ -96,7 +96,7 @@ exports[`SyncLoader common specs should match snapshot 1`] = ` animation-fill-mode: both; } -.emotion-01ctme5z { +.emotion-3 { background-color: #000000; width: 15px; height: 15px; @@ -121,18 +121,14 @@ exports[`SyncLoader common specs should match snapshot 1`] = ` className="emotion-0" > - - - - + className="emotion-1" + /> + + `; diff --git a/__tests__/sharedSpecs/lengthSpecs.tsx b/__tests__/sharedSpecs/lengthSpecs.tsx index 55be1842..2cf2f2ba 100644 --- a/__tests__/sharedSpecs/lengthSpecs.tsx +++ b/__tests__/sharedSpecs/lengthSpecs.tsx @@ -23,10 +23,13 @@ function lengthSpecs(Loader: typeof React.Component, property: string, expectFun }); it(`should render the ${property} with default unit of px when the unit is incorrect`, () => { + const consoleWarnMock = jest.spyOn(console, "warn").mockImplementation(); + const unit = "ad"; const props = { [property]: `${length}${unit}` }; const loader = mount(); expectFunction(loader, 18); + expect(consoleWarnMock).toBeCalled(); }); }); } diff --git a/jest.config.js b/jest.config.js index 1f0af915..bf259ac0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,5 +16,6 @@ module.exports = { testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(t|j)sx?$", moduleFileExtensions: ["ts", "tsx", "js", "jsx"], snapshotSerializers: ["@emotion/jest/serializer", "enzyme-to-json/serializer"], - setupFilesAfterEnv: ["/__tests__/config/enzyme.ts"] + setupFilesAfterEnv: ["/__tests__/config/enzyme.ts"], + testEnvironment: "jsdom" }; diff --git a/package.json b/package.json index cf56c95a..73c0308b 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "watch": "babel-node ./node_modules/.bin/webpack --watch --config ./webpack.config.dev.js", "clean": "rm -rf helpers/; rm -f *Loader.js; rm -f *Loader.d.ts; rm -f index.js; rm -f index.d.ts; rm -f interfaces.js; rm -f interfaces.d.ts; rm -rf docs/js; rm -rf cjs; rm -rf esm; rm -rf umd", "lint": "./node_modules/.bin/eslint src __tests__ examples", - "jest": "./node_modules/.bin/jest --runInBand", + "test": "jest", "coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls", "remove:tag": "npm dist-tag rm react-spinners", "publish:alpha": "npm publish --tag alpha && npm run clean",