Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@betterer/betterer

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betterer/betterer - npm Package Compare versions

Comparing version 5.1.5 to 5.1.6

dist/context/run.d.ts

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

## [5.1.6](https://github.com/phenomnomnominal/betterer/compare/v5.1.5...v5.1.6) (2022-02-09)
### Bug Fixes
* **betterer 🐛:** add missing diff to summary when run is better ([#959](https://github.com/phenomnomnominal/betterer/issues/959)) ([93b17da](https://github.com/phenomnomnominal/betterer/commit/93b17da08edbf5fddafa8d9d54f206234d2dc55a))
* **betterer 🐛:** use repository root when rewriting paths in results file ([#961](https://github.com/phenomnomnominal/betterer/issues/961)) ([6aad4a5](https://github.com/phenomnomnominal/betterer/commit/6aad4a5d9d0bab8e5936ab9edbb17cec8449fb25))
* **betterer 🐛:** you should be able to write a reporter in TS ([#956](https://github.com/phenomnomnominal/betterer/issues/956)) ([d147351](https://github.com/phenomnomnominal/betterer/commit/d1473518c331155cb80a7352d9ac39eb5f66d3e6))
## [5.1.5](https://github.com/phenomnomnominal/betterer/compare/v5.1.4...v5.1.5) (2021-12-06)

@@ -8,0 +21,0 @@

3

dist/config/config.d.ts
import { BettererVersionControlWorker } from '../fs';
import { BettererConfig, BettererConfigMerge, BettererOptionsMerge, BettererOptionsOverride, BettererWorkerRunConfig } from './types';
export declare function createInitialConfig(options?: unknown): Promise<BettererConfig>;
export declare function createFinalConfig(options: unknown, config: BettererConfig, versionControl: BettererVersionControlWorker): Promise<void>;
export declare function createConfig(options: unknown, versionControl: BettererVersionControlWorker): Promise<BettererConfig>;
export declare function overrideConfig(config: BettererConfig, optionsOverride: BettererOptionsOverride): void;

@@ -6,0 +5,0 @@ export declare function createMergeConfig(options: BettererOptionsMerge): Promise<BettererConfigMerge>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWorkerConfig = exports.createMergeConfig = exports.overrideConfig = exports.createFinalConfig = exports.createInitialConfig = void 0;
exports.createWorkerConfig = exports.createMergeConfig = exports.overrideConfig = exports.createConfig = void 0;
const tslib_1 = require("tslib");

@@ -14,4 +14,6 @@ const errors_1 = require("@betterer/errors");

const TOTAL_CPUS = os.cpus().length;
async function createInitialConfig(options = {}) {
const baseConfig = createInitialBaseConfig(options);
async function createConfig(options = {}, versionControl) {
const tsconfigPath = resolveTsConfigPath(options);
await (0, register_1.registerExtensions)(tsconfigPath);
const baseConfig = await createBaseConfig(options, tsconfigPath, versionControl);
const startConfig = createStartConfig(options);

@@ -24,10 +26,5 @@ const watchConfig = createWatchConfig(options);

}
await (0, register_1.registerExtensions)(config.tsconfigPath);
return config;
}
exports.createInitialConfig = createInitialConfig;
async function createFinalConfig(options = {}, config, versionControl) {
await createFinalBaseConfig(options, config, versionControl);
}
exports.createFinalConfig = createFinalConfig;
exports.createConfig = createConfig;
function overrideConfig(config, optionsOverride) {

@@ -48,7 +45,14 @@ if (optionsOverride.filters) {

exports.overrideConfig = overrideConfig;
function createInitialBaseConfig(options) {
function resolveTsConfigPath(options) {
const cwd = options.cwd || process.cwd();
const tsconfigPath = options.tsconfigPath || null;
return tsconfigPath ? path.resolve(cwd, tsconfigPath) : null;
}
async function createBaseConfig(options, tsconfigPath, versionControl) {
const cwd = options.cwd || process.cwd();
const configPaths = options.configPaths ? toArray(options.configPaths) : ['./.betterer'];
validateStringArray({ configPaths });
const isDebug = !!process.env.BETTERER_DEBUG;
const cache = !!options.cachePath || options.cache || false;
const cachePath = options.cachePath || './.betterer.cache';
const cwd = options.cwd || process.cwd();
const filters = toRegExps(toArray(options.filters));

@@ -59,3 +63,2 @@ const reporters = toArray(options.reporters);

const resultsPath = options.resultsPath || './.betterer.results';
const tsconfigPath = options.tsconfigPath || null;
validateBool({ cache });

@@ -68,2 +71,4 @@ validateString({ cachePath });

const workers = validateWorkers(options);
const validatedConfigPaths = validateConfigPaths(cwd, configPaths);
const versionControlPath = await versionControl.init(validatedConfigPaths);
return {

@@ -73,24 +78,11 @@ cache,

cwd,
configPaths: [],
configPaths: validatedConfigPaths,
filters,
reporter,
resultsPath: path.resolve(cwd, resultsPath),
tsconfigPath: tsconfigPath ? path.resolve(cwd, tsconfigPath) : null,
tsconfigPath,
versionControlPath,
workers
};
}
async function createFinalBaseConfig(options, config, versionControl) {
const configPaths = options.configPaths ? toArray(options.configPaths) : ['./.betterer'];
validateStringArray({ configPaths });
config.configPaths = configPaths.map((configPath) => {
configPath = path.resolve(config.cwd, configPath);
try {
return require.resolve(configPath);
}
catch (error) {
throw new errors_1.BettererError(`could not find config file at "${configPath}". 😔`, error);
}
});
await versionControl.init(config.configPaths);
}
async function createMergeConfig(options) {

@@ -219,2 +211,13 @@ const contents = toArray(options.contents);

}
function validateConfigPaths(cwd, configPaths) {
return configPaths.map((configPath) => {
const absoluteConfigPath = path.resolve(cwd, configPath);
try {
return require.resolve(absoluteConfigPath);
}
catch (error) {
throw new errors_1.BettererError(`could not find config file at "${absoluteConfigPath}". 😔`, error);
}
});
}
async function validateFilePath(config) {

@@ -221,0 +224,0 @@ const [propertyName] = Object.keys(config);

@@ -1,3 +0,3 @@

export { createInitialConfig, createFinalConfig, createMergeConfig, createWorkerConfig, overrideConfig } from './config';
export { createConfig, createMergeConfig, createWorkerConfig, overrideConfig } from './config';
export { BettererConfig, BettererConfigBase, BettererConfigMerge, BettererConfigStart, BettererConfigWatch, BettererConfigExcludes, BettererConfigFilters, BettererConfigIgnores, BettererConfigIncludes, BettererConfigPaths, BettererOptionsBase, BettererOptionsExcludes, BettererOptionsFilters, BettererOptionsIgnores, BettererOptionsIncludes, BettererOptionsMerge, BettererOptionsOverride, BettererOptionsPaths, BettererOptionsReporters, BettererOptionsResults, BettererOptionsRunner, BettererOptionsStartBase, BettererOptionsStartCI, BettererOptionsStartDefault, BettererOptionsStartPrecommit, BettererOptionsStartStrict, BettererOptionsStartUpdate, BettererOptionsStart, BettererOptionsWatch, BettererWorkerRunConfig } from './types';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.overrideConfig = exports.createWorkerConfig = exports.createMergeConfig = exports.createFinalConfig = exports.createInitialConfig = void 0;
exports.overrideConfig = exports.createWorkerConfig = exports.createMergeConfig = exports.createConfig = void 0;
var config_1 = require("./config");
Object.defineProperty(exports, "createInitialConfig", { enumerable: true, get: function () { return config_1.createInitialConfig; } });
Object.defineProperty(exports, "createFinalConfig", { enumerable: true, get: function () { return config_1.createFinalConfig; } });
Object.defineProperty(exports, "createConfig", { enumerable: true, get: function () { return config_1.createConfig; } });
Object.defineProperty(exports, "createMergeConfig", { enumerable: true, get: function () { return config_1.createMergeConfig; } });

@@ -8,0 +7,0 @@ Object.defineProperty(exports, "createWorkerConfig", { enumerable: true, get: function () { return config_1.createWorkerConfig; } });

@@ -77,2 +77,6 @@ import { BettererReporter } from '../reporters';

/**
* The absolute path to the root directory of the repository.
*/
versionControlPath: string;
/**
* The number of {@link https://nodejs.org/api/worker_threads.html | worker threads} to use when

@@ -79,0 +83,0 @@ * running **Betterer**.

@@ -61,4 +61,10 @@ "use strict";

async runOnce() {
await this.run([], true);
return this.stop();
try {
await this.run([], true);
const summary = await this.stop();
return summary;
}
finally {
await this._destroy();
}
}

@@ -65,0 +71,0 @@ async stop() {

@@ -19,3 +19,3 @@ import { BettererFilePaths, BettererVersionControl } from './types';

getFilePaths(): BettererFilePaths;
init(configPaths: BettererFilePaths): Promise<void>;
init(configPaths: BettererFilePaths): Promise<string>;
sync(): Promise<void>;

@@ -22,0 +22,0 @@ private _findGitRoot;

@@ -63,2 +63,3 @@ "use strict";

await this.sync();
return this._rootDir;
}

@@ -65,0 +66,0 @@ async sync() {

@@ -10,19 +10,13 @@ "use strict";

const reporter = (0, reporters_1.loadDefaultReporter)();
const versionControl = (0, fs_1.createVersionControl)();
try {
const config = await (0, config_1.createInitialConfig)(options);
const versionControl = (0, fs_1.createVersionControl)();
try {
await (0, config_1.createFinalConfig)(options, config, versionControl);
if (config.cache) {
await versionControl.enableCache(config.cachePath);
}
const resultsFile = await results_1.BettererResultsFileΩ.create(config.resultsPath, versionControl);
return { config, resultsFile, versionControl };
const config = await (0, config_1.createConfig)(options, versionControl);
if (config.cache) {
await versionControl.enableCache(config.cachePath);
}
catch (error) {
await versionControl.destroy();
throw error;
}
const resultsFile = await results_1.BettererResultsFileΩ.create(config.resultsPath, versionControl);
return { config, resultsFile, versionControl };
}
catch (error) {
await versionControl.destroy();
await reporter.configError(options, error);

@@ -29,0 +23,0 @@ throw error;

@@ -20,2 +20,3 @@ "use strict";

update: config.update,
versionControlPath: config.versionControlPath,
watch: config.watch,

@@ -22,0 +23,0 @@ workers: config.workers

@@ -119,3 +119,3 @@ "use strict";

const toPrintSerialised = this.test.serialiser.serialise(toPrint.value, config.resultsPath);
printed = (0, fs_1.forceRelativePaths)(await this.test.printer(toPrintSerialised), config.cwd);
printed = (0, fs_1.forceRelativePaths)(await this.test.printer(toPrintSerialised), config.versionControlPath);
}

@@ -141,7 +141,8 @@ if (this.testMeta.isFileTest) {

}
const diff = this.test.differ(this.expected.value, result.value);
if (comparison === constraints_1.BettererConstraintResult.better) {
return end(run_summary_1.BettererRunStatus.better, result);
return end(run_summary_1.BettererRunStatus.better, result, diff);
}
const status = config.update ? run_summary_1.BettererRunStatus.update : run_summary_1.BettererRunStatus.worse;
return end(status, result, this.test.differ(this.expected.value, result.value));
return end(status, result, diff);
},

@@ -148,0 +149,0 @@ failed: async (error) => {

{
"name": "@betterer/betterer",
"description": "Main engine for runing betterer tests",
"version": "5.1.5",
"version": "5.1.6",
"license": "MIT",

@@ -34,3 +34,3 @@ "publishConfig": {

"@betterer/logger": "^5.1.5",
"@betterer/reporter": "^5.1.5",
"@betterer/reporter": "^5.1.6",
"@phenomnomnominal/debug": "^0.2.5",

@@ -54,3 +54,3 @@ "@phenomnomnominal/worker-require": "^0.0.34",

},
"gitHead": "35631cb51b0214c3223511aa2a93947766b9363e"
"gitHead": "1dda5c9255a578649ede3d6d5a7a748a5087991f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc