File: test.js

package info (click to toggle)
node-read-pkg-up 7.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 136 kB
  • sloc: javascript: 43; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const path = require('path');
const test = require('tape');
const readPackageUp = require('.');

const cwd = 'fixture';
const packagePath = path.resolve('.', 'package.json');

test('async', async t => {
	const result = await readPackageUp({cwd});
	t.is(result.packageJson.name, 'read-pkg-up');
	t.is(result.path, packagePath);

	t.is(await readPackageUp({cwd: '/'}), undefined);
	t.end();
});

test('sync', t => {
	const result = readPackageUp.sync({cwd});
	t.is(result.packageJson.name, 'read-pkg-up');
	t.is(result.path, packagePath);

	t.is(readPackageUp.sync({cwd: '/'}), undefined);
	t.end();
});