|
| 1 | +import { createDir, rimraf, writeMultipleFiles } from '../../utils/fs'; |
| 2 | +import { execAndWaitForOutputToMatch } from '../../utils/process'; |
| 3 | +import { updateJsonFile } from '../../utils/project'; |
| 4 | + |
| 5 | +export default async function() { |
| 6 | + await createDir('example-builder'); |
| 7 | + await writeMultipleFiles({ |
| 8 | + 'example-builder/package.json': '{ "builders": "./builders.json" }', |
| 9 | + 'example-builder/schema.json': '{ "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "additionalProperties": true }', |
| 10 | + 'example-builder/builders.json': '{ "$schema": "@angular-devkit/architect/src/builders-schema.json", "builders": { "example": { "implementation": "./example", "schema": "./schema.json" } } }', |
| 11 | + 'example-builder/example.js': 'module.exports.default = require("@angular-devkit/architect").createBuilder((options) => { console.log(options); return { success: true }; });', |
| 12 | + }); |
| 13 | + |
| 14 | + await updateJsonFile('angular.json', json => { |
| 15 | + const appArchitect = json.projects['test-project'].architect; |
| 16 | + appArchitect.example = { |
| 17 | + builder: './example-builder:example', |
| 18 | + }; |
| 19 | + }); |
| 20 | + |
| 21 | + await execAndWaitForOutputToMatch( |
| 22 | + 'ng', |
| 23 | + ['run', 'test-project:example', '--additional', 'property'], |
| 24 | + /'{ '--': \[ '--additional', 'property' \] }'/, |
| 25 | + ); |
| 26 | + |
| 27 | + await rimraf('example-builder'); |
| 28 | +} |
0 commit comments