Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Remove custom test script (and ts-node) when tsd is updated #21

Open
4 tasks
pastelmind opened this issue Apr 5, 2021 · 0 comments
Open
4 tasks

Remove custom test script (and ts-node) when tsd is updated #21

pastelmind opened this issue Apr 5, 2021 · 0 comments
Assignees
Labels
type: maintenance Project maintenance stuff

Comments

@pastelmind
Copy link
Owner

pastelmind commented Apr 5, 2021

In #20, I added a custom test script (run-tests.ts) to work around a limitation in tsd, our testing tool. Because tsd 0.14.0 does not support the typesVersions property in package.json, it cannot find our typings when invoked from the shell. Since it does not provide any mechanism for specifying a custom type source, we need to temporarily supply a types field in package.json.

To work around this, I wrote a tiny Node.js script (run-tests.ts) that monkey-patches package.json with a types field before running tsd, then restore the original afterwards. I also installed ts-node to avoid an extra compile step when running the script.

The main branch of tsd has recently gained support for custom type sources. Another PR adds an accompanying CLI option for this. If the next release of tsd includes these changes, we may be able to replace this script with an invocation of tsd --typings-file src/index.d.ts.

TODO

  • Wait for a new release of tsd
  • Update tsd
  • Replace custom test script and invoke tsd from the command line instead
  • Remove ts-node and/or @types/node
@pastelmind pastelmind added the type: maintenance Project maintenance stuff label Apr 5, 2021
@pastelmind pastelmind self-assigned this Apr 5, 2021
pastelmind added a commit that referenced this issue Apr 24, 2021
The definitions for `require` and `module` clash with `@types/node`,
which is needed to run the test script (`run-tests.ts`).
To keep the setup working, separate `tsconfig.json` into two files:

- `tsconfig.json` is used to compile `src/` and `test-d/`.
- `tsconfig.test.json` is used to compiel `run-tests.ts`.

Also make ts-node use `tsconfig.test.json` for this.
(Hopefully, all this mess can be removed once #21 is merged.)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: maintenance Project maintenance stuff
Projects
None yet
Development

No branches or pull requests

1 participant