Navigation Menu

Skip to content

Commit

Permalink
fix(nextjs): add SVGR support for jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpearce committed Jan 31, 2020
1 parent 2f72133 commit c4ea49c
Show file tree
Hide file tree
Showing 20 changed files with 593 additions and 360 deletions.
32 changes: 32 additions & 0 deletions docs/angular/api-next/builders/build.md
Expand Up @@ -3,3 +3,35 @@
Build a Next.js app

Builder properties can be configured in angular.json when defining the builder, or when invoking it.

## Properties

### fileReplacements

Type: `array` of `object`

Replace files with other files in the build.

#### replace

Type: `string`

undefined

#### with

Type: `string`

undefined

### outputPath

Type: `string`

The output path of the generated files.

### root

Type: `string`

The source root
22 changes: 22 additions & 0 deletions docs/angular/api-next/builders/export.md
Expand Up @@ -3,3 +3,25 @@
Export a Next.js app. The exported application is located at dist/\$outputPath/exported.

Builder properties can be configured in angular.json when defining the builder, or when invoking it.

## Properties

### buildTarget

Type: `string`

Target which builds the application

### silent

Default: `false`

Type: `boolean`

Hide progress or not (default is false)

### threads

Type: `number`

Number of worker threads to utilize (defaults to the number of CPUs)
32 changes: 32 additions & 0 deletions docs/react/api-next/builders/build.md
Expand Up @@ -4,3 +4,35 @@ Build a Next.js app

Builder properties can be configured in workspace.json when defining the builder, or when invoking it.
Read more about how to use builders and the CLI here: https://nx.dev/react/guides/cli.

## Properties

### fileReplacements

Type: `array` of `object`

Replace files with other files in the build.

#### replace

Type: `string`

undefined

#### with

Type: `string`

undefined

### outputPath

Type: `string`

The output path of the generated files.

### root

Type: `string`

The source root
22 changes: 22 additions & 0 deletions docs/react/api-next/builders/export.md
Expand Up @@ -4,3 +4,25 @@ Export a Next.js app. The exported application is located at dist/\$outputPath/e

Builder properties can be configured in workspace.json when defining the builder, or when invoking it.
Read more about how to use builders and the CLI here: https://nx.dev/react/guides/cli.

## Properties

### buildTarget

Type: `string`

Target which builds the application

### silent

Default: `false`

Type: `boolean`

Hide progress or not (default is false)

### threads

Type: `number`

Number of worker threads to utilize (defaults to the number of CPUs)
32 changes: 32 additions & 0 deletions docs/web/api-next/builders/build.md
Expand Up @@ -4,3 +4,35 @@ Build a Next.js app

Builder properties can be configured in workspace.json when defining the builder, or when invoking it.
Read more about how to use builders and the CLI here: https://nx.dev/web/guides/cli.

## Properties

### fileReplacements

Type: `array` of `object`

Replace files with other files in the build.

#### replace

Type: `string`

undefined

#### with

Type: `string`

undefined

### outputPath

Type: `string`

The output path of the generated files.

### root

Type: `string`

The source root
22 changes: 22 additions & 0 deletions docs/web/api-next/builders/export.md
Expand Up @@ -4,3 +4,25 @@ Export a Next.js app. The exported application is located at dist/\$outputPath/e

Builder properties can be configured in workspace.json when defining the builder, or when invoking it.
Read more about how to use builders and the CLI here: https://nx.dev/web/guides/cli.

## Properties

### buildTarget

Type: `string`

Target which builds the application

### silent

Default: `false`

Type: `boolean`

Hide progress or not (default is false)

### threads

Type: `number`

Number of worker threads to utilize (defaults to the number of CPUs)
14 changes: 14 additions & 0 deletions packages/next/src/schematics/application/application.spec.ts
Expand Up @@ -77,6 +77,20 @@ describe('app', () => {
);
});

it('should setup jest with SVGR support', async () => {
const tree = await runSchematic(
'app',
{
name: 'my-app'
},
appTree
);

expect(tree.readContent('apps/my-app/jest.config.js')).toContain(
`'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest'`
);
});

it('should set up the nrwl next build builder', async () => {
const tree = await runSchematic(
'app',
Expand Down

0 comments on commit c4ea49c

Please sign in to comment.