Skip to content

Commit

Permalink
Interpret paths relative to config file instead of cwd (#237)
Browse files Browse the repository at this point in the history
Previously, the server root and the benchmark paths were interpreted relative to the current working directory. This meant that a given config could only ever run from one specific working directory, which was confusing and inconvenient. Now, they are interpreted relative to the config file path itself, so the current directory doesn't matter.

Also:

- Update package locks
- Remove outdated chromedriver pinning in CI
- Upgraded CI to Node 16 and the latest versions of the checkout/node actions

Fixes #176
  • Loading branch information
aomarks committed Jul 1, 2022
1 parent 7bf3c57 commit dfd623f
Show file tree
Hide file tree
Showing 14 changed files with 1,565 additions and 1,363 deletions.
26 changes: 10 additions & 16 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,19 @@ jobs:
browsers: chrome-headless, firefox-headless

- job: macos
# Note macos-11 is currently more recent than macos-latest
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#github-hosted-runners
os: macos-11
os: macos-12
browsers: safari

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
cache: npm

- run: npm ci
# TODO(aomarks) The latest chromedriver has updated to 94, but GitHub
# Actions hasn't updated yet. Pin to the earlier verison of chromedriver
# until GitHub Actions updated.
- run: npm install chromedriver@^93.0.0
- run: npm run build

- run: npm test
Expand All @@ -42,21 +36,21 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
cache: npm
- run: npm ci
- run: npm run lint

check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
cache: npm
- run: npm ci
- run: npm run format:check
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,37 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).

<!-- ## Unreleased -->
## Unreleased

- [**BREAKING**] Benchmark and `root` paths are now interpreted relative to the
location of the config file, instead of the current working directory.

For example, a config at path `<repo>/benchmarks/foo/tachometer.json` that
used to look as follows, and had to be run with `<repo>` as the cwd:

```json
{
"root": ".",
"benchmarks": [
{
"url": "benchmarks/foo/index.html"
}
]
}
```

Should now look like this, and can be run from any cwd:

```json
{
"root": "../..",
"benchmarks": [
{
"url": "foo.html"
}
]
}
```

## [0.5.10] 2021-09-27

Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,18 @@ performance isolation.
Use the `--config` flag to control tachometer with a JSON configuration file.
Defaults are the same as the corresponding command-line flags.

All paths in a config file are relative to the path of the config file itself.

You will typically want to set `root` to the directory that contains your
package's `node_modules/` folder, so that the web server will be able to resolve
bare-module imports.

For example, a file called `benchmarks/foo/tachometer.json` might look like
this:

```json
{
"root": "./benchmarks",
"root": "../..",
"sampleSize": 50,
"timeout": 3,
"autoSampleConditions": ["0%", "1%"],
Expand Down
Loading

0 comments on commit dfd623f

Please sign in to comment.