2019-01-19 19:05:26 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const assert = require("assert");
|
|
|
|
const process = require("process");
|
|
|
|
const execa = require("execa");
|
2019-12-18 17:19:05 +00:00
|
|
|
const createTestServer = require("create-test-server");
|
|
|
|
const tempy = require("tempy");
|
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
const del = require("del");
|
2019-01-19 19:05:26 +00:00
|
|
|
|
2019-12-18 17:19:05 +00:00
|
|
|
const testDir = tempy.directory();
|
|
|
|
|
|
|
|
let server;
|
|
|
|
|
|
|
|
async function clean() {
|
|
|
|
await del(testDir, {force: true});
|
|
|
|
if (server) {
|
|
|
|
await server.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function setup() {
|
|
|
|
server = await createTestServer();
|
|
|
|
|
|
|
|
// Server response
|
|
|
|
for (const packageName of [
|
|
|
|
"gulp-sourcemaps",
|
|
|
|
"prismjs",
|
|
|
|
"svgstore",
|
|
|
|
"html-webpack-plugin",
|
|
|
|
"noty",
|
|
|
|
"jpeg-buffer-orientation",
|
|
|
|
"styled-components",
|
|
|
|
"@babel/preset-env",
|
|
|
|
]) {
|
|
|
|
const name = packageName.replace(/\//g, "%2f");
|
|
|
|
const text = fs.readFileSync(path.join(__dirname, "info", `${name}.json`), "utf8");
|
|
|
|
|
|
|
|
server.get(
|
|
|
|
`/${name}`,
|
|
|
|
text
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const {sslUrl: registry} = server;
|
|
|
|
|
|
|
|
// Fake registry
|
|
|
|
fs.writeFileSync(path.join(testDir, ".npmrc"), `registry=${registry}`);
|
|
|
|
|
|
|
|
// Copy fixture
|
|
|
|
fs.writeFileSync(
|
|
|
|
path.join(testDir, "test.json"),
|
|
|
|
fs.readFileSync("test.json")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function exit(err) {
|
|
|
|
await clean();
|
2019-01-19 19:05:26 +00:00
|
|
|
if (err) {
|
|
|
|
console.info(err);
|
|
|
|
}
|
|
|
|
process.exit(err ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function run(args) {
|
2019-12-18 17:19:05 +00:00
|
|
|
const {stdout} = await execa(
|
|
|
|
path.join(process.cwd(), "./updates.js"),
|
|
|
|
args.split(/\s+/),
|
|
|
|
{
|
|
|
|
cwd: testDir
|
|
|
|
}
|
|
|
|
);
|
2019-06-27 20:11:39 +00:00
|
|
|
return JSON.parse(stdout);
|
2019-01-19 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async function main() {
|
2019-12-18 17:19:05 +00:00
|
|
|
await setup();
|
|
|
|
|
2019-01-19 19:05:26 +00:00
|
|
|
assert.deepStrictEqual(await run("-j -f test.json"), {
|
|
|
|
results: {
|
2019-09-08 19:50:57 +00:00
|
|
|
dependencies: {
|
|
|
|
"gulp-sourcemaps": {
|
|
|
|
old: "2.0.0",
|
|
|
|
new: "2.6.5",
|
|
|
|
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
|
|
|
|
},
|
|
|
|
"prismjs": {
|
|
|
|
old: "1.0.0",
|
|
|
|
new: "1.17.1",
|
|
|
|
info: "https://github.com/LeaVerou/prism",
|
|
|
|
},
|
|
|
|
"svgstore": {
|
|
|
|
old: "^3.0.0",
|
|
|
|
new: "^3.0.0-2",
|
|
|
|
info: "https://github.com/svgstore/svgstore",
|
|
|
|
},
|
|
|
|
"html-webpack-plugin": {
|
|
|
|
old: "4.0.0-alpha.2",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "4.0.0-beta.11",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/jantimon/html-webpack-plugin",
|
|
|
|
},
|
|
|
|
"noty": {
|
|
|
|
old: "3.1.0",
|
|
|
|
new: "3.2.0-beta",
|
|
|
|
info: "https://github.com/needim/noty",
|
|
|
|
},
|
|
|
|
"jpeg-buffer-orientation": {
|
|
|
|
old: "0.0.0",
|
2019-12-03 18:24:15 +00:00
|
|
|
new: "2.0.3",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
|
|
|
},
|
|
|
|
"styled-components": {
|
|
|
|
old: "2.5.0-1",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "5.0.0-rc.2",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/styled-components/styled-components",
|
|
|
|
},
|
|
|
|
"@babel/preset-env": {
|
|
|
|
old: "7.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
new: "7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
|
|
|
}
|
2019-01-19 19:05:26 +00:00
|
|
|
},
|
2019-09-08 19:50:57 +00:00
|
|
|
peerDependencies: {
|
|
|
|
"@babel/preset-env": {
|
|
|
|
"old": "~6.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
"new": "~7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
"info": "https://github.com/babel/babel/tree/master/packages/babel-preset-env"
|
|
|
|
}
|
2019-01-20 21:26:30 +00:00
|
|
|
},
|
2019-01-19 19:05:26 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.deepStrictEqual(await run("-j -g -f test.json"), {
|
|
|
|
results: {
|
2019-09-08 19:50:57 +00:00
|
|
|
dependencies: {
|
|
|
|
"gulp-sourcemaps": {
|
|
|
|
old: "2.0.0",
|
|
|
|
new: "2.6.5",
|
|
|
|
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
|
|
|
|
},
|
|
|
|
"prismjs": {
|
|
|
|
old: "1.0.0",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "1.17.1",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/LeaVerou/prism",
|
|
|
|
},
|
|
|
|
"html-webpack-plugin": {
|
|
|
|
old: "4.0.0-alpha.2",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "4.0.0-beta.11",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/jantimon/html-webpack-plugin",
|
|
|
|
},
|
|
|
|
"noty": {
|
|
|
|
old: "3.1.0",
|
|
|
|
new: "3.1.4",
|
|
|
|
info: "https://github.com/needim/noty",
|
|
|
|
},
|
|
|
|
"jpeg-buffer-orientation": {
|
|
|
|
old: "0.0.0",
|
2019-12-03 18:24:15 +00:00
|
|
|
new: "2.0.3",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
|
|
|
},
|
|
|
|
"styled-components": {
|
|
|
|
old: "2.5.0-1",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "5.0.0-rc.2",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/styled-components/styled-components",
|
|
|
|
},
|
|
|
|
"@babel/preset-env": {
|
|
|
|
old: "7.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
new: "7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
|
|
|
}
|
2019-02-25 20:50:12 +00:00
|
|
|
},
|
2019-09-08 19:50:57 +00:00
|
|
|
peerDependencies: {
|
|
|
|
"@babel/preset-env": {
|
|
|
|
"old": "~6.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
"new": "~7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
"info": "https://github.com/babel/babel/tree/master/packages/babel-preset-env"
|
|
|
|
}
|
2019-06-27 17:25:12 +00:00
|
|
|
}
|
2019-01-19 19:05:26 +00:00
|
|
|
}
|
|
|
|
});
|
2019-01-20 21:34:40 +00:00
|
|
|
|
|
|
|
assert.deepStrictEqual(await run("-j -g -p -f test.json"), {
|
|
|
|
results: {
|
2019-09-08 19:50:57 +00:00
|
|
|
dependencies: {
|
|
|
|
"gulp-sourcemaps": {
|
|
|
|
old: "2.0.0",
|
|
|
|
new: "2.6.5",
|
|
|
|
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
|
|
|
|
},
|
|
|
|
"prismjs": {
|
|
|
|
old: "1.0.0",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "1.17.1",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/LeaVerou/prism",
|
|
|
|
},
|
|
|
|
"svgstore": {
|
|
|
|
old: "^3.0.0",
|
|
|
|
new: "^3.0.0-2",
|
|
|
|
info: "https://github.com/svgstore/svgstore",
|
|
|
|
},
|
|
|
|
"html-webpack-plugin": {
|
|
|
|
old: "4.0.0-alpha.2",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "4.0.0-beta.11",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/jantimon/html-webpack-plugin",
|
|
|
|
},
|
|
|
|
"noty": {
|
|
|
|
old: "3.1.0",
|
|
|
|
new: "3.2.0-beta",
|
|
|
|
info: "https://github.com/needim/noty",
|
|
|
|
},
|
|
|
|
"jpeg-buffer-orientation": {
|
|
|
|
old: "0.0.0",
|
2019-12-03 18:24:15 +00:00
|
|
|
new: "2.0.3",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
|
|
|
},
|
|
|
|
"styled-components": {
|
|
|
|
old: "2.5.0-1",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "5.0.0-rc.2",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/styled-components/styled-components",
|
|
|
|
},
|
|
|
|
"@babel/preset-env": {
|
|
|
|
old: "7.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
new: "7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
|
|
|
}
|
2019-02-25 20:50:12 +00:00
|
|
|
},
|
2019-09-08 19:50:57 +00:00
|
|
|
peerDependencies: {
|
|
|
|
"@babel/preset-env": {
|
|
|
|
"old": "~6.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
"new": "~7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
"info": "https://github.com/babel/babel/tree/master/packages/babel-preset-env"
|
|
|
|
}
|
2019-02-25 21:46:39 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.deepStrictEqual(await run("-j -R -f test.json"), {
|
|
|
|
results: {
|
2019-09-08 19:50:57 +00:00
|
|
|
dependencies: {
|
|
|
|
"gulp-sourcemaps": {
|
|
|
|
old: "2.0.0",
|
|
|
|
new: "2.6.5",
|
|
|
|
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
|
|
|
|
},
|
|
|
|
"prismjs": {
|
|
|
|
old: "1.0.0",
|
|
|
|
new: "1.17.1",
|
|
|
|
info: "https://github.com/LeaVerou/prism",
|
|
|
|
},
|
|
|
|
"svgstore": {
|
|
|
|
old: "^3.0.0",
|
|
|
|
new: "^2.0.3",
|
|
|
|
info: "https://github.com/svgstore/svgstore",
|
|
|
|
},
|
|
|
|
"html-webpack-plugin": {
|
|
|
|
old: "4.0.0-alpha.2",
|
|
|
|
new: "3.2.0",
|
|
|
|
info: "https://github.com/jantimon/html-webpack-plugin",
|
|
|
|
},
|
|
|
|
"noty": {
|
|
|
|
old: "3.1.0",
|
|
|
|
new: "3.1.4",
|
|
|
|
info: "https://github.com/needim/noty",
|
|
|
|
},
|
|
|
|
"jpeg-buffer-orientation": {
|
|
|
|
old: "0.0.0",
|
2019-12-03 18:24:15 +00:00
|
|
|
new: "2.0.3",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
|
|
|
},
|
|
|
|
"styled-components": {
|
|
|
|
old: "2.5.0-1",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "4.4.1",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/styled-components/styled-components",
|
|
|
|
},
|
|
|
|
"@babel/preset-env": {
|
|
|
|
old: "7.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
new: "7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
|
|
|
}
|
2019-02-25 21:46:39 +00:00
|
|
|
},
|
2019-09-08 19:50:57 +00:00
|
|
|
peerDependencies: {
|
|
|
|
"@babel/preset-env": {
|
|
|
|
"old": "~6.0.0",
|
2019-12-14 21:10:42 +00:00
|
|
|
"new": "~7.7.6",
|
2019-09-08 19:50:57 +00:00
|
|
|
"info": "https://github.com/babel/babel/tree/master/packages/babel-preset-env"
|
|
|
|
}
|
2019-03-28 20:22:49 +00:00
|
|
|
},
|
2019-01-20 21:34:40 +00:00
|
|
|
}
|
|
|
|
});
|
2019-03-28 20:22:49 +00:00
|
|
|
|
|
|
|
assert.deepStrictEqual(await run("-j -P -f test.json"), {
|
|
|
|
results: {
|
2019-09-08 19:50:57 +00:00
|
|
|
dependencies: {
|
|
|
|
"gulp-sourcemaps": {
|
|
|
|
old: "2.0.0",
|
|
|
|
new: "2.0.1",
|
|
|
|
info: "https://github.com/floridoo/gulp-sourcemaps",
|
|
|
|
},
|
|
|
|
"svgstore": {
|
|
|
|
old: "^3.0.0",
|
|
|
|
new: "^3.0.0-2",
|
|
|
|
info: "https://github.com/svgstore/svgstore",
|
|
|
|
},
|
|
|
|
"html-webpack-plugin": {
|
|
|
|
old: "4.0.0-alpha.2",
|
2019-11-19 19:24:32 +00:00
|
|
|
new: "4.0.0-beta.11",
|
2019-09-08 19:50:57 +00:00
|
|
|
info: "https://github.com/jantimon/html-webpack-plugin",
|
|
|
|
},
|
|
|
|
"noty": {
|
|
|
|
old: "3.1.0",
|
|
|
|
new: "3.1.4",
|
|
|
|
info: "https://github.com/needim/noty",
|
|
|
|
},
|
2019-03-28 20:22:49 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
2019-01-19 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main().then(exit).catch(exit);
|