function check(graph, expected_error) {
	// @ts-expect-error
	const context = /** @type {import('vite').Rollup.PluginContext} */ ({
		/** @param {string} id */
		getModuleInfo(id) {
			return {
				importedIds: [],
				dynamicallyImportedIds: [],
				...graph[id]
			};
		}
	});

	const guard = module_guard(context, {
		cwd: '~',
		lib: '~/src/lib'
	});

	if (expected_error) {
		try {
			guard.check('~/src/entry');
			throw new Error('Expected an error');
		} catch (e) {
			// @ts-expect-error
			assert.equal(e.message, expected_error.replace(/^\t+/gm, ''));
		}
	} else {
		guard.check('~/src/entry');
	}
}
@param {Record<string, { importedIds?: string[]; dynamicallyImportedIds?: string[] }>} graph
@param {string} [expected_error]