@dionlarson/playwright-orchestrator-mysql 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ export declare class MySQLAdapter extends Adapter {
14
14
  failTest(params: ResultTestParams): Promise<void>;
15
15
  saveTestRun({ runId, testRun, args, historyWindow }: SaveTestRunParams): Promise<void>;
16
16
  initialize(): Promise<void>;
17
- private addTitleColumnIfNeeded;
17
+ private addColumnIfNeeded;
18
18
  startShard(runId: string): Promise<TestRunConfig>;
19
19
  finishShard(runId: string): Promise<void>;
20
20
  dispose(): Promise<void>;
@@ -61,8 +61,8 @@ export class MySQLAdapter extends Adapter {
61
61
  await client.commit();
62
62
  if (result[1].length === 0)
63
63
  return undefined;
64
- const { file, line, pos, project, timeout, order_num, title } = result[1][0];
65
- return { file, position: `${line}:${pos}`, project, timeout, order: order_num, title };
64
+ const { file, line, pos, project, timeout, order_num, title, is_serial } = result[1][0];
65
+ return { file, position: `${line}:${pos}`, project, timeout, order: order_num, title, isSerial: is_serial ?? false };
66
66
  }
67
67
  catch (e) {
68
68
  await client.rollback();
@@ -82,9 +82,9 @@ export class MySQLAdapter extends Adapter {
82
82
  let tests = this.transformTestRunToItems(testRun.testRun);
83
83
  const testInfos = await this.loadTestInfos(tests);
84
84
  tests = this.sortTests(tests, testInfos, { historyWindow });
85
- const testValues = tests.map(({ position, order, file, project, timeout, title }) => {
85
+ const testValues = tests.map(({ position, order, file, project, timeout, title, isSerial }) => {
86
86
  const [line, character] = position.split(':');
87
- return [runId, order, file, +line, +character, project, timeout, title];
87
+ return [runId, order, file, +line, +character, project, timeout, title, isSerial ?? false];
88
88
  });
89
89
  const values = [
90
90
  this.configTable,
@@ -97,8 +97,8 @@ export class MySQLAdapter extends Adapter {
97
97
  await this.pool.query({
98
98
  sql: `
99
99
  INSERT INTO ?? (id, status, config) VALUES (UUID_TO_BIN(?), ?, ?);
100
- INSERT INTO ?? (run_id, order_num, file, line, pos, project, timeout, title) VALUES ${testValues
101
- .map(() => '(UUID_TO_BIN(?), ?, ?, ?, ?, ?, ?, ?)')
100
+ INSERT INTO ?? (run_id, order_num, file, line, pos, project, timeout, title, is_serial) VALUES ${testValues
101
+ .map(() => '(UUID_TO_BIN(?), ?, ?, ?, ?, ?, ?, ?, ?)')
102
102
  .join(', ')}`,
103
103
  values: values,
104
104
  });
@@ -121,6 +121,7 @@ export class MySQLAdapter extends Adapter {
121
121
  project TEXT NOT NULL,
122
122
  timeout INT NOT NULL,
123
123
  title TEXT NOT NULL DEFAULT '',
124
+ is_serial BOOLEAN NOT NULL DEFAULT FALSE,
124
125
  updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
125
126
  report JSON,
126
127
  PRIMARY KEY (run_id, order_num),
@@ -153,13 +154,14 @@ export class MySQLAdapter extends Adapter {
153
154
  this.testInfoTable,
154
155
  ],
155
156
  });
156
- // Migration: add title column if it doesn't exist (for existing databases)
157
- await this.addTitleColumnIfNeeded();
157
+ // Migration: add columns if they don't exist (for existing databases)
158
+ await this.addColumnIfNeeded('title', 'TEXT NOT NULL DEFAULT \'\'');
159
+ await this.addColumnIfNeeded('is_serial', 'BOOLEAN NOT NULL DEFAULT FALSE');
158
160
  }
159
- async addTitleColumnIfNeeded() {
161
+ async addColumnIfNeeded(column, definition) {
160
162
  try {
161
163
  await this.pool.query({
162
- sql: `ALTER TABLE ?? ADD COLUMN title TEXT NOT NULL DEFAULT ''`,
164
+ sql: `ALTER TABLE ?? ADD COLUMN ${column} ${definition}`,
163
165
  values: [this.testsTable],
164
166
  });
165
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dionlarson/playwright-orchestrator-mysql",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "keywords": [],
5
5
  "author": "Rostyslav Kudrevatykh",
6
6
  "license": "Apache-2.0",