How to use the concordance.serialize function in concordance

To help you get started, we’ve selected a few concordance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avajs / ava / lib / snapshot-manager.js View on Github external
deferRecord(hash, options) {
		const descriptor = concordance.describe(options.expected, concordanceOptions);
		const snapshot = concordance.serialize(descriptor);
		const entry = formatEntry(options.label, descriptor);

		return () => { // Must be called in order!
			this.hasChanges = true;

			let snapshots = this.snapshotsByHash.get(hash);
			if (!snapshots) {
				snapshots = [];
				this.snapshotsByHash.set(hash, snapshots);
			}

			if (options.index > snapshots.length) {
				throw new RangeError(`Cannot record snapshot ${options.index} for ${JSON.stringify(options.belongsTo)}, exceeds expected index of ${snapshots.length}`);
			}

			if (options.index < snapshots.length) {
github avajs / ava / lib / babel-pipeline.js View on Github external
// Babel's default of 'development' if it's empty.
	const envName = process.env.BABEL_ENV || ('NODE_ENV' in process.env ? process.env.NODE_ENV : 'test') || 'development';

	// Prepare inputs for caching seeds. Compute a seed based on the Node.js
	// version and the project directory. Dependency hashes may vary based on the
	// Node.js version, e.g. with the @ava/stage-4 Babel preset. Certain plugins
	// and presets are provided as absolute paths, which wouldn't necessarily
	// be valid if the project directory changes. Also include `envName`, so
	// options can be cached even if users change BABEL_ENV or NODE_ENV between
	// runs.
	const seedInputs = [
		process.versions.node,
		packageHash.sync(require.resolve('../package.json')),
		projectDir,
		envName,
		concordance.serialize(concordance.describe(userOptions))
	];

	const partialCacheKey = md5Hex(seedInputs);
	const pluginAndPresetHashes = new Map();

	const ensureStage4 = wantsStage4(userOptions, projectDir, {experiments});
	const containsStage4 = makeValueChecker('../stage-4');
	const containsTransformTestFiles = makeValueChecker('@ava/babel-preset-transform-test-files');

	const loadOptions = filename => {
		const partialTestConfig = babel.loadPartialConfig({
			babelrc: false,
			babelrcRoots: [projectDir],
			configFile: false,
			sourceMaps: true,
			...userOptions && userOptions.testOptions,

concordance

Compare, format, diff and serialize any JavaScript value

ISC
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis