Skip to content

Commit 91c9fc6

Browse files
authored
test: replace the deprecated option (#1097)
1 parent 136de98 commit 91c9fc6

8 files changed

Lines changed: 27 additions & 22 deletions

File tree

‎packages/core/src/__tests__/generators.test.mjs‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const syntheticGenerators = {
102102
};
103103

104104
mock.module('../generators/loader.mjs', {
105-
namedExports: {
105+
exports: {
106106
resolveGeneratorSpecifier: specifier => specifier,
107107
loadGenerator: async specifier => syntheticGenerators[specifier],
108108
loadGenerators: async targets => {
@@ -132,18 +132,22 @@ mock.module('../generators/loader.mjs', {
132132
});
133133

134134
mock.module('../threading/index.mjs', {
135-
defaultExport: () => ({
136-
run: async () => undefined,
137-
destroy: async () => undefined,
138-
}),
135+
exports: {
136+
default: () => ({
137+
run: async () => undefined,
138+
destroy: async () => undefined,
139+
}),
140+
},
139141
});
140142

141143
mock.module('../threading/parallel.mjs', {
142-
defaultExport: () => ({
143-
async *stream() {
144-
// Unused: the mocked generators return their own async generators
145-
},
146-
}),
144+
exports: {
145+
default: () => ({
146+
async *stream() {
147+
// Unused: the mocked generators return their own async generators
148+
},
149+
}),
150+
},
147151
});
148152

149153
const createGenerator = (await import('../generators.mjs')).default;

‎packages/core/src/generators/metadata/utils/__tests__/resolveTypes.test.mjs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import assert from 'node:assert/strict';
22
import { describe, it, mock, beforeEach } from 'node:test';
33

44
const warnings = [];
5-
65
mock.module('../../../../logger/index.mjs', {
7-
defaultExport: {
8-
warn: message => warnings.push(message),
6+
exports: {
7+
default: {
8+
warn: message => warnings.push(message),
9+
},
910
},
1011
});
1112

‎packages/core/src/parsers/__tests__/markdown.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { SemVer } from 'semver';
88

99
let content;
1010
mock.module('../../utils/loaders.mjs', {
11-
namedExports: {
11+
exports: {
1212
loadFromURL: async () => content,
1313
},
1414
});

‎packages/core/src/utils/__tests__/loaders.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, it, mock, afterEach } from 'node:test';
33

44
let fileContent = 'hello from file';
55
mock.module('node:fs/promises', {
6-
namedExports: {
6+
exports: {
77
readFile: async () => fileContent,
88
},
99
});

‎packages/core/src/utils/configuration/__tests__/index.test.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const mockGenerators = {
3636

3737
// Mock modules
3838
mock.module('../../../generators/loader.mjs', {
39-
namedExports: {
39+
exports: {
4040
resolveGeneratorSpecifier: specifier => specifier,
4141
loadGenerator: async specifier => mockGenerators[specifier],
4242
// Defaults are computed from the loaded generators; returning the full
@@ -45,14 +45,14 @@ mock.module('../../../generators/loader.mjs', {
4545
},
4646
});
4747
mock.module('../../../parsers/markdown.mjs', {
48-
namedExports: {
48+
exports: {
4949
parseChangelog: mockParseChangelog,
5050
parseIndex: mockParseIndex,
5151
},
5252
});
5353

5454
mock.module('cosmiconfig', {
55-
namedExports: { cosmiconfig: mockCosmiconfig },
55+
exports: { cosmiconfig: mockCosmiconfig },
5656
});
5757

5858
const {

‎packages/react/src/html/utils/__tests__/config.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { setConfig } from '@doc-kit/core/utils/configuration/index.mjs';
55
import { SemVer } from 'semver';
66

77
mock.module('@node-core/rehype-shiki', {
8-
namedExports: {
8+
exports: {
99
LANGS: [
1010
{ name: 'javascript', aliases: ['js'], displayName: 'JavaScript' },
1111
{ name: 'typescript', aliases: ['ts'], displayName: 'TypeScript' },

‎packages/react/src/html/utils/__tests__/copying.test.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { describe, it, mock, beforeEach } from 'node:test';
44

55
const mockCp = mock.fn(() => Promise.resolve());
66
mock.module('node:fs/promises', {
7-
namedExports: { cp: mockCp },
7+
exports: { cp: mockCp },
88
});
99

1010
const mockLogError = mock.fn();
1111
mock.module('@doc-kit/core/logger/index.mjs', {
12-
defaultExport: { error: mockLogError },
12+
exports: { default: { error: mockLogError } },
1313
});
1414

1515
const { copyStaticAssets } = await import('../copying.mjs');

‎packages/react/src/jsx-ast/utils/__tests__/types.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, it, mock } from 'node:test';
33

44
// Mock remark
55
mock.module('../remark.mjs', {
6-
namedExports: {
6+
exports: {
77
getRemarkRecma: () => ({
88
runSync: () => ({
99
body: [{ expression: 'mock-expression' }],

0 commit comments

Comments
 (0)