aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-10-16 18:54:54 +0200
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-10-16 18:57:00 +0200
commitcd27f306621d88882df003a9bd32391a3bb95ef3 (patch)
treeac36e9ff1152349449cea78222cf9adddd9db6bc
parentce52a5dbb01c749a710ad99d9ab5f65130c87415 (diff)
downloadjquery-cd27f306621d88882df003a9bd32391a3bb95ef3.tar.gz
jquery-cd27f306621d88882df003a9bd32391a3bb95ef3.zip
Build: Run pretest before test:* npm scripts
Build was already happening in scripts like `test:browser` but those scripts were missing `pretest`, meaning that running `npm install && npm test:browser` may have failed if `pretest` wasn't run before or if its results were out of date. Even worse, with such stale data some tests may erroneously succeed. This also removes a separate `pretest` step from GitHub Actions as it's no longer needed. Closes gh-5338 (cherry picked from commit 1ad66aeb6d7d94f8e4c8e2286569722ca41f9868)
-rw-r--r--.github/workflows/node.js.yml3
-rw-r--r--package.json16
2 files changed, 8 insertions, 11 deletions
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 17167b700..a2001ef33 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -75,9 +75,6 @@ jobs:
run: npm run build && npm run lint
if: matrix.NODE_VERSION == '18.x'
- - name: Prepare tests
- run: npm run pretest
-
- name: Run tests
env:
BROWSERS: ${{ matrix.BROWSERS }}
diff --git a/package.json b/package.json
index 72d2e1c8f..f1ab993a3 100644
--- a/package.json
+++ b/package.json
@@ -18,14 +18,14 @@
"pretest": "npm run qunit-fixture && npm run babel:tests && npm run npmcopy",
"qunit-fixture": "node build/tasks/qunit-fixture.js",
"start": "nodemon --watch src -x \"npm run build:all\"",
- "test:browserless": "npm run test:node_smoke_tests && npm run test:promises_aplus && npm run test:jsdom",
- "test:browser": "npm run build:all && grunt karma:main",
- "test:amd": "npm run build:main && grunt karma:amd",
- "test:jsdom": "npm run build:main && grunt test:jsdom",
- "test:no-deprecated": "npm run build -- -e deprecated && grunt karma:main",
- "test:selector-native": "npm run build -- -e selector && grunt karma:main",
- "test:slim": "npm run build -- --slim && grunt karma:main",
- "test:node_smoke_tests": "npm run build:all && node build/tasks/node_smoke_tests.js",
+ "test:browserless": "npm run pretest && npm run test:node_smoke_tests && npm run test:promises_aplus && npm run test:jsdom",
+ "test:browser": "npm run pretest && npm run build:all && grunt karma:main",
+ "test:amd": "npm run pretest && npm run build:main && grunt karma:amd",
+ "test:jsdom": "npm run pretest && npm run build:main && grunt test:jsdom",
+ "test:no-deprecated": "npm run pretest && npm run build -- -e deprecated && grunt karma:main",
+ "test:selector-native": "npm run pretest && npm run build -- -e selector && grunt karma:main",
+ "test:slim": "npm run pretest && npm run build -- --slim && grunt karma:main",
+ "test:node_smoke_tests": "npm run pretest && npm run build:all && node build/tasks/node_smoke_tests.js",
"test:promises_aplus": "npm run build:main && node build/tasks/promises_aplus_tests.js",
"test": "npm run build:all && npm run lint && npm run test:browserless && npm run test:browser && npm run test:amd && npm run test:slim && npm run test:no-deprecated && npm run test:selector-native"
},