Skip to content

Commit

Permalink
update cypress (v9 to v12), vite (v2 to v4) (#134)
Browse files Browse the repository at this point in the history
* update cypress (v9 to v12), vite (v2 to v4)

* run prettier

* fix cypress supportFile
  • Loading branch information
hakanson authored Aug 14, 2023
1 parent eebe071 commit 2c37cec
Show file tree
Hide file tree
Showing 9 changed files with 3,827 additions and 7,947 deletions.
2 changes: 1 addition & 1 deletion tests/vite-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ public/*.json
cypress/fixtures/example-*.json
!cypress/plugins/index.js
!cypress/support/commands.js
!cypress/support/index.js
!cypress/support/e2e.js
13 changes: 13 additions & 0 deletions tests/vite-app/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require("./cypress/plugins/index.js")(on, config);
},
baseUrl: "http://localhost:5173/",
},
});
3 changes: 0 additions & 3 deletions tests/vite-app/cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
11,726 changes: 3,799 additions & 7,927 deletions tests/vite-app/package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions tests/vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"postinstall": "npm run reinstall"
},
"devDependencies": {
"@cypress/webpack-preprocessor": "^5.11.1",
"@rollup/plugin-node-resolve": "^13.1.3",
"cypress": "^9.5.2",
"ts-loader": "^9.2.8",
"ts-node": "^10.7.0",
"typescript": "^4.6.2",
"vite": "^2.9.16"
"@cypress/webpack-preprocessor": "^5.17.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"cypress": "^12.17.3",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"vite": "^4.4.9"
}
}
16 changes: 7 additions & 9 deletions tests/vite-app/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ run_test() {
echo "Cypress test failed :("
TEST_FAILED=true
fi
if [ -z $CI ]; then
# Only bother to kill the backgrounded server if we're not running in CI (but e.g. on a developer laptop)
echo "Sending stop signal to Vite server (PID $VITE_PID) ..."
kill -INT $VITE_PID
echo "Waiting for Vite server to actually stop ..."
wait
echo "Vite server stopped"
fi
if [ ! -z $TEST_FAILED ]; then
return 1
fi
Expand All @@ -46,7 +38,7 @@ main() {

# Run against dev server, which uses esbuild bundler
echo "Starting Cypress tests against Vite dev server ..."
run_test "npm run dev" 3000 "npm run cypress:run"
run_test "npm run dev" 5173 "npm run cypress:run"

# Run against preview server too, which uses rollup bundler
echo "Building Vite app for preview ..."
Expand All @@ -56,3 +48,9 @@ main() {
}

main
if [ -z $CI ]; then
# kill the backgrounded servers if we're not running in CI (e.g. on a developer laptop)
# note: might not run if the test fails - run "ps j" to find the PGID if you need to run pkill yourself
echo "Sending kill signal to (PGID $$) ..."
pkill -2 -g $$
fi

0 comments on commit 2c37cec

Please sign in to comment.