Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add the build script to the pretest script. #539

Merged
merged 1 commit into from
May 1, 2023

Conversation

lholmquist
Copy link
Contributor

Currently, to run the tests successfully, npm run build needs to be run first in order to ajv compile the schema. We started to run into this when we added this library to the test suite that runs these tests on RHEL and Fedora platforms in our node.js container.

see sclorg/s2i-nodejs-container#384

error for reference:

TSError: ⨯ Unable to compile TypeScript:
src/event/spec.ts:10:22 - error TS2307: Cannot find module '../schema/v1' or its corresponding type declarations.

10 import validate from "../schema/v1";
                        ~~~~~~~~~~~~~~

    at createTSError (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/lholmqui/develop/cloudevents/sdk-javascript/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Function.Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19)

This small change allows a developer to just run npm install and then npm test without having to run the build step separately, which compiles the schema that is needed to run the tests successfully.

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
@lholmquist lholmquist requested a review from lance April 24, 2023 15:16
Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@lance lance merged commit c06ffc1 into cloudevents:main May 1, 2023
@lholmquist lholmquist deleted the add_build_to_pretest branch May 2, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants