1.1.0 • Published 3 years ago

test-forbidden-regex v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Strict Folder Structure

with test-forbidden-regex

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
1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.2

3 years ago