tests: refining env tests

This commit is contained in:
Richard Moore 2023-04-28 21:10:09 +09:00
parent d74a802907
commit 8a71e615c2
22 changed files with 6 additions and 267 deletions

@ -20,7 +20,6 @@ jobs:
matrix:
tsModuleResolution: [ "node", "node16", "nodenext" ]
tsModule: [ "commonjs", "es2020" ]
pkgType: [ "module", "commonjs" ]
steps:
- name: Use Node.js
@ -36,8 +35,8 @@ jobs:
- name: Copy tests to working directory
run: cp faux_modules/ethers/testcases/test-env/test-tsc/* .
- name: Prepare setup moduleResolution=${{ matrix.tsModuleResolution }} module=${{ matrix.tsModule }} type=${{ matrix.pkgType }}
run: node prepare.cjs ${{ matrix.tsModuleResolution }} ${{ matrix.tsModule }} ${{ matrix.pkgType }}
- name: Prepare setup moduleResolution=${{ matrix.tsModuleResolution }} module=${{ matrix.tsModule }}
run: node prepare.cjs ${{ matrix.tsModuleResolution }} ${{ matrix.tsModule }}
- name: Dump Config
run: cat package.json tsconfig.json

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

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

@ -1,29 +0,0 @@
{
"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",
"clean": "rm -rf node_modules package-lock.json *.js *.d.ts",
"postinstall": "find node_modules | grep package.json",
"test": "npm run build && node index.js"
},
"keywords": [
"ethers",
"tests",
"typescipt"
],
"author": "Richard Moore <me@ricmoo.com>",
"license": "MIT"
}

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

@ -12,8 +12,9 @@ replace("tsconfig.json", "${TS_MODULE_RESOLUTION}", process.argv[2]);
// module: commonjs, es2020
replace("tsconfig.json", "${TS_MODULE}", process.argv[3]);
// type: module, commonjs
replace("package.json", "${PKG_TYPE}", process.argv[4]);
// type: commonjs, module
const type = (process.argv[3] === "commonjs") ? "commonjs": "module";
replace("package.json", "${PKG_TYPE}", type);
// JavaScript
fs.writeFileSync("index.ts", fs.readFileSync("js-" + process.argv[4] + ".ts"));
fs.writeFileSync("index.ts", fs.readFileSync("js-" + type + ".ts"));

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

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

@ -1,21 +0,0 @@
{
"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",
"clean": "rm -rf node_modules package-lock.json *.js *.d.ts",
"postinstall": "find node_modules | grep package.json",
"test": "npm run build && node index.js"
},
"license": "MIT"
}

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

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

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

@ -1,21 +0,0 @@
{
"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",
"clean": "rm -rf node_modules package-lock.json *.js *.d.ts",
"postinstall": "find node_modules | grep package.json",
"test": "npm run build && node index.js"
},
"license": "MIT"
}

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

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

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

@ -1,30 +0,0 @@
{
"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",
"clean": "rm -rf node_modules package-lock.json *.js *.d.ts",
"postinstall": "find node_modules | grep package.json",
"test": "npm run build && node index.js"
},
"keywords": [
"ethers",
"tests",
"typescipt"
],
"author": "Richard Moore <me@ricmoo.com>",
"license": "MIT"
}

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

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

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

@ -1,30 +0,0 @@
{
"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",
"clean": "rm -rf node_modules package-lock.json *.js *.d.ts",
"postinstall": "find node_modules | grep package.json",
"test": "npm run build && node index.js"
},
"keywords": [
"ethers",
"tests",
"typescipt"
],
"author": "Richard Moore <me@ricmoo.com>",
"license": "MIT"
}

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