2018-01-15 02:06:36 +00:00
|
|
|
import packageJSON from '../package.json';
|
|
|
|
|
2018-04-05 20:53:36 +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-04-05 20:53:36 +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-04-05 20:53:36 +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();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|