Skip to content

Commit 0187779

Browse files
authored
Dependency updates
* Fix reference to chalk's color level * Upgrade XO and reformat * Update dev dependencies * Update production dependencies * Rebuild lockfile * CI: Continue when 'npm ls' errors in TypeScript compatibility job
1 parent 29024af commit 0187779

File tree

24 files changed

+1868
-2046
lines changed

24 files changed

+1868
-2046
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
env:
5959
TS_VERSION: ${{ matrix.ts-version }}
6060
- run: npm ls typescript
61+
continue-on-error: true
6162
- run: npx tsd
6263

6364
lockfile_churn:

.xo-config.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ module.exports = {
4040
'unicorn/prefer-module': 'off',
4141
},
4242
},
43+
{
44+
files: [
45+
'test/**/fixtures/**',
46+
'test-tap/**fixture/**',
47+
],
48+
rules: {
49+
'unicorn/no-empty-file': 'off',
50+
},
51+
},
4352
{
4453
// TODO: Update tests.
4554
files: 'test/**',

entrypoints/main.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import test from '../lib/worker/main.cjs';
2-
3-
export default test;
1+
export {default} from '../lib/worker/main.cjs';

lib/api.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,13 @@ export default class Api extends Emittery {
232232
}
233233
});
234234

235-
const providerStates = (await Promise.all(providers.map(async ({type, main}) => {
235+
const providerStates = [];
236+
await Promise.all(providers.map(async ({type, main}) => {
236237
const state = await main.compile({cacheDir: this._createCacheDir(), files: testFiles});
237-
return state === null ? null : {type, state};
238-
}))).filter(state => state !== null);
238+
if (state !== null) {
239+
providerStates.push({type, state});
240+
}
241+
}));
239242

240243
// Resolve the correct concurrency value.
241244
let concurrency = Math.min(os.cpus().length, isCi ? 2 : Number.POSITIVE_INFINITY);

lib/chalk.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import chalk from 'chalk';
1+
import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style
22

3-
let instance = new chalk.Instance(); // eslint-disable-line import/no-mutable-exports
4-
export default instance;
3+
let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports
54

6-
export {instance as chalk};
5+
export {chalk};
76

87
let configured = false;
98
export function set(options) {
@@ -12,5 +11,5 @@ export function set(options) {
1211
}
1312

1413
configured = true;
15-
instance = new chalk.Instance(options);
14+
chalk = new Chalk(options);
1615
}

lib/cli.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,12 @@ export default async function loadCli() { // eslint-disable-line complexity
231231
}
232232
}
233233

234-
const chalkOptions = {level: combined.color === false ? 0 : (await import('chalk')).level}; // eslint-disable-line node/no-unsupported-features/es-syntax
234+
const chalkOptions = {level: 0};
235+
if (combined.color !== false) {
236+
const {supportsColor: {level}} = await import('chalk'); // eslint-disable-line node/no-unsupported-features/es-syntax, unicorn/import-style
237+
chalkOptions.level = level;
238+
}
239+
235240
const {set: setChalk} = await import('./chalk.js'); // eslint-disable-line node/no-unsupported-features/es-syntax
236241
setChalk(chalkOptions);
237242

lib/concordance-options.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {inspect} from 'node:util';
22

33
import ansiStyles from 'ansi-styles';
4+
import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style
45
import stripAnsi from 'strip-ansi';
56

67
import {chalk} from './chalk.js';
78

8-
const forceColor = new chalk.Instance({level: Math.max(chalk.level, 1)});
9+
const forceColor = new Chalk({level: Math.max(chalk.level, 1)});
910

1011
const colorTheme = {
1112
boolean: ansiStyles.yellow,

lib/fork.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {fileURLToPath} from 'node:url';
44
import {Worker} from 'node:worker_threads';
55

66
import Emittery from 'emittery';
7-
import pEvent from 'p-event';
7+
import {pEvent} from 'p-event';
88

99
import {controlFlow} from './ipc-flow-control.cjs';
1010
import serializeError from './serialize-error.js';

lib/globs.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,23 @@ import path from 'node:path';
44
import {globby, globbySync} from 'globby';
55

66
import {
7-
classify,
87
defaultIgnorePatterns,
98
hasExtension,
10-
isHelperish,
11-
matches,
129
normalizeFileForMatching,
13-
normalizePattern,
1410
normalizePatterns,
1511
processMatchingPatterns,
1612
} from './glob-helpers.cjs';
1713

1814
export {
1915
classify,
20-
defaultIgnorePatterns,
21-
hasExtension,
2216
isHelperish,
2317
matches,
24-
normalizeFileForMatching,
2518
normalizePattern,
19+
defaultIgnorePatterns,
20+
hasExtension,
21+
normalizeFileForMatching,
2622
normalizePatterns,
27-
};
23+
} from './glob-helpers.cjs';
2824

2925
const defaultIgnoredByWatcherPatterns = [
3026
'**/*.snap.md', // No need to rerun tests when the Markdown files change.
@@ -120,11 +116,13 @@ const globDirectoriesSync = (cwd, patterns) => {
120116
};
121117

122118
export async function findFiles({cwd, extensions, filePatterns}) {
123-
return (await globFiles(cwd, filePatterns)).filter(file => hasExtension(extensions, file));
119+
const files = await globFiles(cwd, filePatterns);
120+
return files.filter(file => hasExtension(extensions, file));
124121
}
125122

126123
export async function findTests({cwd, extensions, filePatterns}) {
127-
return (await findFiles({cwd, extensions, filePatterns})).filter(file => !path.basename(file).startsWith('_'));
124+
const files = await findFiles({cwd, extensions, filePatterns});
125+
return files.filter(file => !path.basename(file).startsWith('_'));
128126
}
129127

130128
export function getChokidarIgnorePatterns({ignoredByWatcherPatterns}) {

lib/load-config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ export async function loadConfig({configFile, resolveFrom = process.cwd(), defau
8686
let searchDir = projectDir;
8787
const stopAt = path.dirname(repoRoot);
8888
do {
89-
[{config: fileConf, fileForErrorMessage, configFile} = {config: NO_SUCH_FILE, fileForErrorMessage: undefined}, ...conflicting] = (await Promise.all([ // eslint-disable-line no-await-in-loop
89+
const results = await Promise.all([ // eslint-disable-line no-await-in-loop
9090
loadConfigFile({projectDir, configFile: path.join(searchDir, 'ava.config.js')}),
9191
loadConfigFile({projectDir, configFile: path.join(searchDir, 'ava.config.cjs')}),
9292
loadConfigFile({projectDir, configFile: path.join(searchDir, 'ava.config.mjs')}),
93-
])).filter(result => result !== null);
93+
]);
94+
95+
[{config: fileConf, fileForErrorMessage, configFile} = {config: NO_SUCH_FILE, fileForErrorMessage: undefined}, ...conflicting] = results.filter(result => result !== null);
9496

9597
searchDir = path.dirname(searchDir);
9698
} while (fileConf === NO_SUCH_FILE && searchDir !== stopAt);

0 commit comments

Comments
 (0)