Skip to content

Commit

Permalink
Dependency updates and so forth
Browse files Browse the repository at this point in the history
* Test against typescript@5.0

* Default to Node.js 20

* Upgrade XO

* Add reporter logs for Node.js 20

* Update dev dependencies

* Reduce timeouts in reporter tests

This may cause CI failures especially on Windows, but we do waste a lot of time with these tests.

* Inline slash dependency

We need it available in CJS but the package is now ESM only. It's more bothersome to remember to not upgrade the dependency than to inline it.

* Update dependencies

* Rebuild lockfile

* Use latest Codecov action
  • Loading branch information
novemberborn committed May 24, 2023
1 parent 5558367 commit 784ca4c
Show file tree
Hide file tree
Showing 30 changed files with 2,154 additions and 945 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -33,7 +33,7 @@ jobs:
run: npm install --global npm@^8
- run: npm install --no-audit
- run: npm run cover
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
with:
files: coverage/lcov.info
name: ${{ matrix.os }}/${{ matrix.node-version }}
Expand All @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ts-version: [~4.7, ~4.8, ~4.9]
ts-version: [~4.7, ~4.8, ~4.9, ~5.0]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -66,8 +66,6 @@ jobs:
with:
node-version-file: package.json
cache: npm
- name: Pin npm
run: npm install --global npm@9.3.0
- run: npm install --no-audit
- name: Test package-lock for unexpected modifications
run: |
Expand Down
4 changes: 2 additions & 2 deletions lib/assert.js
Expand Up @@ -55,7 +55,7 @@ export class AssertionError extends Error {
}

export function checkAssertionMessage(assertion, message) {
if (typeof message === 'undefined' || typeof message === 'string') {
if (message === undefined || typeof message === 'string') {
return true;
}

Expand Down Expand Up @@ -253,7 +253,7 @@ function assertExpectations({assertion, actual, expectations, message, prefix, s
});
}

if (typeof expectations.code !== 'undefined' && actual.code !== expectations.code) {
if (expectations.code !== undefined && actual.code !== expectations.code) {
throw new AssertionError({
assertion,
message,
Expand Down
3 changes: 2 additions & 1 deletion lib/glob-helpers.cjs
Expand Up @@ -4,7 +4,8 @@ const process = require('node:process');

const ignoreByDefault = require('ignore-by-default');
const picomatch = require('picomatch');
const slash = require('slash');

const slash = require('./slash.cjs');

const defaultIgnorePatterns = [...ignoreByDefault.directories(), '**/node_modules'];
exports.defaultIgnorePatterns = defaultIgnorePatterns;
Expand Down
8 changes: 3 additions & 5 deletions lib/like-selector.js
Expand Up @@ -24,11 +24,9 @@ export function selectComparable(lhs, selector, circular = new Set()) {

const comparable = Array.isArray(selector) ? [] : {};
for (const [key, rhs] of Object.entries(selector)) {
if (isLikeSelector(rhs)) {
comparable[key] = selectComparable(Reflect.get(lhs, key), rhs, circular);
} else {
comparable[key] = Reflect.get(lhs, key);
}
comparable[key] = isLikeSelector(rhs)
? selectComparable(Reflect.get(lhs, key), rhs, circular)
: Reflect.get(lhs, key);
}

return comparable;
Expand Down
36 changes: 36 additions & 0 deletions lib/slash.cjs
@@ -0,0 +1,36 @@
/*
Inlined from
<https://github.com/sindresorhus/slash/blob/98b618f5a3bfcb5dd374b204868818845b87bb2f/index.js>,
since we need a CJS version.
Copyright 2023 Sindre Sorhus
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

function slash(path) {
const isExtendedLengthPath = path.startsWith('\\\\?\\');

if (isExtendedLengthPath) {
return path;
}

return path.replace(/\\/g, '/');
}

module.exports = slash;
2 changes: 1 addition & 1 deletion lib/snapshot-manager.js
Expand Up @@ -10,10 +10,10 @@ import cbor from 'cbor';
import concordance from 'concordance';
import indentString from 'indent-string';
import mem from 'mem';
import slash from 'slash';
import writeFileAtomic from 'write-file-atomic';

import {snapshotManager as concordanceOptions} from './concordance-options.js';
import slash from './slash.cjs';

// Increment if encoding layout or Concordance serialization versions change. Previous AVA versions will not be able to
// decode buffers generated by a newer version, so changing this value will require a major version bump of AVA itself.
Expand Down

0 comments on commit 784ca4c

Please sign in to comment.