test-forbidden-regex
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Strict Folder Structure

with test-forbidden-regex

NPM Version

Why?

Often you wish to follow some strict folder structure.

This is the test helper test-forbidden-regex, which helps you follow strict folder structure

Usage (with Jest):

import {
  noImportsInFolder,
  relativeImportStartedFromTwoDots,
} from 'test-forbidden-regex';

describe('strict folder structure', () => {
  it(
    '@material-ui not allowed inside src/components folder',
    noImportsInFolder(`components`, [
      // you can use RegExp here
      relativeImportStartedFromTwoDots,
      `@material-ui`,
    ]),
  );
});

This will throw an error, if any file inside src/components folder will have relative import or import from '@material-ui' library

For example:

such strings will throw an error, if test-forbidden-regex will meet them inside src/components folder`:

// 1. relativeImportStartedFromTwoDots
import OtherCompoenent from '../components/OtherComponents';

// 2. @material-ui
import { Grid } from '@material-ui/core';

Instalation

npm

npm i test-forbidden-regex -D

yarn

yarn add test-forbidden-regex -D

Package Sidebar

Install

npm i test-forbidden-regex

Weekly Downloads

51

Version

1.1.0

License

MIT

Unpacked Size

16.9 kB

Total Files

13

Last publish

Collaborators

  • altiore