@kubb/core
Version:
Core functionality for Kubb's plugin-based code generation system, providing the foundation for transforming OpenAPI specifications.
67 lines (65 loc) • 1.64 kB
JavaScript
import { getSource, createFile } from './chunk-CAZ37TGB.js';
import { camelCase, pascalCase } from './chunk-GBYHPDPK.js';
import './chunk-YRPOID7E.js';
import path from 'path';
var mockedLogger = {
emit(_type, _message) {
},
on(_type, _message) {
},
consola: {}
};
var createMockedPluginManager = (name) => ({
resolveName: (result) => {
if (result.type === "file") {
return camelCase(name || result.name);
}
if (result.type === "type") {
return pascalCase(result.name);
}
if (result.type === "function") {
return camelCase(result.name);
}
return camelCase(result.name);
},
config: {
output: {
path: "./path"
}
},
resolvePath: ({ baseName }) => baseName,
logger: {
emit(message) {
console.log(message);
},
on(_eventName, _args) {
},
logLevel: 3
},
getPluginByKey: (_pluginKey) => {
return void 0;
},
getFile: ({ name: name2, extname, pluginKey }) => {
const baseName = `${name2}${extname}`;
return {
path: baseName,
baseName,
meta: {
pluginKey
}
};
}
});
var mockedPluginManager = createMockedPluginManager("");
async function matchFiles(files, pre) {
if (!files) {
return void 0;
}
for await (const file of files) {
const source = await getSource(createFile(file), { logger: mockedLogger });
await expect(source).toMatchFileSnapshot(path.join(...["__snapshots__", pre, file.path].filter(Boolean)));
}
}
export { createMockedPluginManager, matchFiles, mockedLogger, mockedPluginManager };
//# sourceMappingURL=mocks.js.map
//# sourceMappingURL=mocks.js.map