diff --git a/packages/cli/config/jestYamlTransform.js b/packages/cli/config/jestYamlTransform.js index 2f04b94d8a..1235f8a4b7 100644 --- a/packages/cli/config/jestYamlTransform.js +++ b/packages/cli/config/jestYamlTransform.js @@ -15,6 +15,7 @@ */ const yaml = require('yaml'); +const crypto = require('crypto'); function createTransformer(config) { const process = source => { @@ -23,7 +24,8 @@ function createTransformer(config) { }; const getCacheKey = sourceText => { - return createHash('md5') + return crypto + .createHash('md5') .update(sourceText) .update(Buffer.alloc(1)) .update(JSON.stringify(config)) diff --git a/packages/cli/src/tests/yaml-fixture.yaml b/packages/cli/src/tests/yaml-fixture.yaml new file mode 100644 index 0000000000..e93744d8dc --- /dev/null +++ b/packages/cli/src/tests/yaml-fixture.yaml @@ -0,0 +1,2 @@ +x: + y: 'z' diff --git a/packages/cli/src/tests/yaml.test.ts b/packages/cli/src/tests/yaml.test.ts new file mode 100644 index 0000000000..cb96fdf954 --- /dev/null +++ b/packages/cli/src/tests/yaml.test.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import yaml from './yaml-fixture.yaml'; + +describe('tests', () => { + it('should load yaml', () => { + expect(yaml).toEqual({ x: { y: 'z' } }); + }); +});