From 7097a44f324897c117e772aafb2e2b1f1e324cdb Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Sun, 14 Jan 2018 20:06:36 -0600 Subject: [PATCH] Ensure package versions are exact (#824) --- spec/package.json.spec.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 spec/package.json.spec.ts diff --git a/spec/package.json.spec.ts b/spec/package.json.spec.ts new file mode 100644 index 00000000..abd09a22 --- /dev/null +++ b/spec/package.json.spec.ts @@ -0,0 +1,23 @@ +import packageJSON from '../package.json'; + +// from https://docs.npmjs.com/files/package.json#dependencies +const nonExactPrefixes = ['~', '^', '>', '>=', '<', '<=']; + +describe('package.json', () => { + it('dependencies should not contain any non-exact versions', () => { + const deps = Object.values(packageJSON.dependencies); + deps.forEach(depVersion => { + nonExactPrefixes.forEach(badPrefix => { + expect(depVersion.includes(badPrefix)).toBeFalsy(); + }); + }); + }); + it('devDependencies should not contain any non-exact versions', () => { + const deps = Object.values(packageJSON.devDependencies); + deps.forEach(depVersion => { + nonExactPrefixes.forEach(badPrefix => { + expect(depVersion.includes(badPrefix)).toBeFalsy(); + }); + }); + }); +});