Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chores(deps): upgrade umzug to 3.4.0 #984

Merged
merged 9 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:lint:jsx": "eslint ./packages/server/src/ui ./packages/viewer/src/ui",
"test:lint:tests": "eslint ./packages/*/test",
"test:docker": "bash scripts/test-docker.sh",
"test:unit": "jest"
"test:unit": "jest --maxWorkers=1"
},
"devDependencies": {
"@chialab/esbuild-plugin-html": "^0.17.2",
Expand All @@ -36,6 +36,7 @@
"@storybook/addons": "^6.5.13",
"@storybook/preact": "^6.5.13",
"@testing-library/dom": "^5.4.0",
"@types/bluebird": "^3.5.42",
"@types/body-parser": "^1.17.0",
"@types/compression": "^1.0.1",
"@types/cron": "^1.7.2",
Expand All @@ -50,7 +51,6 @@
"@types/node": "^11.13.2",
"@types/plotly.js": "^1.44.9",
"@types/tmp": "^0.1.0",
"@types/umzug": "^2.2.2",
"@types/uuid": "^8.3.0",
"@types/yargs": "^12.0.8",
"@types/yargs-parser": "^11.0.0",
Expand Down
25 changes: 17 additions & 8 deletions packages/cli/test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/* eslint-env jest */

const assert = require('assert');
const path = require('path');
const os = require('os');
const fs = require('fs');
Expand All @@ -25,6 +26,17 @@ const {

jest.setTimeout(120e3);

async function fetchJson(url) {
const response = await fetch(url);
const text = await response.text();
if (text[0] === '<') {
// Yes, print it also. Because Jest loves to trim error messages.
console.error(`Got a bad response, expected JSON but saw:\n\n${text}`);
assert.fail(`Got a bad response, expected JSON but saw:\n\n${text}`);
}
return JSON.parse(text);
}

describe('Lighthouse CI CLI', () => {
const rcFile = path.join(__dirname, 'fixtures/lighthouserc.json');
const rcMatrixFile = path.join(__dirname, 'fixtures/lighthouserc-matrix.json');
Expand Down Expand Up @@ -53,8 +65,7 @@ describe('Lighthouse CI CLI', () => {

describe('server', () => {
it('should accept requests', async () => {
const response = await fetch(`http://localhost:${server.port}/v1/projects`);
const projects = await response.json();
const projects = await fetchJson(`http://localhost:${server.port}/v1/projects`);
expect(projects).toEqual([]);
});
});
Expand Down Expand Up @@ -246,11 +257,10 @@ describe('Lighthouse CI CLI', () => {

it('should have saved lhrs to the API', async () => {
const [projectId, buildId, runAId, runBId] = uuids;
const response = await fetch(

const runs = await fetchJson(
`http://localhost:${server.port}/v1/projects/${projectId}/builds/${buildId}/runs`
);

const runs = await response.json();
expect(runs.map(run => run.id)).toEqual([runBId, runAId]);
expect(runs.map(run => run.url)).toEqual([
'http://localhost:PORT/app/', // make sure we replaced the port
Expand All @@ -264,11 +274,10 @@ describe('Lighthouse CI CLI', () => {

it('should have sealed the build', async () => {
const [projectId, buildId] = uuids;
const response = await fetch(

const build = await fetchJson(
`http://localhost:${server.port}/v1/projects/${projectId}/builds/${buildId}`
);

const build = await response.json();
expect(build).toMatchObject({lifecycle: 'sealed'});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"express-basic-auth": "^1.2.0",
"morgan": "^1.9.1",
"sequelize": "^6.35.2",
"umzug": "^2.2.0",
"umzug": "^3.4.0",
"uuid": "^8.3.1"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/server/src/api/express-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module.exports = {
.catch(err => {
if (err.name === 'SequelizeDatabaseError' && err.message.includes('value too long')) {
next(new E422(err.message));
} else if (err.name === 'SequelizeDatabaseError') {
next(new Error(err.message + '\n' + err.stack));
} else {
next(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {LHCI.ServerCommand.StorageOptions} options
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize, options) => {
up: async ({queryInterface, options}) => {
await queryInterface.createTable('projects', {
id: {type: Sequelize.UUID(), primaryKey: true},
name: {type: Sequelize.STRING(40)},
Expand Down Expand Up @@ -58,9 +58,9 @@ module.exports = {
});
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.dropTable('statistics');
await queryInterface.dropTable('runs');
await queryInterface.dropTable('builds');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('projects', 'token', {type: Sequelize.UUID()});
await queryInterface.bulkUpdate(
'projects',
Expand All @@ -22,9 +23,9 @@ module.exports = {
);
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeColumn('projects', 'token');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('builds', 'committedAt', {type: Sequelize.DATE(6)});
await queryInterface.addColumn('builds', 'ancestorCommittedAt', {type: Sequelize.DATE(6)});
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeColumn('builds', 'committedAt');
await queryInterface.removeColumn('builds', 'ancestorCommittedAt');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('projects', 'slug', {type: Sequelize.STRING(40)});
await queryInterface.bulkUpdate(
'projects',
Expand All @@ -28,9 +29,9 @@ module.exports = {
});
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeIndex('projects', 'projects_unique_slug');
await queryInterface.removeColumn('projects', 'slug');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('statistics', 'version', {type: Sequelize.DECIMAL(8, 2)});
await queryInterface.bulkUpdate(
'statistics',
Expand All @@ -22,9 +23,9 @@ module.exports = {
);
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeColumn('statistics', 'version');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
*/
'use strict';

const Sequelize = require('sequelize');
const {hashAdminToken, generateAdminToken} = require('../../auth.js');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('projects', 'adminToken', {type: Sequelize.STRING(64)});
await queryInterface.bulkUpdate(
'projects',
Expand All @@ -26,9 +26,9 @@ module.exports = {
);
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeColumn('projects', 'adminToken');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/
'use strict';

const Sequelize = require('sequelize');

/* eslint-disable new-cap */

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {typeof import('sequelize')} Sequelize
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async (queryInterface, Sequelize) => {
up: async ({queryInterface}) => {
await queryInterface.addColumn('projects', 'baseBranch', {type: Sequelize.STRING(80)});
await queryInterface.bulkUpdate(
'projects',
Expand All @@ -22,9 +23,9 @@ module.exports = {
);
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeColumn('projects', 'baseBranch');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

module.exports = {
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
up: async queryInterface => {
up: async ({queryInterface}) => {
await queryInterface.addIndex('builds', ['projectId', 'lifecycle', 'createdAt']);
await queryInterface.addIndex('builds', ['projectId', 'hash', 'createdAt']);
await queryInterface.addIndex('builds', ['projectId', 'branch', 'hash', 'createdAt']);
Expand All @@ -18,9 +18,9 @@ module.exports = {
await queryInterface.addIndex('statistics', ['projectId', 'buildId', 'url', 'name']);
},
/**
* @param {import('sequelize').QueryInterface} queryInterface
* @param {{queryInterface: import('sequelize').QueryInterface, options: LHCI.ServerCommand.StorageOptions}} _
*/
down: async queryInterface => {
down: async ({queryInterface}) => {
await queryInterface.removeIndex('builds', ['projectId', 'lifecycle']);
await queryInterface.removeIndex('builds', ['projectId', 'hash']);
await queryInterface.removeIndex('builds', ['projectId', 'branch', 'hash']);
Expand Down
Loading
Loading