Commit d2778fd8 authored by nanahira's avatar nanahira

add dev and tests

parent a08dea6c
Pipeline #9741 failed with stages
in 2 minutes and 32 seconds
stages:
- install
- build
- deploy
variables:
GIT_DEPTH: "1"
build:
stage: build
npm_ci:
stage: install
tags:
- linux
script:
- npm ci
- npm run build
artifacts:
paths:
- node_modules
.build_base:
stage: build
tags:
- linux
dependencies:
- npm_ci
build:
extends: .build_base
script: npm run build
artifacts:
paths:
- dist/
test:
extends: .build_base
script: npm run test
upload_to_minio:
stage: deploy
dependencies:
......
......@@ -8,3 +8,8 @@
Dockerfile
/src
/dist/full
/coverage
/tests
/dist/tests
/dev
/dist/dev
import { App } from 'koishi';
import TargetPlugin from '../src';
import ConsolePlugin from '@koishijs/plugin-console';
import SandboxPlugin from '@koishijs/plugin-sandbox';
const app = new App({
port: 14514,
host: 'localhost',
prefix: '.',
});
app.plugin(ConsolePlugin, {
open: true,
});
app.plugin(SandboxPlugin);
app.plugin(TargetPlugin, {});
app.start();
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,7 +6,9 @@
"types": "dist/index.d.ts",
"scripts": {
"lint": "eslint --fix .",
"build": "webpack && env PACK_ALL=1 webpack"
"build": "webpack && env PACK_ALL=1 webpack",
"start": "ts-node ./dev",
"test": "jest --passWithNoTests"
},
"repository": {
"type": "git",
......@@ -30,21 +32,43 @@
"source-map-support": "^0.5.21"
},
"peerDependencies": {
"koishi": "^4.2.1"
"koishi": "^4.2.2"
},
"devDependencies": {
"@koishijs/plugin-console": "^3.1.1",
"@koishijs/plugin-sandbox": "^1.0.0",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.1",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"raw-loader": "^4.0.2",
"ts-jest": "^27.1.3",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2",
"ws": "^8.5.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "tests",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
import { App } from 'koishi';
import TargetPlugin from '../src';
describe('Test of plugin.', () => {
let app: App;
beforeEach(async () => {
app = new App();
// app.plugin(TargetPlugin);
await app.start();
});
it('should pass', () => {
expect(true).toBe(true);
});
});
......@@ -14,6 +14,8 @@
"allowJs": true,
"include": [
"*.ts",
"src/**/*.ts"
"src/**/*.ts",
"tests/**/*.ts",
"dev/**/*.ts"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment