From 4c431c54322985a10aab966519b2ebdfe6eb6f05 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 19 Aug 2021 11:26:26 +0900 Subject: [PATCH] refactor --- CONTRIBUTING.md | 5 +++++ test/activitypub.ts | 9 --------- test/api-visibility.ts | 10 ---------- test/api.ts | 9 --------- test/block.ts | 10 ---------- test/chart.ts | 10 ---------- test/fetch-resource.ts | 10 ---------- test/get-file-info.ts | 10 ---------- test/mfm.ts | 10 ---------- test/mute.ts | 10 ---------- test/note.ts | 10 ---------- test/prelude/maybe.ts | 10 ---------- test/reaction-lib.ts | 10 ---------- test/streaming.ts | 10 ---------- test/user-notes.ts | 10 ---------- 15 files changed, 5 insertions(+), 138 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 436d4224d2..b16d9a75d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,6 +35,11 @@ If your language is not listed in Crowdin, please open an issue. ## Test * Test codes are located in [`/test`](/test). +### Run specify test +``` +npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" npx mocha test/foo.ts --require ts-node/register +``` + ## Continuous integration Misskey uses GitHub Actions for executing automated tests. Configuration files are located in [`/.github/workflows`](/.github/workflows). diff --git a/test/activitypub.ts b/test/activitypub.ts index 24b8d13b85..777e7f355b 100644 --- a/test/activitypub.ts +++ b/test/activitypub.ts @@ -1,12 +1,3 @@ -/* - * Tests for ActivityPub - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" mocha test/activitypub.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" npx mocha test/activitypub.ts --require ts-node/register -g 'test name' - */ process.env.NODE_ENV = 'test'; import rndstr from 'rndstr'; diff --git a/test/api-visibility.ts b/test/api-visibility.ts index 6548146c78..ade7b730b3 100644 --- a/test/api-visibility.ts +++ b/test/api-visibility.ts @@ -1,13 +1,3 @@ -/* - * Tests of API (visibility) - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/api-visibility.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/api-visibility.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/api.ts b/test/api.ts index 68ab2aa179..99fb196dcd 100644 --- a/test/api.ts +++ b/test/api.ts @@ -1,12 +1,3 @@ -/* - * Tests of API - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/api.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/api.ts --require ts-node/register -g 'test name' - */ /* process.env.NODE_ENV = 'test'; diff --git a/test/block.ts b/test/block.ts index 408b218a79..6d9efb77b7 100644 --- a/test/block.ts +++ b/test/block.ts @@ -1,13 +1,3 @@ -/* - * Tests of block - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/block.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/block.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/chart.ts b/test/chart.ts index 4a40b25534..935ac9d8e1 100644 --- a/test/chart.ts +++ b/test/chart.ts @@ -1,13 +1,3 @@ -/* - * Tests of chart engine - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/chart.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/chart.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/fetch-resource.ts b/test/fetch-resource.ts index 31308b08fa..6efe76d8b8 100644 --- a/test/fetch-resource.ts +++ b/test/fetch-resource.ts @@ -1,13 +1,3 @@ -/* - * Tests for Fetch resource - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/fetch-resource.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/fetch-resource.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/get-file-info.ts b/test/get-file-info.ts index 57c021feae..cc9eefbfc6 100644 --- a/test/get-file-info.ts +++ b/test/get-file-info.ts @@ -1,13 +1,3 @@ -/* - * Tests for detection of file information - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true npx mocha test/get-file-info.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true npx mocha test/get-file-info.ts --require ts-node/register -g 'test name' - */ - import * as assert from 'assert'; import { async } from './utils'; import { getFileInfo } from '../src/misc/get-file-info'; diff --git a/test/mfm.ts b/test/mfm.ts index 3f997878b5..d9b98cdac3 100644 --- a/test/mfm.ts +++ b/test/mfm.ts @@ -1,13 +1,3 @@ -/* - * Tests of MFM - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/mfm.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/mfm.ts --require ts-node/register -g 'test name' - */ - import * as assert from 'assert'; import * as mfm from 'mfm-js'; diff --git a/test/mute.ts b/test/mute.ts index 632f60fa43..ecac310758 100644 --- a/test/mute.ts +++ b/test/mute.ts @@ -1,13 +1,3 @@ -/* - * Tests of mute - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/mute.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/mute.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/note.ts b/test/note.ts index 31aaf00da6..ab8b6b1903 100644 --- a/test/note.ts +++ b/test/note.ts @@ -1,13 +1,3 @@ -/* - * Tests of Note - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/note.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/note.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/prelude/maybe.ts b/test/prelude/maybe.ts index d3f17481f8..2687a739a0 100644 --- a/test/prelude/maybe.ts +++ b/test/prelude/maybe.ts @@ -1,13 +1,3 @@ -/* - * Tests of Maybe - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/prelude/maybe.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/prelude/maybe.ts --require ts-node/register -g 'test name' - */ - import * as assert from 'assert'; import { just, nothing } from '../../src/prelude/maybe'; diff --git a/test/reaction-lib.ts b/test/reaction-lib.ts index 5837b5be1f..59c07de001 100644 --- a/test/reaction-lib.ts +++ b/test/reaction-lib.ts @@ -1,13 +1,3 @@ -/* - * Tests of MFM - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/reaction-lib.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/reaction-lib.ts --require ts-node/register -g 'test name' - */ - /* import * as assert from 'assert'; diff --git a/test/streaming.ts b/test/streaming.ts index cc3168e98d..e4b651aa9f 100644 --- a/test/streaming.ts +++ b/test/streaming.ts @@ -1,13 +1,3 @@ -/* - * Tests of streaming API - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/streaming.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/streaming.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert'; diff --git a/test/user-notes.ts b/test/user-notes.ts index 30589f8149..c90c07d75f 100644 --- a/test/user-notes.ts +++ b/test/user-notes.ts @@ -1,13 +1,3 @@ -/* - * Tests of Note - * - * How to run the tests: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/user-notes.ts --require ts-node/register - * - * To specify test: - * > npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true npx mocha test/user-notes.ts --require ts-node/register -g 'test name' - */ - process.env.NODE_ENV = 'test'; import * as assert from 'assert';