2018-01-15 02:06:36 +00:00
|
|
|
import packageJSON from '../package.json';
|
|
|
|
|
2018-03-27 04:04:08 +00:00
|
|
|
interface Dependencies {
|
|
|
|
[key: string]: string;
|
|
|
|
}
|
|
|
|
|
2018-01-15 02:06:36 +00:00
|
|
|
// from https://docs.npmjs.com/files/package.json#dependencies
|
|
|
|
const nonExactPrefixes = ['~', '^', '>', '>=', '<', '<='];
|
|
|
|
|
|
|
|
describe('package.json', () => {
|
|
|
|
it('dependencies should not contain any non-exact versions', () => {
|
2018-03-27 04:04:08 +00:00
|
|
|
const deps = Object.values(packageJSON.dependencies as Dependencies);
|
2018-01-15 02:06:36 +00:00
|
|
|
deps.forEach(depVersion => {
|
|
|
|
nonExactPrefixes.forEach(badPrefix => {
|
|
|
|
expect(depVersion.includes(badPrefix)).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it('devDependencies should not contain any non-exact versions', () => {
|
2018-03-27 04:04:08 +00:00
|
|
|
const deps = Object.values(packageJSON.devDependencies as Dependencies);
|
2018-01-15 02:06:36 +00:00
|
|
|
deps.forEach(depVersion => {
|
|
|
|
nonExactPrefixes.forEach(badPrefix => {
|
|
|
|
expect(depVersion.includes(badPrefix)).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|