You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a new INK project with npx create-ink-app --typescript causes many errors when you try to "test" with npm test.
I will show you how to make the testing work.
Fixing linting issues is outside the scope.
Let's start with a new project.
Bootstrapping a new INK project
Create a new folder, and go into the folder.
# bash
mkdir ink3
cd ink3
#zsh - this will create a new folder and take you there
take ink3
And bootstrap a new project. NOTE - This command will bootstrap a new project in the current folder.
npx create-ink-app --typescript
Install Depedencies
npm i -D eslint eslint-config-xo-typescript eslint-config-xo-typescript eslint-plugin-unicorn
Initial project test run
Run the test after the project is created.
npm test
You will be greeted with the following error
dance2die@ooboontoo ~/src/throwaway/CLI/ink3 npx create-ink-app --typescript
✔ Copy files
✔ Install dependencies
✔ Link executable
dance2die@ooboontoo ~/src/throwaway/CLI/ink3 npm test>[email protected] pretest
> npm run build
>[email protected] build
> tsc && chmod +x dist/cli.js
>[email protected]test> xo && ava
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Failed to load plugin 'unicorn' declared in'BaseConfig » /home/dance2die/src/throwaway/CLI/ink3/node_modules/xo/config/plugins.js': Package subpath './lib/rules/no-warning-comments' is not defined by "exports"in /home/dance2die/src/throwaway/CLI/ink3/node_modules/eslint/package.json
Referenced from: /home/dance2die/src/throwaway/CLI/ink3/node_modules/xo/config/plugins.js
at new NodeError (node:internal/errors:388:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:719:3)
at resolveExports (node:internal/modules/cjs/loader:488:36)
at Module._findPath (node:internal/modules/cjs/loader:528:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:932:27)
at Module._load (node:internal/modules/cjs/loader:787:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/dance2die/src/throwaway/CLI/ink3/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js:5:18)
✘ dance2die@ooboontoo ~/src/throwaway/CLI/ink3
Updating NPM packages
Run npm-check-updates to update NPM package versions in package.json.
This only updates package.json file; You need to run npm install yourself.
dance2die@ooboontoo ~/src/throwaway/CLI/ink3 npx npm-check-updates -u
Upgrading /home/dance2die/src/throwaway/CLI/ink3/package.json
[====================] 14/14 100%
meow ^9.0.0 → ^10.1.2
react ^17.0.2 → ^18.2.0
chalk ^4.1.2 → ^5.0.1
xo ^0.39.1 → ^0.50.0
Run npm install to install new versions
Reinstalling packages
IMPORTANT: Delete both node_modules and package-lock.json.
If you don't do this, nothing will work.
rm -rf node_modules package-lock.json
Now reinstall pacakges.
npm install
This will install packages (creating node_modules folder again) and create a fresh package-lock.json.
Second test run
When you run the test again with npm test, you will get the following error.
dance2die@ooboontoo ~/src/throwaway/CLI/ink3 npm test>[email protected]test /home/dance2die/src/throwaway/CLI/ink3
> xo && ava
Error: Missing 'compile' property in TypeScript configuration for AVA. See https://github.com/avajs/typescript/blob/v3.0.1/README.md
at validate (file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/@ava/typescript/index.js:21:11)
at main (file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/@ava/typescript/index.js:83:4)
at collectProviders (file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/ava/lib/eslint-plugin-helper-worker.js:19:10)
at async file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/ava/lib/eslint-plugin-helper-worker.js:45:22
at async resolveGlobs (file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/ava/lib/eslint-plugin-helper-worker.js:50:28)
at async handleMessage (file:///home/dance2die/src/throwaway/CLI/ink3/node_modules/ava/lib/eslint-plugin-helper-worker.js:60:17)
ELIFECYCLE Test failed. See above for more details.
The error is saying that we need to tell AVA not to compile.
Now let's update ava and eslintConfig in package.json.
Updating AVA and eslintConfig in package.json
Inside package.json, update the configuration as shown below.