Skip to content

Commit

Permalink
add action to test import of package
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Jan 13, 2024
1 parent 200d0df commit 9a54caa
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test npm package import

on:
workflow_dispatch:
push:
bracnhes:
- main

jobs:

test-import-npm-package:
name: Test Import NPM Package

runs-on: ubuntu-latest
env:
npm_config_registry: http://localhost:8043

steps:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.x

- name: Checkout repository and store in a directory with NPM package name
uses: actions/checkout@v3
with:
path: "faux-npm/@clrfund/waffle-mock-contract"

- name: Install and run Faux NPM Registry
uses: ethers-io/hijack-npm-action

- name: Copy tests to working directory
run: cp -r faux-npm/@clrfund/waffle-mock-contract/* .

- name: Search and replace import of ../src to @clrfund/waffle-mock-contract
run: sed -i'' "s#../src#@clrfund/waffle-mock-contract#g" test/*

- name: Install packages
run: yarn

- name: Run tests
run: npm test
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@clrfund/waffle-mock-contract",
"version": "0.0.2",
"version": "0.0.3",
"main": "dist/cjs/src/index.js",
"module": "dist/esm/src/index.ts",
"module": "dist/esm/src/index.js",
"types": "dist/esm/src/index.d.ts",
"license": "MIT",
"scripts": {
Expand All @@ -17,14 +17,16 @@
"type": "git",
"url": "git+https://github.com/clrfund/waffle-mock-contract.git"
},
"dependencies": {
"@types/node": "^20.11.0",
"ethers": "^6.9.2"
"export": {
"import": "dist/esm/src/index.js",
"default": "dist/cjs/src/index.js"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
"@nomicfoundation/hardhat-ethers": "^3.0.5",
"ethers": "^6.9.2",
"@typechain/ethers-v6": "^0.5.1",
"@types/node": "^20.11.0",
"@types/mocha": "^10.0.6",
"chai": "^4.2.0",
"hardhat": "^2.19.4",
Expand Down

0 comments on commit 9a54caa

Please sign in to comment.