All files / testing file-assertion.util.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25              4x                               64x  
import type { Tree } from '@nx/devkit';
import { expect } from 'vitest';
 
/**
 * Generates an array with the default set of files in a library.
 * @param name library name
 */
export const defaultLibraryFilePaths = (name: string) => [
  `/libs/${name}/eslint.config.mjs`,
  `/libs/${name}/vite.config.mts`,
  `/libs/${name}/vitest.config.mts`,
  `/libs/${name}/README.md`,
  `/libs/${name}/tsconfig.eslint.json`,
  `/libs/${name}/tsconfig.json`,
  `/libs/${name}/tsconfig.lib.json`,
  `/libs/${name}/tsconfig.spec.json`,
];
 
/**
 * File existence assertion.
 * @param file file path
 * @param tree AST tree
 */
export const expectFileToExist = (file: string, tree: Tree) => expect(tree.exists(file), `Does not exist ${file}`).toBeTruthy();