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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and some minor tweaks #3255

Merged
merged 5 commits into from
Nov 6, 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ts-version: [~5.1]
ts-version: [~5.2]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.tap
/coverage
/media/**/node_modules/
/node_modules/
Expand Down
7 changes: 2 additions & 5 deletions .taprc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
browser: false
coverage: false
disable-coverage: true
allow-empty-coverage: true
files:
- "test-tap/*.js"
- "test-tap/reporters/*.js"
- "test-tap/integration/*.js"
flow: false
jsx: false
timeout: 300
ts: false
3 changes: 3 additions & 0 deletions .xo-config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ module.exports = {
'media/**',
'test/config/fixtures/config-errors/test.js',
'test/line-numbers/fixtures/line-numbers.js',
'test/**/fixtures',
'test-tap/fixture/snapshots/test-sourcemaps/build/**',
'test-tap/fixture/report/edgecases/ast-syntax-error.cjs',
'test-types',
'examples/typescript-*/**/*.ts',
],
rules: {
Expand All @@ -25,6 +27,7 @@ module.exports = {
],
'import/newline-after-import': 'error',
'unicorn/require-post-message-target-origin': 'off',
'unicorn/prefer-event-target': 'off',
},
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/endpoint-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Since tests run concurrently, it's best to create a fresh server instance at lea
Check out the example below:

```js
import http from 'http';
import http from 'node:http';
import test from 'ava';
import got from 'got';
import listen from 'test-listen';
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Translations: [Espa帽ol](https://github.com/avajs/ava-docs/blob/main/es_ES/docs/

AVA comes bundled with a TypeScript definition file. This allows developers to leverage TypeScript for writing tests.

This guide assumes you've already set up TypeScript for your project. Note that AVA's definition expects at least version 5.1.
This guide assumes you've already set up TypeScript for your project. Note that AVA's definition expects at least version 5.2.

## Enabling AVA's support for TypeScript test files

Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/when-to-use-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ As stated in the previous example, using the `t.throws()` assertion with `async`
In most cases, it's a bad idea to use any complex branching inside your tests. A notable exception is for tests that are auto-generated (perhaps from a JSON document). Below `t.plan()` is used to ensure the correctness of the JSON input:

```js
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';

const testData = JSON.parse(fs.readFileSync(new URL('./fixtures/test-definitions.json', import.meta.url)));

Expand Down
2 changes: 1 addition & 1 deletion lib/line-numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sortNumbersAscending = array => {
};

const parseNumber = string => Number.parseInt(string, 10);
const removeAllWhitespace = string => string.replace(/\s/g, '');
const removeAllWhitespace = string => string.replaceAll(/\s/g, '');
const range = (start, end) => Array.from({length: end - start + 1}).fill(start).map((element, index) => element + index);

const parseLineNumbers = suffix => sortNumbersAscending(distinctArray(
Expand Down
2 changes: 1 addition & 1 deletion lib/load-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import process from 'node:process';
import url from 'node:url';

import {isPlainObject} from 'is-plain-object';
import {packageConfig, packageJsonPath} from 'pkg-conf';
import {packageConfig, packageJsonPath} from 'package-config';

const NO_SUCH_FILE = Symbol('no ava.config.js file');
const MISSING_DEFAULT_EXPORT = Symbol('missing default export');
Expand Down
2 changes: 1 addition & 1 deletion lib/parse-test-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const buildTitle = (raw, implementation, args) => {
let value = implementation?.title?.(raw, ...args) ?? raw;
const isValid = typeof value === 'string';
if (isValid) {
value = value.trim().replace(/\s+/g, ' ');
value = value.trim().replaceAll(/\s+/g, ' ');
}

return {
Expand Down
6 changes: 3 additions & 3 deletions lib/reporters/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export default class Reporter {
// we multiplex stdout and stderr into a single stream. However as
// long as stdStream is different from reportStream users can read
// their original output by redirecting the streams.
if (event.chunk[event.chunk.length - 1] !== 0x0A) {
if (event.chunk.at(-1) !== 0x0A) {
this.reportStream.write(os.EOL);
}

Expand All @@ -353,7 +353,7 @@ export default class Reporter {
// we multiplex stdout and stderr into a single stream. However as
// long as stdStream is different from reportStream users can read
// their original output by redirecting the streams.
if (event.chunk[event.chunk.length - 1] !== 0x0A) {
if (event.chunk.at(-1) !== 0x0A) {
this.reportStream.write(os.EOL);
}
}
Expand Down Expand Up @@ -648,7 +648,7 @@ export default class Reporter {
this.lineWriter.writeLine();

if (this.failures.length > 0) {
const lastFailure = this.failures[this.failures.length - 1];
const lastFailure = this.failures.at(-1);
for (const event of this.failures) {
this.writeFailure(event);
if (event !== lastFailure) {
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class TapReporter {
this.reportStream.write(`# ${stripAnsi(title)}${os.EOL}`);
if (evt.logs) {
for (const log of evt.logs) {
const logLines = indentString(log, 4).replace(/^ {4}/gm, '# ');
const logLines = indentString(log, 4).replaceAll(/^ {4}/gm, '# ');
this.reportStream.write(`${logLines}${os.EOL}`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/slash.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function slash(path) {
return path;
}

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

module.exports = slash;
2 changes: 1 addition & 1 deletion lib/snapshot-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function combineEntries({blocks}) {
const combined = new BufferBuilder();

for (const {title, snapshots} of blocks) {
const last = snapshots[snapshots.length - 1];
const last = snapshots.at(-1);
combined.write(`\n\n## ${title}\n\n`);

for (const [index, snapshot] of snapshots.entries()) {
Expand Down
4 changes: 2 additions & 2 deletions lib/worker/channel.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ if (isRunningInChildProcess) {
// Node.js. In order to keep track, explicitly reference before attaching.
handle.ref();

exports.options = selectAvaMessage(handle.channel, 'options').then(message => message.ava.options); // eslint-disable-line unicorn/prefer-top-level-await
exports.peerFailed = selectAvaMessage(handle.channel, 'peer-failed'); // eslint-disable-line unicorn/prefer-top-level-await
exports.options = selectAvaMessage(handle.channel, 'options').then(message => message.ava.options);
exports.peerFailed = selectAvaMessage(handle.channel, 'peer-failed');
exports.send = handle.send.bind(handle);
exports.unref = handle.unref.bind(handle);

Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

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:

Expand Down
Loading