Class Jest

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

    @Generated(value="jsii-pacmak/1.96.0 (build 921e240)",
               date="2024-03-28T21:16:43.165Z")
    @Stability(Experimental)
    public class Jest
    extends Component
    (experimental) Installs the following npm scripts:.

    • test, intended for testing locally and in CI. Will update snapshots unless updateSnapshot: UpdateSnapshot: NEVER is set.
    • test:watch, intended for automatically rerunning tests when files change.
    • test:update, intended for testing locally and updating snapshots to match the latest unit under test. Only available when updateSnapshot: UpdateSnapshot: NEVER.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Jest.Builder
      (experimental) A fluent builder for Jest.
      • Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

        software.amazon.jsii.JsiiObject.InitializationMode
      • Nested classes/interfaces inherited from interface software.constructs.IConstruct

        software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Jest​(NodeProject project)  
        Jest​(NodeProject project, JestOptions options)  
      protected Jest​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)  
      protected Jest​(software.amazon.jsii.JsiiObjectRef objRef)  
    • Constructor Detail

      • Jest

        protected Jest​(software.amazon.jsii.JsiiObjectRef objRef)
      • Jest

        protected Jest​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • Jest

        @Stability(Experimental)
        public Jest​(@NotNull
                    NodeProject project,
                    @Nullable
                    JestOptions options)
        Parameters:
        project - This parameter is required.
        options -
      • Jest

        @Stability(Experimental)
        public Jest​(@NotNull
                    NodeProject project)
        Parameters:
        project - This parameter is required.
    • Method Detail

      • of

        @Stability(Experimental)
        @Nullable
        public static Jest of​(@NotNull
                              Project project)
        (experimental) Returns the singleton Jest component of a project or undefined if there is none.

        Parameters:
        project - This parameter is required.
      • addIgnorePattern

        @Stability(Experimental)
        public void addIgnorePattern​(@NotNull
                                     String pattern)
        Parameters:
        pattern - This parameter is required.
      • addModuleNameMappers

        @Stability(Experimental)
        public void addModuleNameMappers​(@NotNull
                                         Map<String,​Object> moduleNameMapperAdditions)
        (experimental) Adds one or more moduleNameMapper entries to Jest's configuration.

        Will overwrite if the same key is used as a pre-existing one.

        Parameters:
        moduleNameMapperAdditions -
        • A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.
        This parameter is required.
      • addModulePaths

        @Stability(Experimental)
        public void addModulePaths​(@NotNull
                                   @NotNull String... modulePaths)
        (experimental) Adds one or more modulePaths to Jest's configuration.

        Parameters:
        modulePaths -
        • An array of absolute paths to additional locations to search when resolving modules *.
        This parameter is required.
      • addReporter

        @Stability(Experimental)
        public void addReporter​(@NotNull
                                JestReporter reporter)
        Parameters:
        reporter - This parameter is required.
      • addRoots

        @Stability(Experimental)
        public void addRoots​(@NotNull
                             @NotNull String... roots)
        (experimental) Adds one or more roots to Jest's configuration.

        Parameters:
        roots -
        • A list of paths to directories that Jest should use to search for files in.
        This parameter is required.
      • addSetupFile

        @Stability(Experimental)
        public void addSetupFile​(@NotNull
                                 String file)
        (experimental) Adds a a setup file to Jest's setupFiles configuration.

        Parameters:
        file - File path to setup file. This parameter is required.
      • addSetupFileAfterEnv

        @Stability(Experimental)
        public void addSetupFileAfterEnv​(@NotNull
                                         String file)
        (experimental) Adds a a setup file to Jest's setupFilesAfterEnv configuration.

        Parameters:
        file - File path to setup file. This parameter is required.
      • addSnapshotResolver

        @Stability(Experimental)
        public void addSnapshotResolver​(@NotNull
                                        String file)
        Parameters:
        file - This parameter is required.
      • addTestMatch

        @Stability(Experimental)
        public void addTestMatch​(@NotNull
                                 String pattern)
        (experimental) Adds a test match pattern.

        Parameters:
        pattern - glob pattern to match for tests. This parameter is required.
      • addWatchIgnorePattern

        @Stability(Experimental)
        public void addWatchIgnorePattern​(@NotNull
                                          String pattern)
        (experimental) Adds a watch ignore pattern.

        Parameters:
        pattern - The pattern (regular expression). This parameter is required.
      • getConfig

        @Stability(Experimental)
        @NotNull
        public Object getConfig()
        (experimental) Escape hatch.
      • getJestVersion

        @Stability(Experimental)
        @NotNull
        public String getJestVersion()
        (experimental) Jest version, including @ symbol, like @^29.
      • getFile

        @Stability(Experimental)
        @Nullable
        public JsonFile getFile()
        (experimental) Jest config file.

        undefined if settings are written to package.json