admin: adding initial environment tests

This commit is contained in:
Richard Moore 2023-04-21 17:48:26 +09:00
parent 10e03e095b
commit db550971c0
18 changed files with 244 additions and 0 deletions

44
.github/workflows/test-env.yml vendored Normal file

@ -0,0 +1,44 @@
name: Environment Tests
on:
push:
branches:
- main
jobs:
test-env:
name: Test Environments
runs-on: ubuntu-latest
env:
npm_config_registry: http://localhost:8043
strategy:
fail-fast: false
matrix:
node-version: [ "ts-import-cjs-node16", "ts-import-esm-node16", "ts-import-cjs", "ts-import-esm" ]
steps:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Checkout repository
uses: actions/checkout@v3
with:
path: "faux_modules/ethers"
- name: Install and run Faux Registry
uses: ethers-io/hijack-npm-action
- name: Copy tests to working directory
run: cp faux-npm/ethers/testcases/test-env/${{ matrix.test }}/* .
- name: Install packages
run: npm install
- name: Run tests
run: npm test

2
testcases/test-env/.gitignore vendored Normal file

@ -0,0 +1,2 @@
*/node_modules/**
*/pacakge-lock.json

@ -0,0 +1,2 @@
index.d.ts
index.js

@ -0,0 +1,5 @@
import { ethers } from "ethers";
console.log("Version:", ethers.version);
console.log(ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567"));

@ -0,0 +1,19 @@
{
"name": "test",
"dependencies": {
"ethers": "^6.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
},
"version": "0.0.1",
"description": "Test case for simple import for ethers.",
"main": "index.js",
"private": true,
"publishConfig": { "access": "private" },
"scripts": {
"build": "tsc --project tsconfig.json",
"test": "npm run build && node index.js"
},
"license": "MIT"
}

@ -0,0 +1,19 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": false,
"lib": [
"dom",
"es2020",
"es5"
],
"module": "es2020",
"moduleResolution": "node16",
"strict": true,
"target": "es2022"
},
"exclude": [ ],
"include": [
"./index.ts"
],
}

@ -0,0 +1,2 @@
index.d.ts
index.js

@ -0,0 +1,5 @@
import { ethers } from "ethers";
console.log("Version:", ethers.version);
console.log(ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567"));

@ -0,0 +1,19 @@
{
"name": "test",
"dependencies": {
"ethers": "^6.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
},
"version": "0.0.1",
"description": "Test case for simple import for ethers.",
"main": "index.js",
"private": true,
"publishConfig": { "access": "private" },
"scripts": {
"build": "tsc --project tsconfig.json",
"test": "npm run build && node index.js"
},
"license": "MIT"
}

@ -0,0 +1,19 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": false,
"lib": [
"dom",
"es2020",
"es5"
],
"module": "es2020",
"moduleResolution": "node",
"strict": true,
"target": "es2022"
},
"exclude": [ ],
"include": [
"./index.ts"
],
}

@ -0,0 +1,2 @@
index.d.ts
index.js

@ -0,0 +1,5 @@
import { ethers } from "ethers";
console.log("Version:", ethers.version);
console.log(ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567"));

@ -0,0 +1,28 @@
{
"name": "test",
"dependencies": {
"ethers": "^6.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
},
"version": "0.0.1",
"description": "Test case for simple import for ethers.",
"main": "index.js",
"private": true,
"publishConfig": {
"access": "private"
},
"type": "module",
"scripts": {
"build": "tsc --project tsconfig.json",
"test": "npm run build && node index.js"
},
"keywords": [
"ethers",
"tests",
"typescipt"
],
"author": "Richard Moore <me@ricmoo.com>",
"license": "MIT"
}

@ -0,0 +1,19 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": false,
"lib": [
"dom",
"es2020",
"es5"
],
"module": "es2020",
"moduleResolution": "node16",
"strict": true,
"target": "es2022"
},
"exclude": [ ],
"include": [
"./index.ts"
],
}

@ -0,0 +1,2 @@
index.d.ts
index.js

@ -0,0 +1,5 @@
import { ethers } from "ethers";
console.log("Version:", ethers.version);
console.log(ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567"));

@ -0,0 +1,28 @@
{
"name": "test",
"dependencies": {
"ethers": "^6.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
},
"version": "0.0.1",
"description": "Test case for simple import for ethers.",
"main": "index.js",
"private": true,
"publishConfig": {
"access": "private"
},
"type": "module",
"scripts": {
"build": "tsc --project tsconfig.json",
"test": "npm run build && node index.js"
},
"keywords": [
"ethers",
"tests",
"typescipt"
],
"author": "Richard Moore <me@ricmoo.com>",
"license": "MIT"
}

@ -0,0 +1,19 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": false,
"lib": [
"dom",
"es2020",
"es5"
],
"module": "es2020",
"moduleResolution": "node",
"strict": true,
"target": "es2022"
},
"exclude": [ ],
"include": [
"./index.ts"
],
}