Skip to content

Commit

Permalink
feat(devkit): mark ExecutorContext props required
Browse files Browse the repository at this point in the history
  • Loading branch information
edbzn committed Oct 24, 2023
1 parent d72ecd6 commit 491fcb3
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 8 deletions.
9 changes: 9 additions & 0 deletions packages/devkit/src/executors/parse-target-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ describe('parseTargetString', () => {
externalNodes: {},
version: '',
},
workspace: {
version: 2,
projects: {},
},
projectsConfigurations: {
version: 2,
projects: {},
},
nxJsonConfiguration: {},
};

it.each(cases)('$input -> $expected', ({ input, expected }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import { ExecutorContext } from 'nx/src/config/misc-interfaces';
import path = require('path');

describe('buildEsbuildOptions', () => {
const context: ExecutorContext = {
projectName: 'myapp',
projectsConfigurations: {
version: 2,
projects: {
myapp: {
root: 'apps/myapp',
},
const projectsConfigurations = {
version: 2,
projects: {
myapp: {
root: 'apps/myapp',
},
},
};
const context: ExecutorContext = {
projectName: 'myapp',
projectsConfigurations,
projectGraph: {
nodes: {
myapp: {
Expand All @@ -33,6 +34,7 @@ describe('buildEsbuildOptions', () => {
outputPath: 'dist/apps/myapp',
},
},
workspace: projectsConfigurations,
};

it('should include environment variables for platform === browser', () => {
Expand Down
9 changes: 9 additions & 0 deletions packages/esbuild/src/executors/esbuild/lib/normalize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ describe('normalizeOptions', () => {
},
dependencies: {},
},
workspace: {
version: 2,
projects: {},
},
projectsConfigurations: {
version: 2,
projects: {},
},
nxJsonConfiguration: {},
};

it('should handle single entry point options', () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint/src/executors/lint/lint.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ describe('Linter Builder', () => {
},
},
nxJsonConfiguration: {},
workspace: {
version: 2,
projects: {},
},
projectGraph: {
nodes: {},
dependencies: {},
},
isVerbose: false,
};
mockLintFiles.mockImplementation(() => mockReports);
Expand Down
8 changes: 8 additions & 0 deletions packages/jest/src/executors/jest/jest.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ describe('Jest Executor', () => {
},
cwd: '/root',
isVerbose: true,
workspace: {
version: 2,
projects: {},
},
projectGraph: {
nodes: {},
dependencies: {},
},
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,15 @@ describe('updatePackageJson', () => {
cwd: '',
targetName: 'build',
projectGraph,
nxJsonConfiguration: {},
projectsConfigurations: {
version: 2,
projects: {},
},
workspace: {
version: 2,
projects: {},
},
};

it('should generate new package if missing', () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/rollup/src/executors/rollup/rollup.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ describe('rollupExecutor', () => {
isVerbose: false,
projectName: 'example',
targetName: 'build',
projectGraph: {
nodes: {},
dependencies: {},
},
workspace: {
version: 2,
projects: {},
},
};
testOptions = {
compiler: 'babel',
Expand Down

0 comments on commit 491fcb3

Please sign in to comment.