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

BUG -- Concurrency error with node-http adapter when running a test suite with skipped test #359

Open
AELSchauer opened this issue Sep 1, 2020 · 3 comments

Comments

@AELSchauer
Copy link

Description

Running a test suite with any skipped tests with jest (xit, it.only, it.skip) results in a concurrency error. However, running the same set of tests in which no tests are skipped, does not result in any errors.

Shareable Source

it('test A', async () => {
  ...
});

xit('test B', async () => {
  ...
});

Error Message & Stack Trace

PollyError: [Polly] [adapter:node-http] Running concurrent node-http adapters is unsupported, stop any running Polly instances.

      at Object.assert (node_modules/@pollyjs/utils/src/utils/assert.js:5:11)
      at HttpAdapter.assert (node_modules/@pollyjs/adapter/src/index.js:224:5)
      at HttpAdapter.onConnect (node_modules/@pollyjs/adapter-node-http/src/index.js:39:10)
      at HttpAdapter.connect (node_modules/@pollyjs/adapter/src/index.js:48:12)
      at Polly.connectTo (node_modules/@pollyjs/core/src/polly.js:281:13)
      at forEach (node_modules/@pollyjs/core/src/polly.js:165:50)
          at Array.forEach (<anonymous>)
      at Polly.configure (node_modules/@pollyjs/core/src/polly.js:165:26)
      at new Polly (node_modules/@pollyjs/core/src/polly.js:49:10)
      at PollyEnvironmentNode.handleTestEvent (node_modules/setup-polly-jest/lib/jest-environment-polly.js:85:48)

Config

Copy the config used to setup the Polly instance:

setupPolly({
  adapters: [NodeHttpAdapter],
  persister: FSPersister,
  persisterOptions: {
    fs: {
      recordingsDir: path.resolve(__dirname, '__recordings__')
    }
  }
});

Dependencies

Copy the @pollyjs dependencies from package.json:

{
    "@pollyjs/adapter-node-http": "^5.0.0",
    "@pollyjs/core": "^5.0.0",
    "@pollyjs/persister-fs": "^5.0.0",
    "jest": "^26.4.2",
    "jest-circus": "^26.4.2",
    "setup-polly-jest": "^0.9.1",
}

Environment

Server-side tests. Node v12.18.3
darwin 17.7.0
npm v6.14.6

@jasonmit
Copy link
Contributor

jasonmit commented Sep 5, 2020

Thanks for all the info, we'll look into it.

@offirgolan
Copy link
Collaborator

@gribnoysup I wonder if this is an issue caused by the jasmine setup done in setup-polly-jest? Have you run into this sort of issue before?

@gribnoysup
Copy link
Contributor

gribnoysup commented Sep 7, 2020

Hmmm... we have a test case for it.only and I just added one for it.skip and both are passing on jest with jasmine2 and with circus runner. It might be something with the setup-polly-jest helper especially as jest-circus support is pretty new and I don't think a lot of people are using it, but it would be really hard to tell without a reproduction. Maybe you can provide a more complete example @AELSchauer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants