Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: read config file on Windows #3921

Merged
merged 4 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ jobs:
- name: Test WebPageReplay with Chrome
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b chrome
- name: Test WebPageReplay with Firefox
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io --network=host -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b firefox --browsertime.firefox.acceptInsecureCerts true
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io --network=host -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b firefox --browsertime.firefox.acceptInsecureCerts true
- name: Run Chrome test with config
run: docker run --rm -v "$(pwd)":/sitespeed.io --network=host sitespeedio/sitespeed.io http://127.0.0.1:3001 -b chrome --config test/exampleConfig.json
4 changes: 3 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ jobs:
- name: Run test with Influx 1.8
run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --xvfb --logToFile
- name: Run test with Influx 2.6.1
run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb
run: bin/sitespeed.js http://127.0.0.1:3001/simple/ -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb
- name: Run Chrome test with config
run: node bin/sitespeed.js --config test/exampleConfig.json http://127.0.0.1:3001/simple/ --xvfb
2 changes: 2 additions & 0 deletions .github/workflows/safari.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
run: (serve test/data/html/ -l 3001&)
- name: Run test
run: bin/sitespeed.js -b safari http://127.0.0.1:3001/
- name: Run Safari test with config
run: node bin/sitespeed.js -b safari --config test/exampleConfig.json http://127.0.0.1:3001/
3 changes: 3 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ jobs:
- name: Run Edge test with scripting
run: node bin/sitespeed.js -b edge --multi test/prepostscripts/multiWindows.cjs -n 1
shell: cmd
- name: Run Edge test with config
run: node bin/sitespeed.js -b edge --config test/exampleConfig.json https://www.sitespeed.io/
shell: cmd

4 changes: 1 addition & 3 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2064,9 +2064,7 @@ export async function parseCommandLine() {

if (argv.config) {
const config = JSON.parse(
await readFileSync(
new URL(resolve(process.cwd(), argv.config), import.meta.url)
)
await readFileSync(resolve(process.cwd(), argv.config))
);
explicitOptions = merge(explicitOptions, config);
}
Expand Down
5 changes: 5 additions & 0 deletions test/exampleConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"browsertime": {
"iterations" : 1
}
}