chore: move tests to separate package

This commit is contained in:
fryorcraken.eth 2022-11-01 19:57:19 +11:00
parent fb2b58898d
commit ce9938e464
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
10 changed files with 278 additions and 4 deletions

53
package-lock.json generated
View File

@ -5283,6 +5283,10 @@
"resolved": "packages/interfaces",
"link": true
},
"node_modules/@waku/tests": {
"resolved": "packages/tests",
"link": true
},
"node_modules/@webassemblyjs/ast": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
@ -22396,7 +22400,6 @@
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@waku/create": "*",
"app-root-path": "^3.0.0",
"chai": "^4.3.4",
"cspell": "^5.14.0",
@ -22606,6 +22609,33 @@
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"packages/tests": {
"name": "@waku/tests",
"version": "0.0.1",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@waku/core": "*",
"@waku/create": "*",
"@waku/interfaces": "*"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"cspell": "^5.14.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^4.0.2",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"typescript": "^4.6.3"
},
"engines": {
"node": ">=16"
}
}
},
"dependencies": {
@ -26845,7 +26875,6 @@
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@waku/create": "*",
"@waku/interfaces": "*",
"app-root-path": "^3.0.0",
"chai": "^4.3.4",
@ -27031,6 +27060,26 @@
}
}
},
"@waku/tests": {
"version": "file:packages/tests",
"requires": {
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@waku/core": "*",
"@waku/create": "*",
"@waku/interfaces": "*",
"cspell": "^5.14.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^4.0.2",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"typescript": "^4.6.3"
}
},
"@webassemblyjs/ast": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",

View File

@ -101,7 +101,6 @@
"node": ">=16"
},
"dependencies": {
"@waku/interfaces": "*",
"@chainsafe/libp2p-gossipsub": "^4.1.1",
"@chainsafe/libp2p-noise": "^8.0.1",
"@ethersproject/rlp": "^5.5.0",
@ -118,6 +117,7 @@
"@libp2p/websockets": "^3.0.3",
"@multiformats/multiaddr": "^11.0.6",
"@noble/secp256k1": "^1.3.4",
"@waku/interfaces": "*",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
@ -152,7 +152,6 @@
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@waku/create": "*",
"app-root-path": "^3.0.0",
"chai": "^4.3.4",
"cspell": "^5.14.0",

View File

@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json",
},
};

View File

@ -0,0 +1,11 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch", "jsdom-global/register"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,4 @@
build
bundle
dist
node_modules

View File

@ -0,0 +1,55 @@
process.env.CHROME_BIN = require("puppeteer").executablePath();
const webpack = require("webpack");
module.exports = function (config) {
config.set({
frameworks: ["webpack", "mocha"],
files: ["src/lib/**/!(node).spec.ts"],
preprocessors: {
"src/lib/**/!(node).spec.ts": ["webpack"],
},
envPreprocessor: ["CI"],
reporters: ["progress"],
browsers: ["ChromeHeadless"],
singleRun: true,
client: {
mocha: {
timeout: 6000, // Default is 2s
},
},
webpack: {
mode: "production",
module: {
rules: [
{
test: /\.(js|tsx?)$/,
use: [
{
loader: "ts-loader",
options: { configFile: "tsconfig.karma.json" },
},
],
exclude: /(node_modules)|(node\.spec\.ts)/,
},
{
test: /node\.spec\.ts$/,
use: "ignore-loader",
},
],
},
plugins: [
new webpack.DefinePlugin({
"process.env.CI": process.env.CI || false,
}),
new webpack.ProvidePlugin({
process: "process/browser.js",
}),
],
resolve: {
extensions: [".ts", ".js"],
},
stats: { warnings: false },
devtool: "inline-source-map",
},
});
};

View File

@ -0,0 +1,82 @@
{
"name": "@waku/tests",
"private": true,
"version": "0.0.1",
"description": "Waku tests",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"typesVersions": {
"*": {
"lib/*": [
"dist/lib/*"
]
}
},
"type": "module",
"author": "Waku Team",
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/tests#readme",
"repository": {
"type": "git",
"url": "https://github.com/waku-org/js-waku.git"
},
"bugs": {
"url": "https://github.com/waku-org/js-waku/issues"
},
"license": "MIT OR Apache-2.0",
"keywords": [
"waku",
"decentralized",
"secure",
"communication",
"web3",
"ethereum",
"dapps",
"privacy"
],
"scripts": {
"build": "run-s build:**",
"build:esm": "tsc",
"fix": "run-s fix:*",
"fix:prettier": "prettier . --write",
"fix:lint": "eslint src --ext .ts --ext .cjs --fix",
"check": "run-s check:*",
"check:lint": "eslint src --ext .ts",
"check:prettier": "prettier . --list-different",
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
"check:tsc": "tsc -p tsconfig.dev.json",
"test": "exit 0 # Tested in @waku/core",
"proto": "exit 0 # no proto",
"doc": "exit 0",
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
"release": "exit 0"
},
"engines": {
"node": ">=16"
},
"dependencies": {
"@waku/interfaces": "*",
"@waku/core": "*",
"@waku/create": "*"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"cspell": "^5.14.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^4.0.2",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"typescript": "^4.6.3"
}
}

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "esnext",
"noEmit": true
},
"exclude": []
}

View File

@ -0,0 +1,54 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2020",
"outDir": "dist/",
"rootDir": "src",
"moduleResolution": "node",
"module": "es2020",
"declaration": true,
"sourceMap": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"resolveJsonModule": true /* Include modules imported with .json extension. */,
"tsBuildInfoFile": "dist/.tsbuildinfo",
"strict": true /* Enable all strict type-checking options. */,
/* Strict Type-Checking Options */
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"strictNullChecks": true /* Enable strict null checks. */,
"strictFunctionTypes": true /* Enable strict checking of function types. */,
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"forceConsistentCasingInFileNames": true,
/* Debugging Options */
"traceResolution": false /* Report module resolution log messages. */,
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
"listFiles": false /* Print names of files part of the compilation. */,
"pretty": true /* Stylize errors and messages using color and context. */,
// Due to broken types in indirect dependencies
"skipLibCheck": true,
/* Experimental Options */
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
"lib": ["es2020", "dom"],
"types": ["node", "mocha"],
"typeRoots": ["node_modules/@types", "src/types"]
},
"include": ["src"],
"exclude": ["src/**/*.spec.ts", "src/test_utils"],
"compileOnSave": false,
"ts-node": {
"files": true
}
}

View File

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.dev",
"compilerOptions": {
"noEmit": false
}
}