Skip to content

Commit

Permalink
Upgrade to [email protected] (#1614)
Browse files Browse the repository at this point in the history
Upgrade the pp-test-kit dependency and use the new simulate API in tests
that test behavior under the effect of a specific polluted property.
  • Loading branch information
ericcornelissen authored Jun 30, 2024
1 parent 415424e commit efd6b88
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"lockfile-lint": "4.13.1",
"markdownlint-cli": "0.40.0",
"nve": "18.0.0",
"pp-test-kit": "0.1.1",
"pp-test-kit": "0.1.2",
"prettier": "3.2.4",
"publint": "0.2.8",
"rollup": "4.18.0",
Expand Down
7 changes: 6 additions & 1 deletion test/unit/executables/resolve.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { testProp } from "@fast-check/ava";
import test from "ava";
import * as fc from "fast-check";
import * as ppTestKit from "pp-test-kit/simulate";
import sinon from "sinon";

import { arbitrary } from "./_.js";
Expand Down Expand Up @@ -108,7 +109,11 @@ testProp(

t.context.deps.which.resetHistory();

env = Object.assign(Object.create({ [pathName]: prototypePath }), env);
env = ppTestKit.simulatePollution({
subject: env,
property: pathName,
value: prototypePath,
});

const { executable } = t.context;
const args = { env, executable };
Expand Down
7 changes: 6 additions & 1 deletion test/unit/platforms/get-helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { testProp } from "@fast-check/ava";
import * as fc from "fast-check";
import * as ppTestKit from "pp-test-kit/simulate";

import { arbitrary, constants } from "./_.js";

Expand Down Expand Up @@ -81,7 +82,11 @@ testProp(
(t, env, prototypeOstype, platform) => {
fc.pre(![...winOsTypes].includes(env.OSTYPE));

env = Object.assign(Object.create({ OSTYPE: prototypeOstype }), env);
env = ppTestKit.simulatePollution({
subject: env,
property: "OSTYPE",
value: prototypeOstype,
});

const result = getHelpersByPlatform({
env,
Expand Down
7 changes: 6 additions & 1 deletion test/unit/win/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import path from "node:path/win32";
import { testProp } from "@fast-check/ava";
import test from "ava";
import * as fc from "fast-check";
import * as ppTestKit from "pp-test-kit/simulate";
import sinon from "sinon";

import { arbitrary, constants } from "./_.js";
Expand Down Expand Up @@ -61,7 +62,11 @@ testProp(
(t, env, prototypeComSpec) => {
fc.pre(env.ComSpec !== prototypeComSpec);

env = Object.assign(Object.create({ ComSpec: prototypeComSpec }), env);
env = ppTestKit.simulatePollution({
subject: env,
property: "ComSpec",
value: prototypeComSpec,
});

const result = win.getDefaultShell({ env });
t.not(result, prototypeComSpec);
Expand Down

0 comments on commit efd6b88

Please sign in to comment.