@playwright-orchestrator/mongo 1.5.1 → 1.7.0
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.
package/dist/mongo-db-adapter.js
CHANGED
|
@@ -41,8 +41,7 @@ let MongoDbAdapter = class MongoDbAdapter extends BaseAdapter {
|
|
|
41
41
|
runId,
|
|
42
42
|
config,
|
|
43
43
|
shards,
|
|
44
|
-
tests: tests.map(({
|
|
45
|
-
const position = `${line}:${column}`;
|
|
44
|
+
tests: tests.map(({ status, report, meta: { file, position, projects } }) => {
|
|
46
45
|
const { duration, fails, title, lastSuccessfulRun, ema } = report;
|
|
47
46
|
return {
|
|
48
47
|
file,
|
|
@@ -65,7 +64,7 @@ let MongoDbAdapter = class MongoDbAdapter extends BaseAdapter {
|
|
|
65
64
|
async saveTestResult({ runId, test, item, historyWindow, newEma }) {
|
|
66
65
|
const updatedDoc = await this.testInfo.findOneAndUpdate({ _id: test.testId }, {
|
|
67
66
|
$set: { ema: newEma },
|
|
68
|
-
// @ts-
|
|
67
|
+
// @ts-expect-error MongoDB typings reject $push with $each/$slice on this document type
|
|
69
68
|
$push: {
|
|
70
69
|
history: {
|
|
71
70
|
$each: [{ duration: item.duration, status: item.status, updated: new Date(item.updated) }],
|
|
@@ -30,8 +30,9 @@ let MongoInitializer = class MongoInitializer {
|
|
|
30
30
|
const set = new Set(collections.map((c) => c.collectionName));
|
|
31
31
|
await Promise.all([
|
|
32
32
|
!set.has(runsCollection) ? database.createCollection(runsCollection) : Promise.resolve(),
|
|
33
|
-
!set.has(testsCollection)
|
|
34
|
-
.then(c => c.createIndex({ status: 1 }))
|
|
33
|
+
!set.has(testsCollection)
|
|
34
|
+
? database.createCollection(testsCollection).then((c) => c.createIndex({ status: 1 }))
|
|
35
|
+
: Promise.resolve(),
|
|
35
36
|
!set.has(testsInfoCollection) ? database.createCollection(testsInfoCollection) : Promise.resolve(),
|
|
36
37
|
]);
|
|
37
38
|
}
|
|
@@ -35,7 +35,7 @@ let MongoShardHandler = class MongoShardHandler {
|
|
|
35
35
|
}
|
|
36
36
|
async claimNextTest(runId, project) {
|
|
37
37
|
const query = project
|
|
38
|
-
? { ...this.generateTestIdQuery(runId, TestStatus.Ready), projects: project }
|
|
38
|
+
? { ...this.generateTestIdQuery(runId, TestStatus.Ready), 'meta.projects': project }
|
|
39
39
|
: this.generateTestIdQuery(runId, TestStatus.Ready);
|
|
40
40
|
const result = await this.tests.findOneAndUpdate(query, {
|
|
41
41
|
$set: { updated: new Date(), status: TestStatus.Ongoing },
|
|
@@ -44,9 +44,9 @@ let MongoShardHandler = class MongoShardHandler {
|
|
|
44
44
|
return undefined;
|
|
45
45
|
const effectiveEma = result.ema;
|
|
46
46
|
await this.runs.updateOne({ _id: generateRunId(runId) }, { $inc: { 'config.remainingCount': -1, 'config.remainingTime': -effectiveEma } });
|
|
47
|
-
const {
|
|
47
|
+
const { timeout, ema, testId, meta } = result;
|
|
48
48
|
const { order } = parseTestId(result._id);
|
|
49
|
-
return {
|
|
49
|
+
return { timeout, ema, order, testId, meta };
|
|
50
50
|
}
|
|
51
51
|
async startShard() {
|
|
52
52
|
const { runId, shardId } = this.runContext;
|
|
@@ -62,20 +62,15 @@ let MongoTestRunCreator = class MongoTestRunCreator extends BaseTestRunCreator {
|
|
|
62
62
|
await this.connection.db.collection(this.runsCollection).insertOne(run);
|
|
63
63
|
if (tests.length === 0)
|
|
64
64
|
return;
|
|
65
|
-
await this.connection.db.collection(this.testsCollection).insertMany(tests.map(({
|
|
66
|
-
const [line, column] = position.split(':').map(Number);
|
|
65
|
+
await this.connection.db.collection(this.testsCollection).insertMany(tests.map(({ order, timeout, ema, testId, meta }) => {
|
|
67
66
|
return {
|
|
68
67
|
_id: generateTestId(runId, order),
|
|
69
68
|
testId,
|
|
70
|
-
file,
|
|
71
|
-
projects,
|
|
72
69
|
timeout,
|
|
73
70
|
ema,
|
|
74
|
-
line,
|
|
75
|
-
column,
|
|
76
71
|
status: TestStatus.Ready,
|
|
77
72
|
updated: now,
|
|
78
|
-
|
|
73
|
+
meta,
|
|
79
74
|
...(this.debug ? { runId, order } : {}),
|
|
80
75
|
};
|
|
81
76
|
}));
|
package/dist/types.d.ts
CHANGED
|
@@ -7,12 +7,10 @@ export interface TestRunDocument extends Document {
|
|
|
7
7
|
config: TestRunConfig;
|
|
8
8
|
updated: Date;
|
|
9
9
|
}
|
|
10
|
-
export interface TestDocument extends Document, Omit<TestItem, 'order'
|
|
10
|
+
export interface TestDocument extends Document, Omit<TestItem, 'order'> {
|
|
11
11
|
_id: Binary;
|
|
12
12
|
runId?: string;
|
|
13
13
|
order?: number;
|
|
14
|
-
line: number;
|
|
15
|
-
column: number;
|
|
16
14
|
status: TestStatus;
|
|
17
15
|
updated: Date;
|
|
18
16
|
report?: TestItemReport;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright-orchestrator/mongo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "Rostyslav Kudrevatykh",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"inversify": "^8.0.0-beta.0",
|
|
19
19
|
"mongodb": "^6.12.0",
|
|
20
20
|
"uuid": "^14.0.0",
|
|
21
|
-
"@playwright-orchestrator/core": "1.
|
|
21
|
+
"@playwright-orchestrator/core": "1.7.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {},
|
|
24
24
|
"main": "dist/index.js",
|