How to use fixturify - 10 common examples

To help you get started, we’ve selected a few fixturify 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 broccolijs / broccoli-test-helper / src / util.ts View on Github external
export function writeFile(
  path: string,
  data: Buffer | string,
  encoding?: string
): void {
  // ensure path exists
  writeSync(pathmod.dirname(path), {});
  if (encoding === undefined) {
    writeFileSync(path, data);
  } else {
    writeFileSync(path, data, encoding);
  }
}
github qunitjs / qunit / test / cli / watch.js View on Github external
execution.addListener( "message", function( data ) {
			assert.step( data );

			if ( data === "runEnd" ) {
				count++;

				if ( count === 1 ) {
					fixturify.writeSync( fixturePath, {
						"tests": {
							"foo.js": `
								process.send(require('../bar.js'));
								QUnit.module('Module');
								QUnit.test('Test', function(assert) {
									assert.ok(true);
								});`
						},
						"bar.js": "module.exports = 'bar export first';"
					} );
				}

				if ( count === 2 ) {
					fixturify.writeSync( fixturePath, {
						"bar.js": "module.exports = 'bar export second';"
					} );
github brunch / brunch / test / watch.js View on Github external
test.serial.cb('detect file addition', t => {
  fixturify.writeSync('.', {
    'brunch-config.js': `module.exports = {
      files: {
        javascripts: {
          joinTo: 'app.js'
        }
      }
    };`,
    app: {
      assets: {
        'index.html': '<h1>hello world</h1>',
      },
      'initialize.js': 'console.log("hello world")',
    },
  });

  watch({}, function* (compilation) {
github brunch / brunch / test / build.js View on Github external
test.serial.cb('customize paths.public config', t =&gt; {
  fixturify.writeSync('.', {
    'brunch-config.js': `module.exports = {
      files: {
        javascripts: {
          joinTo: 'app.js'
        }
      },
      paths: {
        public: 'dist'
      }
    };`,
    app: {
      assets: {
        'index.html': '<h1>hello world</h1>',
      },
      'initialize.js': 'console.log("hello world")',
    },
github broccolijs / broccoli-test-helper / src / util.ts View on Github external
export function writeTree(path: string, tree: Tree): void {
  writeSync(path, tree);
}
github broccolijs / broccoli-merge-trees / test / broccoli_test_helpers.js View on Github external
FixtureTree.prototype.write = function (readTree, destDir) {
  fixturify.writeSync(destDir, this.fixtureObject)
}
github brunch / brunch / test / build.js View on Github external
test.serial.cb('reuse javascripts.joinTo for templates.joinTo', t => {
  const files = {
    'brunch-config.js': `module.exports = {
      files: {
        javascripts: {
          joinTo: 'all.js'
        }
      }
    };`,
    app: {
      'a.emp': 'hello-world',
      'b.emp': 'module-exports',
    },
  };

  fixturify.writeSync('.', Object.assign(files, TempCompiler));

  brunch.build({}, () => {
    fileContains(t, 'public/all.js', 'hello^world');
    fileContains(t, 'public/all.js', 'module^exports');
    t.end();
  });
});
github ember-engines / ember-engines / node-tests / helpers / in-repo-addon.js View on Github external
writeFixture(fixture) {
    fixturify.writeSync(this.path, fixture);
  }
github ember-engines / ember-engines / node-tests / helpers / build.js View on Github external
constructor(app) {
    this.app = app;
    this._buildPath = path.join(app.path, 'dist');
    this._build = fixturify.readSync(this._buildPath);
  }
github rollup / rollup / test / utils.js View on Github external
function assertDirectoriesAreEqual(actualDir, expectedDir) {
	const actualFiles = fixturify.readSync(actualDir);

	let expectedFiles;
	try {
		expectedFiles = fixturify.readSync(expectedDir);
	} catch (err) {
		expectedFiles = [];
	}
	assertFilesAreEqual(actualFiles, expectedFiles);
}

fixturify

Convert objects into directory structures and back again

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular fixturify functions