tests: refining env tests
This commit is contained in:
parent
d74a802907
commit
8a71e615c2
5
.github/workflows/test-env.yml
vendored
5
.github/workflows/test-env.yml
vendored
@ -20,7 +20,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
tsModuleResolution: [ "node", "node16", "nodenext" ]
|
tsModuleResolution: [ "node", "node16", "nodenext" ]
|
||||||
tsModule: [ "commonjs", "es2020" ]
|
tsModule: [ "commonjs", "es2020" ]
|
||||||
pkgType: [ "module", "commonjs" ]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
@ -36,8 +35,8 @@ jobs:
|
|||||||
- name: Copy tests to working directory
|
- name: Copy tests to working directory
|
||||||
run: cp faux_modules/ethers/testcases/test-env/test-tsc/* .
|
run: cp faux_modules/ethers/testcases/test-env/test-tsc/* .
|
||||||
|
|
||||||
- name: Prepare setup moduleResolution=${{ matrix.tsModuleResolution }} module=${{ matrix.tsModule }} type=${{ matrix.pkgType }}
|
- name: Prepare setup moduleResolution=${{ matrix.tsModuleResolution }} module=${{ matrix.tsModule }}
|
||||||
run: node prepare.cjs ${{ matrix.tsModuleResolution }} ${{ matrix.tsModule }} ${{ matrix.pkgType }}
|
run: node prepare.cjs ${{ matrix.tsModuleResolution }} ${{ matrix.tsModule }}
|
||||||
|
|
||||||
- name: Dump Config
|
- name: Dump Config
|
||||||
run: cat package.json tsconfig.json
|
run: cat package.json tsconfig.json
|
||||||
|
2
testcases/test-env/test-3983/.gitignore
vendored
2
testcases/test-env/test-3983/.gitignore
vendored
@ -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
|
// module: commonjs, es2020
|
||||||
replace("tsconfig.json", "${TS_MODULE}", process.argv[3]);
|
replace("tsconfig.json", "${TS_MODULE}", process.argv[3]);
|
||||||
|
|
||||||
// type: module, commonjs
|
// type: commonjs, module
|
||||||
replace("package.json", "${PKG_TYPE}", process.argv[4]);
|
const type = (process.argv[3] === "commonjs") ? "commonjs": "module";
|
||||||
|
replace("package.json", "${PKG_TYPE}", type);
|
||||||
|
|
||||||
// JavaScript
|
// 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"
|
|
||||||
],
|
|
||||||
}
|
|
2
testcases/test-env/ts-import-cjs/.gitignore
vendored
2
testcases/test-env/ts-import-cjs/.gitignore
vendored
@ -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"
|
|
||||||
],
|
|
||||||
}
|
|
2
testcases/test-env/ts-import-esm/.gitignore
vendored
2
testcases/test-env/ts-import-esm/.gitignore
vendored
@ -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"
|
|
||||||
],
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user