Skip to content

Instantly share code, notes, and snippets.

function myCustomRule(options: any): Rule {
return (host: Tree) => {
return host;
}
}
function waitingRule(options: any): Rule {
return (host: Tree) => {
const observer = new Observable<Tree>((observer) => {
fetch('someUrl.com/') // any async operation
.then(res => res.json())
.then(data => {
observer.next(host);
observer.complete();
})
.catch(function (err: any) {
apiVersion: v1
kind: ConfigMap # it is a config map
data: # key value pairs
NODE_ENV: "production"
SOME_VALUE: "my config value"
metadata:
name: basic-config # name to reference
env:
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: basic-config # name of the configmap
key: NODE_ENV # key within the configmap
- name: SOME_VALUE
valueFrom:
configMapKeyRef:
name: basic-config
...
ports:
- containerPort: 80
volumeMounts:
# volumes to mount
- name: secret-volume # matches secret name
# path for this secret to be available at
mountPath: "/opt/firebase"
readOnly: true # no editing!
volumes:
const angularCollectionPath = require.resolve(
'../../node_modules/@schematics/angular/collection.json'
);
let appTree: UnitTestTree;
beforeEach(() => {
appTree = testRunner.runExternalSchematic(
'@schematics/angular', 'workspace', workspaceOptions);
appTree = testRunner.runExternalSchematic(
'@schematics/angular', 'application', appOptions, appTree);
});
it('fails with missing tree', () => {
expect(() => testRunner.runSchematic(
'simple-schematic',
{name: "test"},
Tree.empty())).toThrow();
});
it('fails with missing params', () => {
expect(() => testRunner.runSchematic(
'simple-schematic',
{},
appTree)).toThrowError(InvalidInputOptions,
'Schematic input does not validate against the Schema: {"spec":true,"flat":false}\n'+
'Errors:\n\n'+
' Data path "" should have required property \'name\'.');
});
expect(tree.files).toContain("/projects/bar/src/app/test/test.spec.ts");
expect(tree.files).toContain("/projects/bar/src/app/test/test.ts");