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

index.ts test state leaks across tests #43

Open
filmaj opened this issue May 20, 2023 · 0 comments
Open

index.ts test state leaks across tests #43

filmaj opened this issue May 20, 2023 · 0 comments

Comments

@filmaj
Copy link

filmaj commented May 20, 2023

Was trying to add a feature and was writing tests and saw some very weird behaviour on node v20.2.0.

In /tests/index.ts.ts, in the beforeEach, if you add this console.log line at the end of the setup function:

  beforeEach(() => {
    nock.cleanAll()
    tools = generateToolkit()
    delete process.env.INPUT_SETUP
    delete process.env.INPUT_TAG_NAME
    console.log(tools.context.payload)
  })

... you can see that the context.payload state that is modified in certain tests in index.test.ts (like setting draft or prelease) leaks across tests. Here's the output from npm test (see last two logs):

  ● Console

    console.log
      { release: { draft: false, prerelease: false, tag_name: 'v1.0.0' } }

      at Object.<anonymous> (tests/index.test.ts:14:13)

    console.log
      { release: { draft: false, prerelease: false, tag_name: 'v1.0.0' } }

      at Object.<anonymous> (tests/index.test.ts:14:13)

    console.log
      { release: { draft: false, prerelease: false, tag_name: 'v1.0.0' } }

      at Object.<anonymous> (tests/index.test.ts:14:13)

    console.log
      { release: { draft: true, prerelease: false, tag_name: 'v1.0.0' } }

      at Object.<anonymous> (tests/index.test.ts:14:13)

    console.log
      { release: { draft: true, prerelease: true, tag_name: 'v1.0.0' } }

      at Object.<anonymous> (tests/index.test.ts:14:13)
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

No branches or pull requests

1 participant