Skip to content

Commit

Permalink
to mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz authored Jan 21, 2024
1 parent 297c999 commit 2811195
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 95 deletions.
18 changes: 0 additions & 18 deletions packages/worker/test/e2e/__properties__/blockEventLoop.cjs

This file was deleted.

15 changes: 15 additions & 0 deletions packages/worker/test/e2e/__properties__/blockEventLoop.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-check
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

const property = propertyFor(new URL(import.meta.url));

export const blockEventLoopProperty = property(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(from, to) => {
for (let i = from; i !== to; ++i) {
// Loop from "from" to "to" possibly NEVER ending
}
},
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
/* global __filename, exports, require, __dirname */
const { pathToFileURL } = require('node:url');
const fc = require('fast-check');
const { propertyFor } = require('@fast-check/worker');
const { writeFileSync, existsSync, rmSync } = require('fs');
const path = require('path');
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';
import { writeFileSync, existsSync, rmSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const property = propertyFor(pathToFileURL(__filename));
const __dirname = fileURLToPath(new URL('.', import.meta.url));

const property = propertyFor(new URL(import.meta.url));

let index = 0;
function nextFilenameQuestion() {
Expand Down
16 changes: 0 additions & 16 deletions packages/worker/test/e2e/__properties__/failing.cjs

This file was deleted.

13 changes: 13 additions & 0 deletions packages/worker/test/e2e/__properties__/failing.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

const property = propertyFor(new URL(import.meta.url));

export const failingProperty = property(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(_from, _to) => {
throw new Error("I'm a failing property");
},
);
18 changes: 0 additions & 18 deletions packages/worker/test/e2e/__properties__/passing.cjs

This file was deleted.

16 changes: 16 additions & 0 deletions packages/worker/test/e2e/__properties__/passing.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-check
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

console.log(new URL(import.meta.url))
const property = propertyFor(new URL(import.meta.url));

export const passingProperty = property(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(from, to) => {
for (let i = from; i <= to; ++i) {
// Loop from "from" to "to" ALWAYS finite
}
},
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
/* global __filename, exports, require */
const { pathToFileURL } = require('node:url');
const fc = require('fast-check');
const { propertyFor } = require('@fast-check/worker');
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

const counters = {};
function buildProperty(isolationLevel) {
return propertyFor(pathToFileURL(__filename), { isolationLevel })(
return propertyFor(new URL(import.meta.url), { isolationLevel })(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(_from, _to) => {
Expand All @@ -19,7 +16,7 @@ function buildProperty(isolationLevel) {
);
}

exports.predicateIsolation = {
export const predicateIsolation = {
predicateLevel: buildProperty('predicate'),
propertyLevel: buildProperty('property'),
fileLevel: buildProperty('file'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
/* global __filename, exports, require */
const { pathToFileURL } = require('node:url');
const fc = require('fast-check');
const { propertyFor } = require('@fast-check/worker');
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

const counters = {};
function buildPropertyWarmUp(isolationLevel) {
return propertyFor(pathToFileURL(__filename), { isolationLevel })(
return propertyFor(new URL(import.meta.url), { isolationLevel })(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(_from, _to) => {
Expand All @@ -19,7 +16,7 @@ function buildPropertyWarmUp(isolationLevel) {
);
}
function buildPropertyRun(isolationLevel) {
return propertyFor(pathToFileURL(__filename), { isolationLevel })(
return propertyFor(new URL(import.meta.url), { isolationLevel })(
fc.integer({ min: -1000, max: 1000 }),
fc.integer({ min: -1000, max: 1000 }),
(_from, _to) => {
Expand All @@ -31,7 +28,7 @@ function buildPropertyRun(isolationLevel) {
);
}

exports.propertyIsolation = {
export const propertyIsolation = {
predicateLevelWarmUp: buildPropertyWarmUp('predicate'),
predicateLevelRun: buildPropertyRun('predicate'),
propertyLevelWarmUp: buildPropertyWarmUp('property'),
Expand Down
13 changes: 0 additions & 13 deletions packages/worker/test/e2e/__properties__/unregistered.cjs

This file was deleted.

10 changes: 10 additions & 0 deletions packages/worker/test/e2e/__properties__/unregistered.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-check
import fc from 'fast-check';
import { propertyFor } from '@fast-check/worker';

const property = propertyFor(new URL(import.meta.url));

export const buildUnregisteredProperty = () =>
property(fc.integer({ min: -1000, max: 1000 }), fc.integer({ min: -1000, max: 1000 }), (_from, _to) => {
return true; // success
});
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/blockEventLoop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { blockEventLoopProperty } from './__properties__/blockEventLoop.cjs';
import { blockEventLoopProperty } from './__properties__/blockEventLoop.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/concurrentAssert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { readerAssert, writerAssert } from './__properties__/concurrentAssert.cjs';
import { readerAssert, writerAssert } from './__properties__/concurrentAssert.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/failing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { failingProperty } from './__properties__/failing.cjs';
import { failingProperty } from './__properties__/failing.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/passing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { passingProperty } from './__properties__/passing.cjs';
import { passingProperty } from './__properties__/passing.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/predicateIsolation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { predicateIsolation } from './__properties__/predicateIsolation.cjs';
import { predicateIsolation } from './__properties__/predicateIsolation.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/propertyIsolation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { propertyIsolation } from './__properties__/propertyIsolation.cjs';
import { propertyIsolation } from './__properties__/propertyIsolation.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/test/e2e/unregistered.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assert } from '@fast-check/worker';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { buildUnregisteredProperty } from './__properties__/unregistered.cjs';
import { buildUnregisteredProperty } from './__properties__/unregistered.mjs';

if (isMainThread) {
describe('@fast-check/worker', () => {
Expand Down

0 comments on commit 2811195

Please sign in to comment.