Erster Docker-Stand
This commit is contained in:
35
_node_modules/fast-check/lib/esm/check/model/commands/CommandWrapper.js
generated
Normal file
35
_node_modules/fast-check/lib/esm/check/model/commands/CommandWrapper.js
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
import { asyncToStringMethod, hasAsyncToStringMethod, hasToStringMethod, toStringMethod, } from '../../../utils/stringify.js';
|
||||
import { cloneMethod, hasCloneMethod } from '../../symbols.js';
|
||||
export class CommandWrapper {
|
||||
constructor(cmd) {
|
||||
this.cmd = cmd;
|
||||
this.hasRan = false;
|
||||
if (hasToStringMethod(cmd)) {
|
||||
const method = cmd[toStringMethod];
|
||||
this[toStringMethod] = function toStringMethod() {
|
||||
return method.call(cmd);
|
||||
};
|
||||
}
|
||||
if (hasAsyncToStringMethod(cmd)) {
|
||||
const method = cmd[asyncToStringMethod];
|
||||
this[asyncToStringMethod] = function asyncToStringMethod() {
|
||||
return method.call(cmd);
|
||||
};
|
||||
}
|
||||
}
|
||||
check(m) {
|
||||
return this.cmd.check(m);
|
||||
}
|
||||
run(m, r) {
|
||||
this.hasRan = true;
|
||||
return this.cmd.run(m, r);
|
||||
}
|
||||
clone() {
|
||||
if (hasCloneMethod(this.cmd))
|
||||
return new CommandWrapper(this.cmd[cloneMethod]());
|
||||
return new CommandWrapper(this.cmd);
|
||||
}
|
||||
toString() {
|
||||
return this.cmd.toString();
|
||||
}
|
||||
}
|
||||
1
_node_modules/fast-check/lib/esm/check/model/commands/CommandsContraints.js
generated
Normal file
1
_node_modules/fast-check/lib/esm/check/model/commands/CommandsContraints.js
generated
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
21
_node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js
generated
Normal file
21
_node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
import { cloneMethod } from '../../symbols.js';
|
||||
export class CommandsIterable {
|
||||
constructor(commands, metadataForReplay) {
|
||||
this.commands = commands;
|
||||
this.metadataForReplay = metadataForReplay;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.commands[Symbol.iterator]();
|
||||
}
|
||||
[cloneMethod]() {
|
||||
return new CommandsIterable(this.commands.map((c) => c.clone()), this.metadataForReplay);
|
||||
}
|
||||
toString() {
|
||||
const serializedCommands = this.commands
|
||||
.filter((c) => c.hasRan)
|
||||
.map((c) => c.toString())
|
||||
.join(',');
|
||||
const metadata = this.metadataForReplay();
|
||||
return metadata.length !== 0 ? `${serializedCommands} /*${metadata}*/` : serializedCommands;
|
||||
}
|
||||
}
|
||||
53
_node_modules/fast-check/lib/esm/check/model/commands/ScheduledCommand.js
generated
Normal file
53
_node_modules/fast-check/lib/esm/check/model/commands/ScheduledCommand.js
generated
Normal file
@@ -0,0 +1,53 @@
|
||||
export class ScheduledCommand {
|
||||
constructor(s, cmd) {
|
||||
this.s = s;
|
||||
this.cmd = cmd;
|
||||
}
|
||||
async check(m) {
|
||||
let error = null;
|
||||
let checkPassed = false;
|
||||
const status = await this.s.scheduleSequence([
|
||||
{
|
||||
label: `check@${this.cmd.toString()}`,
|
||||
builder: async () => {
|
||||
try {
|
||||
checkPassed = await Promise.resolve(this.cmd.check(m));
|
||||
}
|
||||
catch (err) {
|
||||
error = err;
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
},
|
||||
]).task;
|
||||
if (status.faulty) {
|
||||
throw error;
|
||||
}
|
||||
return checkPassed;
|
||||
}
|
||||
async run(m, r) {
|
||||
let error = null;
|
||||
const status = await this.s.scheduleSequence([
|
||||
{
|
||||
label: `run@${this.cmd.toString()}`,
|
||||
builder: async () => {
|
||||
try {
|
||||
await this.cmd.run(m, r);
|
||||
}
|
||||
catch (err) {
|
||||
error = err;
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
},
|
||||
]).task;
|
||||
if (status.faulty) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
export const scheduleCommands = function* (s, cmds) {
|
||||
for (const cmd of cmds) {
|
||||
yield new ScheduledCommand(s, cmd);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user