@aws-cdk/assert
Advanced tools
Comparing version 0.9.1 to 0.9.2
import cdk = require('@aws-cdk/cdk'); | ||
import api = require('@aws-cdk/cx-api'); | ||
import { StackInspector } from './inspector'; | ||
export declare function expect(stack: api.SynthesizedStack | cdk.Stack): StackInspector; | ||
export declare function expect(stack: api.SynthesizedStack | cdk.Stack, skipValidation?: boolean): StackInspector; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const inspector_1 = require("./inspector"); | ||
function expect(stack) { | ||
function expect(stack, skipValidation = false) { | ||
// Can't use 'instanceof' here, that breaks if we have multiple copies | ||
// of this library. | ||
const sstack = isStackClassInstance(stack) ? { | ||
name: 'test', | ||
template: stack.toCloudFormation(), | ||
metadata: {} | ||
} : stack; | ||
let sstack; | ||
if (isStackClassInstance(stack)) { | ||
if (!skipValidation) { | ||
const errors = stack.validateTree(); | ||
if (errors.length > 0) { | ||
throw new Error(`Stack validation failed:\n${errors.map(e => `${e.message} at: ${e.source.parent}`).join('\n')}`); | ||
} | ||
} | ||
sstack = { | ||
name: 'test', | ||
template: stack.toCloudFormation(), | ||
metadata: {} | ||
}; | ||
} | ||
else { | ||
sstack = stack; | ||
} | ||
return new inspector_1.StackInspector(sstack); | ||
@@ -18,2 +30,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXhwZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsMkNBQTZDO0FBRTdDLFNBQWdCLE1BQU0sQ0FBQyxLQUF1QztJQUMxRCxzRUFBc0U7SUFDdEUsbUJBQW1CO0lBQ25CLE1BQU0sTUFBTSxHQUF5QixvQkFBb0IsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDL0QsSUFBSSxFQUFFLE1BQU07UUFDWixRQUFRLEVBQUUsS0FBSyx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zb3VyY2UucGFyZW50fWApLmpvaW4oJ1xcbicpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgc3N0YWNrID0ge1xuICAgICAgICAgICAgbmFtZTogJ3Rlc3QnLFxuICAgICAgICAgICAgdGVtcGxhdGU6IHN0YWNrLnRvQ2xvdWRGb3JtYXRpb24oKSxcbiAgICAgICAgICAgIG1ldGFkYXRhOiB7fVxuICAgICAgICB9O1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHNzdGFjayA9IHN0YWNrO1xuICAgIH1cblxuICAgIHJldHVybiBuZXcgU3RhY2tJbnNwZWN0b3Ioc3N0YWNrKTtcbn1cblxuZnVuY3Rpb24gaXNTdGFja0NsYXNzSW5zdGFuY2UoeDogYXBpLlN5bnRoZXNpemVkU3RhY2sgfCBjZGsuU3RhY2spOiB4IGlzIGNkay5TdGFjayB7XG4gICAgcmV0dXJuICd0b0Nsb3VkRm9ybWF0aW9uJyBpbiB4O1xufVxuIl19 |
{ | ||
"name": "@aws-cdk/assert", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "An assertion library for use with CDK Apps", | ||
@@ -26,9 +26,9 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"cdk-build-tools": "^0.9.1", | ||
"pkglint": "^0.9.1" | ||
"cdk-build-tools": "^0.9.2", | ||
"pkglint": "^0.9.2" | ||
}, | ||
"dependencies": { | ||
"@aws-cdk/cdk": "^0.9.1", | ||
"@aws-cdk/cloudformation-diff": "^0.9.1", | ||
"@aws-cdk/cx-api": "^0.9.1", | ||
"@aws-cdk/cdk": "^0.9.2", | ||
"@aws-cdk/cloudformation-diff": "^0.9.2", | ||
"@aws-cdk/cx-api": "^0.9.2", | ||
"source-map-support": "^0.5.6" | ||
@@ -35,0 +35,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98005
741
Updated@aws-cdk/cdk@^0.9.2
Updated@aws-cdk/cx-api@^0.9.2