3.10.0 • Published 26 days ago

@html-validate/jest-config v3.10.0

Weekly downloads
1,294
License
MIT
Repository
gitlab
Last release
26 days ago

@html-validate/jest-config

HTML-Validate jest preset.

Jest is configured to:

  • Run tests from *.spec.[jt]s.
  • Collect coverage from .js and .ts in src and ignore tests (**/*.spec.[jt]s) and index (**/index.[jt]s).
  • Report results as junit in temp/jest.xml.
  • Transform typescript with ts-jest.
  • Transform js with babel-jest if babel is detected.
  • Ignores spec-files from Cypress.

Install

npm install --save-dev @html-validate/jest-config

Usage

In your package.json file:

{
  "jest": {
    "preset": "@html-validate/jest-config"
  }
}

Presets

PresetDescription
@html-validate/jest-configAlias for presets/default
@html-validate/jest-config/presets/defaultDefault preset
@html-validate/jest-config/presets/esmExperimental ESM support

Transpiling ESM in node_modules/

If you need to import and use ESM-only libraries you need to install @babel/core. You do not need ababel.config.jsor.babelrcas the preset passes the required configuration directly tobabel-jest`.

npm install --save-dev @babel/core

When babel is detect the preset sets transformIgnorePatterns to transpile everything under node_modules. You can include a more specific list of packages to transform (potential speed gain) by manually setting transformIgnorePatterns:

Optionally you can set transformIgnorePatterns in package.json:

 {
   "jest": {
     "preset": "@html-validate/jest-config",
+    "transformIgnorePatterns": ["node_modules/(?!(foo|bar|baz)/)"]
   }
 }

This will transform only the foo, bar and baz packages.

Importing HTML as string

Importing *.html is supported by jest configuration but requires additional typescript config by creating a declaration:

shim-html.d.ts:

declare module "*.html" {
  const value: string;
  export default value;
}

tsconfig.json

This preset searches the project folder for typescript configuration in the following order:

  1. tsconfig.jest.json
  2. tsconfig.json
3.10.0

26 days ago

3.9.0

2 months ago

3.8.0

3 months ago

3.7.7

9 months ago

3.7.6

11 months ago

3.7.5

1 year ago

3.7.4

1 year ago

3.7.3

1 year ago

3.7.2

1 year ago

3.6.3

1 year ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.2

1 year ago

3.6.1

1 year ago

3.6.0

1 year ago

3.5.2

1 year ago

3.4.1

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

3.4.0

2 years ago

3.3.3

2 years ago

3.2.0

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.3.2

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.0

3 years ago

2.0.0

3 years ago

2.1.0

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago