File: test.js

package info (click to toggle)
node-postcss-load-config 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 432 kB
  • sloc: makefile: 2; sh: 2
file content (18 lines) | stat: -rw-r--r-- 595 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import test from 'ava';
import importFrom from '.';

test('importFrom()', t => {
	t.is(importFrom('fixture', './fixture'), 'unicorn');
	t.throws(() => importFrom('fixture', './nonexistent'));

	const moduleNotFoundError = t.throws(() => {
		importFrom('fixture', './nonexistent');
	}, Error);
	t.is(moduleNotFoundError.code, 'MODULE_NOT_FOUND');
	t.regex(moduleNotFoundError.message, /^Cannot find module '.\/nonexistent'/);
});

test('importFrom.silent()', t => {
	t.is(importFrom.silent('fixture', './fixture'), 'unicorn');
	t.is(importFrom.silent('fixture', './nonexistent'), undefined);
});