mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
BREAKING CHANGE: Old variables resolver is permanently removed. Any resolution error as approached with current resolver is assumed as final (there's no longer fallback to old resolver)
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const { expect } = require('chai');
|
|
|
|
const overrideArgv = require('process-utils/override-argv');
|
|
const ServerlessError = require('../../../../../lib/serverless-error');
|
|
const resolveCliInput = require('../../../../../lib/cli/resolve-input');
|
|
const resolveMeta = require('../../../../../lib/configuration/variables/resolve-meta');
|
|
const eventuallyReportResolutionErrors = require('../../../../../lib/configuration/variables/eventually-report-resolution-errors');
|
|
|
|
describe('test/unit/lib/configuration/variables/eventually-report-resolution-errors.test.js', () => {
|
|
beforeEach(() => {
|
|
resolveCliInput.clear();
|
|
});
|
|
it('should return "false" on no errors', () => {
|
|
const configuration = { foo: 'bar' };
|
|
const variablesMeta = resolveMeta(configuration);
|
|
|
|
expect(eventuallyReportResolutionErrors(process.cwd(), configuration, variablesMeta)).to.equal(
|
|
false
|
|
);
|
|
});
|
|
|
|
describe('On errors', () => {
|
|
it('should throw error in regular circumstances', () => {
|
|
const configuration = { foo: '${foo:raz' };
|
|
const variablesMeta = resolveMeta(configuration);
|
|
overrideArgv({ args: ['serverless', 'foo'] }, () =>
|
|
expect(() => eventuallyReportResolutionErrors(process.cwd(), configuration, variablesMeta))
|
|
.to.throw(ServerlessError)
|
|
.with.property('code', 'VARIABLES_RESOLUTION_ERROR')
|
|
);
|
|
});
|
|
});
|
|
});
|