1- <!-- markdownlint-disable MD024 -->
2-
31# Testing (and building) jQuery
42
53> [ !IMPORTANT]
64> In order to keep the version PRs clean, you will need to use different branches depending on whether you want to run the jQuery tests, build jQuery, or run the A/B CVE tests. For the A/B CVE tests, you need to checkout the ` main ` branch. For the jQuery tests or to build jQuery, you need to checkout the branch of the version you are interested in, e.g. ` 1.6.5-sec ` .
75
8- ## Prerequisites
6+ ## jQuery tests
7+
8+ ### Prerequisites
99
1010- [ Make] ( https://en.wikipedia.org/wiki/Make_(software) )
1111- Node.js
1212 - Node v20, the current LTS version at the time of this writing is the version used, although you may be successful with other versions
1313- You'll need to install php 5.6 -- a newer version of php will probably work as well, but we used 5.6
1414 - For Macs, We recommend using [ homebrew-php] ( https://github.com/shivammathur/homebrew-php )
15- - For versions up to and including 1.8.3 / 1.8.4-sec, we were able to get away with the built-in php dev server. For later versions, you'll need to have (or install) a proper server.
15+ - For jQuery versions up to and including 1.8.3 / 1.8.4-sec, you can get away with the built-in php dev server along with some symlinks . For later versions of jQuery , you'll need to have (or install) a proper server.
1616 - The path of least resistance is to use ` nginx ` :
1717 - ` brew install nginx `
1818
19- ## Testing
20-
21- ### jQuery tests
22-
23- #### 1.2.6 / 1.2.7-sec
19+ ### 1.2.6 / 1.2.7-sec
2420
2521- Checkout the ` 1.2.6 ` or ` 1.2.7-sec ` branch
2622- Run ` make ` from the root folder of the repo
2723- Open ` /tests/index.html ` in your browser
2824
29- #### 1.3.2 / 1.3.3-sec
25+ ### 1.3.2 / 1.3.3-sec
3026
31- <!-- - Checkout the `1.3.2` or `1.3.3-sec` branch
27+ - Checkout the ` 1.3.2 ` or ` 1.3.3-sec ` branch
3228- Run ` make test ` from the root folder of the repo
33- - Open `/tests/index.html` in your browser -->
29+ - Open ` /tests/index.html ` in your browser
3430
35- #### 1.4.4 / 1.4.5-sec
31+ ### 1.4.4 / 1.4.5-sec
3632
3733- Checkout the ` 1.4.4 ` or ` 1.4.5-sec ` branch
3834- From the root folder of the repo:
4743 - Get the closest QUnit commit to the jQuery version/release:
4844 - ` git checkout 25e4489a5f280e8f0a22ca99ecb401338bb75308 `
4945 - ` cd .. `
50- - Create symlink to src in test folder:
51- - ` ln -s ../src src `
52- - ` cd .. `
5346 - ` make jquery `
54- - Run php server:
55- - ` php -S 127.0.0.1:8000 -t test `
56- - Open ` /tests/index.html ` in your browser
47+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
48+ - if using the php dev server, create a symlink to ` /src ` from the ` / test` folder:
49+ - ` cd test && ln -s ../src src `
5750
58- #### 1.5.2 / 1.5.3-sec
51+ ### 1.5.2 / 1.5.3-sec
5952
6053- Checkout the ` 1.5.2 ` or ` 1.5.3-sec ` branch
6154- From the root folder of the repo:
6255 - ` git submodule update --recursive `
6356 - if you get errors updating submodules, you may need to search for ` [submodule ` and update git:// urls to https://
64- - ` cd test `
65- - Create symlink to src in test folder:
66- - ` ln -s ../src src `
67- - ` cd .. `
6857 - ` make `
69- - Run php server:
70- - ` php -S 127.0.0.1:8000 -t test `
71- - Open ` /tests/index.html ` in your browser
58+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
59+ - if using the php dev server, create a symlink to ` /src ` from the ` / test` folder:
60+ - ` cd test && ln -s ../src src `
7261
73- #### 1.6.4 / 1.6.5-sec
62+ ### 1.6.4 / 1.6.5-sec
7463
7564- Checkout the ` 1.6.4 ` or ` 1.6.5-sec ` branch
7665- From the root folder of the repo:
7766 - ` git submodule update --recursive `
7867 - if you get errors updating submodules, you may need to search for ` [submodule ` and update git:// urls to https://
79- - Run php server:
80- - ` php -S 127.0.0.1:8000 -t test `
81- - Open ` 127.0.0.1:8000/tests/index.html ` in your browser
68+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
8269
83- #### 1.7.2 / 1.7.3-sec
70+ ### 1.7.2 / 1.7.3-sec
8471
8572- Checkout the ` 1.7.2 ` or ` 1.7.3-sec ` branch
8673- From the root folder of the repo:
8774 - ` git submodule update --recursive `
8875 - if you get errors updating submodules, you may need to search for ` [submodule ` and update git:// urls to https://
89- - Run php server:
90- - ` php -S 127.0.0.1:8000 -t test `
91- - Open ` 127.0.0.1:8000/tests/index.html ` in your browser
76+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
9277
93- #### 1.8.3 / 1.8.4-sec
78+ ### 1.8.3 / 1.8.4-sec
9479
9580- Checkout the ` 1.8.3 ` or ` 1.8.4-sec ` branch
9681- From the root folder of the repo:
10691 - Modify both files to ` require('fs') ` and change ` path.existsSync() ` to ` fs.existsSync() `
10792 - Run ` grunt `
10893 - It should work now
109- - ` cd test `
110- - Create symlink to dist in test folder:
111- - ` ln -s ../dist dist `
112- - ` cd .. `
113- - Run php server:
114- - ` php -S 127.0.0.1:8000 -t test `
115- - Open ` 127.0.0.1:8000/tests/index.html ` in your browser
94+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
95+ - if using the php dev server, create a symlink to ` /dist ` from the ` /test ` folder:
96+ - ` cd test && ln -s ../dist dist `
11697
117- #### 1.12.4 / 1.12.5-sec
98+ ### 1.12.4 / 1.12.5-sec
11899
119100- Checkout the ` 1.12.4 ` or ` 1.12.5-sec ` branch
120101- From the root folder of the repo:
121102 - ` npm i -g grunt-cli `
122103 - Add the following ` overrides ` object to ` package.json ` :
123104 -` "overrides": { "graceful-fs": "^4.2.11" } `
124105 - Run ` grunt `
125- - If you get an error about ` os.tmpDir() ` in ` node_modules/npm/node_modules/osenv/osenv.js ` then:
106+ - If you get an error about ` os.tmpDir() ` in ` node_modules/npm/node_modules/osenv/osenv.js ` then:
126107 - Modify that file to call ` os.tmpdir() ` instead of ` os.tmpDir() `
127108 - ` grunt ` should work now
128- - A pre-configured ` nginx ` configuration file (` nginx.conf ` ) is in the root of the repo
129- - Modify the first two paths near the top of the file to suit your filesystem
130- - In a separate terminal window, run ` nginx ` , replacing the paths to suit your filesystem:
131- - ` /path/to/nginx/bin/nginx -c /path/to/jquery/repo/nginx.conf -g daemon\ off\; `
132- - ` cd test `
133- - ` brew services start php@5.6 `
134- - Open ` 127.0.0.1/tests/index.html ` in your browser
135- - When you are finished:
136- - ` CTRL+C ` in the terminal where you are running ` nginx `
137- - ` brew services stop php@5.6 `
109+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
138110
139- #### 2.2.4 / 2.2.5-sec
111+ ### 2.2.4 / 2.2.5-sec
140112
141113- Checkout the ` 2.2.4 ` or ` 2.2.5-sec ` branch
142114- From the root folder of the repo:
143115 - ` npm i -g grunt-cli `
144116 - Run ` grunt `
145- - A pre-configured ` nginx ` configuration file (` nginx.conf ` ) is in the root of the repo
146- - Modify the first two paths near the top of the file to suit your filesystem
147- - In a separate terminal window, run ` nginx ` , replacing the paths to suit your filesystem:
148- - ` /path/to/nginx/bin/nginx -c /path/to/jquery/repo/nginx.conf -g daemon\ off\; `
149- - ` cd test `
117+ - Follow the instructions in [ Running a web server] ( #running-a-web-server )
118+
119+ ### Running a web server
120+
121+ it is preferable to use NGINX instead of the php dev server and it is required for version 1.12 and up
122+
123+ #### Using NGINX
124+
125+ - A pre-configured ` nginx ` configuration file (` nginx.conf ` ) is in the root of the repo
126+ - Modify the first two paths near the top of the file to suit your filesystem
127+ - In a separate terminal window, run ` nginx ` , replacing the paths to suit your filesystem:
128+ - ` /path/to/nginx/bin/nginx -c /path/to/nginx.conf -g daemon\ off\; `
129+ - From the ` test/ ` folder of the repo:
150130 - ` brew services start php@5.6 `
151- - Open ` 127.0.0.1 /tests/index.html ` in your browser
131+ - Open ` localhost /tests` in your browser
152132- When you are finished:
153133 - ` CTRL+C ` in the terminal where you are running ` nginx `
154134 - ` brew services stop php@5.6 `
155135
156- ### A/B end-to-end acceptance tests
136+ #### Using php dev server
137+
138+ - From the root folder of the repo:
139+ - ` php -S localhost:8000 -t test `
140+ - Open ` localhost:8000/tests ` in your browser
141+
142+ ## A/B end-to-end acceptance tests
157143
158144Tests run on every push in CI via [ GitHub workflow] ( https://github.com/ctcpip/jquery-security-patches/actions/workflows/security-test.yml )
159145
160146You can run the A/B tests locally in CI mode or manually in the browser
161147
162- #### How to run A/B end-to-end acceptance tests in CI mode
148+ ### How to run A/B end-to-end acceptance tests in CI mode
163149
164150- Checkout the ` main ` branch
165151- Run ` nom test ` in ` /security/test `
166152- Rejoice!
167153
168- #### How to run A/B end-to-end acceptance tests manually
154+ ### How to run A/B end-to-end acceptance tests manually
169155
170156- Checkout the ` main ` branch
171157- Run ` nom run serve ` in ` /security/test `
@@ -175,83 +161,3 @@ You can run the A/B tests locally in CI mode or manually in the browser
175161- Check the ` Patched ` checkbox to load the patched version of the jQuery version you selected
176162- An attempt is made to trigger all CVEs automatically, but you can attempt to trigger them again by clicking their respective buttons
177163- Rejoice!
178-
179- ## Building
180-
181- ### 1.2.6 / 1.2.7-sec
182-
183- - Checkout the ` 1.2.6 ` or ` 1.2.7-sec ` branch
184- - Run ` make jquery ` from the root folder of the repo
185- - This will output ` ./dist/jquery.js `
186-
187- ### 1.3.2 / 1.3.3-sec
188-
189- - Checkout the ` 1.3.2 ` or ` 1.3.3-sec ` branch
190- - Run ` make jquery ` from the root folder of the repo
191- - This will output ` ./dist/jquery.js `
192-
193- ### 1.4.4 / 1.4.5-sec
194-
195- - Checkout the ` 1.4.4 ` or ` 1.4.5-sec ` branch
196- - From the root folder of the repo:
197- - Run ` make jquery `
198- - This will output ` ./dist/jquery.js `
199-
200- #### 1.5.2 / 1.5.3-sec
201-
202- - Checkout the ` 1.5.2 ` or ` 1.5.3-sec ` branch
203- - From the root folder of the repo:
204- - Run ` make `
205- - This will output ` ./dist/jquery.js `
206-
207- ### 1.6.4 / 1.6.5-sec
208-
209- - Checkout the ` 1.6.4 ` or ` 1.6.5-sec ` branch
210- - From the root folder of the repo:
211- - Run ` make `
212- - This will output ` ./dist/jquery.js `
213-
214- #### 1.7.2 / 1.7.3-sec
215-
216- - Checkout the ` 1.7.2 ` or ` 1.7.3-sec ` branch
217- - From the root folder of the repo:
218- - Run ` make `
219- - This will output ` ./dist/jquery.js `
220-
221- #### 1.8.3 / 1.8.4-sec
222-
223- - Checkout the ` 1.8.3 ` or ` 1.8.4-sec ` branch
224- - From the root folder of the repo:
225- - ` git submodule update --recursive `
226- - If you get errors updating submodules, you may need to search for ` [submodule ` and update git:// urls to https://
227- - Globally install the requisite ancient version of grunt: ` npm i grunt@0.3.9 -g `
228- - ` npm i `
229- - Modify the ` grunt.js ` file
230- - Remove ` submodules ` from the default grunt task
231- - Remove ` compare_size ` from default grunt task
232- - Run ` grunt `
233- - You should get errors about ` path.existsSync() ` in ` node_modules/grunt/lib/util/findup.js ` and in ` node_modules/grunt/bin/grunt `
234- - Modify both files to ` require('fs') ` and change ` path.existsSync() ` to ` fs.existsSync() `
235- - Run ` grunt `
236- - This will output ` ./dist/jquery.js `
237-
238- #### 1.12.4 / 1.12.5-sec
239-
240- - Checkout the ` 1.12.4 ` or ` 1.12.5-sec ` branch
241- - From the root folder of the repo:
242- - ` npm i -g grunt-cli `
243- - Add the following ` overrides ` object to ` package.json ` :
244- -` "overrides": { "graceful-fs": "^4.2.11" } `
245- - Run ` grunt `
246- - If you get an error about ` os.tmpDir() ` in ` node_modules/npm/node_modules/osenv/osenv.js ` then:
247- - Modify that file to call ` os.tmpdir() ` instead of ` os.tmpDir() `
248- - ` grunt ` should work now
249- - This will output ` ./dist/jquery.js `
250-
251- #### 2.2.4 / 2.2.5-sec
252-
253- - Checkout the ` 2.2.4 ` or ` 2.2.5-sec ` branch
254- - From the root folder of the repo:
255- - ` npm i -g grunt-cli `
256- - Run ` grunt `
257- - This will output ` ./dist/jquery.js `
0 commit comments