Repository: karen-irc/option-t
Pull request #1145 (2021-11-08 13:51:11)

Remove histrocial TypeScript tests
This test does not run in CI for a long time....


Patch:
diff --git a/Makefile b/Makefile
index a69b2460..4b084271 100644
--- a/Makefile
+++ b/Makefile
@@ -171,10 +171,6 @@ typecheck: ## Check static types
 ###########################
 # Test
 ###########################
-.PHONY: build_test
-build_test: build
-	$(NPM_BIN)/tsc --project $(CURDIR)/tsconfig.test.json --noEmit
-
 .PHONY: run_ava
 run_ava: build
 	$(MAKE) run_ava_only -C $(CURDIR)
diff --git a/tsconfig.json b/tsconfig.json
index 0533a8b3..ad87d1b5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,9 +3,5 @@
     "include": [
         "src/**/*",
         "__tests__/**/*"
-    ],
-    "exclude": [
-        "__tests__/ClassOption/type_definition.ts",
-        "__tests__/ClassResult/type_definition_es6.ts"
     ]
 }


Test patch:
diff --git a/__tests__/ClassOption/type_definition.ts b/__tests__/ClassOption/type_definition.ts
deleted file mode 100644
index bf0839bb..00000000
--- a/__tests__/ClassOption/type_definition.ts
+++ /dev/null
@@ -1,93 +0,0 @@
-// XXX:
-// The type definitions for '--moduleResolution node' is a ES6 format,
-// So it would test it by importing it simply.
-import { Option, OptionBase, createSome, createNone, Some, None } from '../../__dist/esm/Option';
-
-// `Some<T>`
-(function () {
-    var option: Option<number> = createSome(1);
-    option = new Some<number>(1);
-    option = createSome<number>(1);
-    var isSome: boolean = option.isSome;
-    var isNone: boolean = option.isNone;
-    var unwrap: number = option.unwrap();
-    var unwrapOr: number = option.unwrapOr(10);
-    var unwrapOrElse: number = option.unwrapOrElse((): number => 10);
-    var expect: number = option.expect('barfoo');
-    var map: Option<string> = option.map((val: number): string => String(val));
-    var flatMap: Option<string> = option.flatMap((val: number): Option<string> => {
-        return createSome(String(val));
-    });
-    var mapOr: string = option.mapOr('bar', (val: number): string => String(val));
-    var mapOrElse: string = option.mapOrElse(
-        (): string => {
-            return String(10);
-        },
-        (v: number) => {
-            return String(v);
-        }
-    );
-    var and: Option<string> = option.and(createSome<string>('bar'));
-    var andThen: Option<string> = option.andThen((_: number): Option<string> => {
-        return createNone<string>();
-    });
-    var or: Option<number> = option.or(createSome<number>(10));
-    var orElse: Option<number> = option.orElse((): Option<number> => {
-        return createSome<number>(2);
-    });
-    option.drop();
-    option.drop((_: number) => {});
-
-    if (option instanceof OptionBase) {
-        const bar: any = null;
-    }
-})();
-
-// `None<T>`
-(function () {
-    var option: Option<number> = createNone<number>();
-    option = new None<number>();
-    option = createNone<number>();
-    var isSome: boolean = option.isSome;
-    var isNone: boolean = option.isNone;
-    var unwrap: number = option.unwrap();
-    var unwrapOr: number = option.unwrapOr(10);
-    var unwrapOrElse: number = option.unwrapOrElse((): number => 10);
-    var expect: number = option.expect('barfoo');
-    var map: Option<string> = option.map((val: number): string => String(val));
-    var flatMap: Option<string> = option.flatMap((_: number): Option<string> => {
-        return createNone<string>();
-    });
-    var mapOr: string = option.mapOr('bar', (val: number): string => String(val));
-    var mapOrElse: string = option.mapOrElse(
-        (): string => {
-            return String(10);
-        },
-        (v: number) => {
-            return String(v);
-        }
-    );
-    var and: Option<string> = option.and(createSome<string>('bar'));
-    var andThen: Option<string> = option.andThen((_: number): Option<string> => {
-        return createNone<string>();
-    });
-    var or: Option<number> = option.or(createSome<number>(10));
-    var orElse: Option<number> = option.orElse((): Option<number> => {
-        return createSome<number>(2);
-    });
-    option.drop();
-    option.drop((_: number) => {});
-
-    if (option instanceof OptionBase) {
-        const bar: any = null;
-    }
-})();
-
-// `Option<T>`
-(function () {
-    var option: Option<number> = createNone<number>();
-    option = createSome(1);
-
-    var option2: Option<string> = createSome('bar');
-    option2 = createNone<string>();
-})();
diff --git a/__tests__/ClassResult/type_definition_es6.ts b/__tests__/ClassResult/type_definition_es6.ts
deleted file mode 100644
index b0dfdaf4..00000000
--- a/__tests__/ClassResult/type_definition_es6.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-/* eslint-disable @typescript-eslint/no-unused-vars */
-
-// XXX:
-// The type definitions for '--moduleResolution node' is a ES6 format,
-// So it would test it by importing it simply.
-import { Option } from '../../__dist/esm/Option';
-import { Result, ResultBase, createOk, createErr, Ok, Err } from '../../__dist/esm/Result';
-
-//  Ok<T>
-(function () {
-    let result: Result<number, void> = createOk<number, void>(1);
-    result = new Ok<number, void>(1);
-    result = createOk<number, void>(1);
-
-    const isOk: boolean = result.isOk();
-    const isErr: boolean = result.isErr();
-
-    const ok: Option<number> = result.ok();
-    const err: Option<void> = result.err();
-
-    const map: Result<string, void> = result.map<string>((v: number) => String(v));
-    const mapErr: Result<number, string> = result.mapErr<string>((_: void) => String(''));
-
-    const and1: Result<string, void> = result.and(createOk<string, void>(''));
-    const and2: Result<string, void> = result.and(createErr<string, void>(undefined));
-    const andThen1: Result<string, void> = result.andThen<string>((_: number) =>
-        createOk<string, void>('')
-    );
-    const andThen2: Result<string, void> = result.andThen<string>((_: number) =>
-        createErr<string, void>(undefined)
-    );
-
-    const or1: Result<number, string> = result.or<string>(createOk<number, string>(1));
-    const or2: Result<number, string> = result.or<string>(createErr<number, string>(''));
-    const orElse1: Result<number, string> = result.orElse<string>((_: void) =>
-        createOk<number, string>(1)
-    );
-    const orElse2: Result<number, string> = result.orElse<string>((_: void) =>
-        createErr<number, string>('')
-    );
-
-    const unwrap: number = result.unwrap();
-    const unwrapErr: void = result.unwrapErr();
-    const unwrapOr: number = result.unwrapOr(1);
-    const unwrapOrElse: number = result.unwrapOrElse((_: void) => 1);
-    const expect: number = result.expect('');
-
-    result.drop();
-    result.drop((_: number) => {});
-    result.drop(
-        (_: number) => {},
-        (_: void) => {}
-    );
-
-    if (result instanceof ResultBase) {
-        const bar: any = null;
-    }
-})();
-
-//  Err<E>
-(function () {
-    let result: Result<number, void> = createErr<number, void>(undefined);
-    result = new Err<number, void>(undefined);
-    result = createErr<number, void>(undefined);
-
-    const isOk: boolean = result.isOk();
-    const isErr: boolean = result.isErr();
-
-    const ok: Option<number> = result.ok();
-    const err: Option<void> = result.err();
-
-    const map: Result<string, void> = result.map<string>((v: number) => String(v));
-    const mapErr: Result<number, string> = result.mapErr<string>((_: void) => String(''));
-
-    const and1: Result<string, void> = result.and(createOk<string, void>(''));
-    const and2: Result<string, void> = result.and(createErr<string, void>(undefined));
-    const andThen1: Result<string, void> = result.andThen<string>((_: number) =>
-        createOk<string, void>('')
-    );
-    const andThen2: Result<string, void> = result.andThen<string>((_: number) =>
-        createErr<string, void>(undefined)
-    );
-
-    const or1: Result<number, string> = result.or<string>(createOk<number, string>(1));
-    const or2: Result<number, string> = result.or<string>(createErr<number, string>(''));
-    const orElse1: Result<number, string> = result.orElse<string>((_: void) =>
-        createOk<number, string>(1)
-    );
-    const orElse2: Result<number, string> = result.orElse<string>((_: void) =>
-        createErr<number, string>('')
-    );
-
-    const unwrap: number = result.unwrap();
-    const unwrapErr: void = result.unwrapErr();
-    const unwrapOr: number = result.unwrapOr(1);
-    const unwrapOrElse: number = result.unwrapOrElse((_: void) => 1);
-    const expect: number = result.expect('');
-
-    result.drop();
-    result.drop((_: number) => {});
-    result.drop(
-        (_: number) => {},
-        (_: void) => {}
-    );
-
-    if (result instanceof ResultBase) {
-        const bar: any = null;
-    }
-})();
-
-//  Result<T, E>
-(function () {
-    let option: Result<void, void> = createErr<void, void>(undefined);
-    option = createOk<void, void>(undefined);
-
-    let option2: Result<void, void> = createOk<void, void>(undefined);
-    option2 = createErr<void, void>(undefined);
-})();
diff --git a/tsconfig.test.json b/tsconfig.test.json
deleted file mode 100644
index 0af36db1..00000000
--- a/tsconfig.test.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-    "extends": "./tsconfig.base.json",
-    "compilerOptions": {
-        "target": "es2020",
-        "module": "commonjs",
-        "diagnostics": true,
-        "lib": [
-            "es2017"
-        ],
-        "allowJs": true,
-        "declaration": false,
-        "noEmit": false,
-        "noUnusedLocals": false // for testing
-    },
-    "include": [
-        "src/**/*",
-        "__tests__/**/*"
-    ]
-}