Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include test utils in NPM package #211

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
submodules: "recursive"
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand All @@ -68,12 +80,24 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Run the tests"
run: "forge test"

Expand Down
8 changes: 0 additions & 8 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from e8a047
1 change: 0 additions & 1 deletion lib/prb-test
Submodule prb-test deleted from 1e9ead
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"url": "https://github.com/PaulRBerg/prb-math/issues"
},
"devDependencies": {
"@forge/std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
Copy link
Owner

@PaulRBerg PaulRBerg Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to use a faux @forge-std organization. We can just type it as forge-std.

"@prb/test": "0.6.4",
"prettier": "^2.8.7",
"solhint-community": "^3.5.2"
},
"files": [
"src",
"test/utils",
"CHANGELOG.md"
],
"homepage": "https://github.com/PaulRBerg/prb-math#readme",
Expand All @@ -30,6 +33,10 @@
"solidity"
],
"license": "MIT",
"peerDependencies": {
"@forge/std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
"@prb/test": "0.6.4"
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
},
"publishConfig": {
"access": "public"
},
Expand Down
18 changes: 17 additions & 1 deletion pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@prb/test/=lib/prb-test/src/
forge-std/=lib/forge-std/src/
@forge-std/=node_modules/@forge/std/
@prb/test/=node_modules/@prb/test/
6 changes: 0 additions & 6 deletions src/test/Assertions.sol

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/Utils.sol

This file was deleted.

4 changes: 2 additions & 2 deletions test/Base.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { StdCheats } from "forge-std/StdCheats.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";
import { StdCheats } from "@forge-std/src/StdCheats.sol";

import { PRBMathAssertions } from "./utils/Assertions.sol";
import { PRBMathUtils } from "./utils/Utils.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/SD59x18.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { console2 } from "forge-std/console2.sol";
import { console2 } from "@forge-std/src/console2.sol";

import { sd } from "src/sd59x18/Casting.sol";
import { ZERO } from "src/sd59x18/Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/math/div/div.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { sd } from "src/sd59x18/Casting.sol";
import { MAX_SD59x18, MAX_WHOLE_SD59x18, MIN_SD59x18, MIN_WHOLE_SD59x18, PI, ZERO } from "src/sd59x18/Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/math/inv/inv.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_SD59x18, MAX_WHOLE_SD59x18, MIN_SD59x18, MIN_WHOLE_SD59x18, PI, ZERO } from "src/sd59x18/Constants.sol";
import { inv } from "src/sd59x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/UD60x18.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { console2 } from "forge-std/console2.sol";
import { console2 } from "@forge-std/src/console2.sol";

import { ZERO } from "src/ud60x18/Constants.sol";
import { UD60x18 } from "src/ud60x18/ValueType.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/math/div/div.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_UD60x18, MAX_WHOLE_UD60x18, PI, uUNIT, ZERO } from "src/ud60x18/Constants.sol";
import { div } from "src/ud60x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/math/inv/inv.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_UD60x18, MAX_WHOLE_UD60x18, PI, ZERO } from "src/ud60x18/Constants.sol";
import { inv } from "src/ud60x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Assertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";

import { SD1x18 } from "../../src/sd1x18/ValueType.sol";
import { SD59x18 } from "../../src/sd59x18/ValueType.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Utils.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { StdUtils } from "forge-std/StdUtils.sol";
import { StdUtils } from "@forge-std/src/StdUtils.sol";

import { SD1x18 } from "../../src/sd1x18/ValueType.sol";
import { SD59x18 } from "../../src/sd59x18/ValueType.sol";
Expand Down