Skip to content

Cannot run dev package.json script; missing pkl module file argument; jest tries to run ./dist #62

@weedySeaDragon

Description

@weedySeaDragon

What Happens

I can't run the package.json scripts successfully

  1. When I run the dev script in package.json I get an error.Here is the output:
> @pkl-community/pkl-typescript@0.0.19 dev
> tsx pkl-gen-typescript/main.ts


 ERROR  You must provide at least one file to evaluate.                                                    11:08:13 AM

◐ Generating TypeScript sources for modules                                                                                          11:08:13 AM

Process finished with exit code 0
  1. when I run the e2e script in package.json, jest tries to also run tests in the /dist directory.
> @pkl-community/pkl-typescript@0.0.19 test:e2e
> jest

[start] Generating TypeScript sources for modules /Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/dist/e2e/only_primitives/schema.pkl
[start] Generating TypeScript sources for modules /Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/dist/e2e/only_primitives/schema.pkl
[start] Generating TypeScript sources for modules /Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/dist/e2e/only_primitives/schema.pkl
[start] Generating TypeScript sources for modules /Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/e2e/only_primitives/schema.pkl
[start] Generating TypeScript sources for modules /Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/dist/e2e/only_primitives/schema.pkl
 FAIL  dist/e2e/only_primitives/primitives.test.js
  ● E2E of config with only primitive values › can generate TypeScript sources and load valid values

    –– Pkl Error ––
    Cannot find module `file:///Users/ashley0/DEV/CODE/TS-JS/GH-other-owners/pkl-typescript/dist/e2e/only_primitives/schema.pkl`.

[snip]

What I expected to happen

  1. test:e2e would only run tests in the ./e2e directory and jest would ignore the dist directory
  2. 'dev':
    1. First make sure everything is freshly compiled / generated etc.
    2. Run pkl-gen-typescript/main.ts and provide a pkl module (perhaps some simple one in an example or test directory)

Discussion

Suggestions

Here's how I would update the package.json script:
"test:e2e": "jest ./e2e",

"dev": "tsc && tsx pkl-gen-typescript/main.ts ./examples/basic-intro/config.pkl",

And I would create a configuration file for jest so that the directories it recognizes as valid (e.g. testMatch patterns) are made explicit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions