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

cannot load such file -- pact/mock_service/request_handlers/base_administration_request_handler #200

Closed
Christoph-Raab opened this issue Nov 29, 2019 · 6 comments

Comments

@Christoph-Raab
Copy link

Software versions

  • Windows 10.0.18362 Build 18362
  • @pact-foundation/pact: 9.5.0
  • jest: 24.9.0
  • Node Version v10.15.3
  • npm Version: 6.4.1

Expected behaviour

Contract tests run with jest

Actual behaviour

The project is setup like this:
https://github.com/pact-foundation/pact-js/tree/master/examples/jest

On running:
jest --runInBand --setupFiles ./pact/pactSetup.js --setupTestFrameworkScriptFile=./pact/pactTestWrapper.js

I get the error message (see detailed log below):
cannot load such file -- pact/mock_service/request_handlers/base_administration_request_handler (LoadError)

Afterwards the test suite fails because:
TypeError: Cannot read property 'writePact' of undefined

[INFO] 
[INFO]       3 | beforeAll(() => provider.setup())
[INFO]       4 | 
[INFO]     > 5 | afterAll(() => provider.finalize())
[INFO]         |                         ^
[INFO]       6 | 

I am aware of this issue:
#100,

but enabling long path did nothing.

Steps to reproduce

I am running the build inside the https://github.com/eirslett/frontend-maven-plugin and call the npm run test commant like this:

<execution>
    <id>npm build</id>
    <goals>
        <goal>npm</goal>
    </goals>
   <phase>generate-resources</phase>
  <configuration>
      <arguments>run test</arguments>
  </configuration>
</execution>

This works in principle, since I can run other tests with jest with this command. For testing, all other tests are disabled, I only run the contract test.

When I delete the node_modules folder and run within wsl2:

  • npm install
  • npm run test

This works. It's only inside the frontend-maven-plugin.
Inside the frontend-maven-plugin runs the npm install command, which downloads the binaries for win32:

Installing Pact Standalone Binary for win32.
[INFO] Downloading Pact Standalone Binary v1.72.2 for platform win32 from https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.72.2/pact-1.72.2-win32.zip

When I browse to pact/mock_service/request_handlers inside node_module, there is a base_administration_request_handler.rb file

Any ideas?

Detailed log

INFO: pact-node@10.2.2/19320 on xyz:
[INFO] Creating Pact Server with options:
[INFO] {"consumer":"MyClient","cors":false,"dir":"...}
[INFO] ERROR: Process "15732" not found.
[INFO] [2019-11-29T07:32:30.393Z] ERROR: pact-node@10.2.2/19320 on en-pc-066:
[INFO] Pact Binary Error: D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/request_handlers/interaction_post.rb:1:in require': cannot load such file -- pact/mock_service/request_handlers/base_administration_request_handler (LoadError) [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/request_handlers/interaction_post.rb:1:in <top (required)>'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/request_handlers.rb:1:in require' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/request_handlers.rb:1:in <top (required)>'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/app.rb:6:in require' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/app.rb:6:in <top (required)>'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/run.rb:2:in require' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/run.rb:2:in <top (required)>'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/cli.rb:33:in require' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.2.0/lib/pact/mock_service/cli.rb:33:in service'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' [INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in start'
[INFO] from D:/projects/.../frontend/node_modules/@pact-foundation/pact-node/standalone/win32-1.72.2/lib/app/pact-mock-service.rb:15:in `

'
[INFO]
[INFO] [2019-11-29T07:32:30.457Z] WARN: pact-node@10.2.2/19320 on xyz: Pact exited with code 1.

@TimothyJones
Copy link
Contributor

Can you try building the project in a shallower path? (this will help confirm that it is indeed the long path issue).

@Christoph-Raab
Copy link
Author

Christoph-Raab commented Dec 2, 2019

I set up a project in C:\testd, instead of now it works.

Also I counted letters of the original path, it is more than 263.

I also figured, that I might have to enable longPaths in the Admin Templates of Computer Configuration as mentioned here:
https://stackoverflow.com/questions/27680647/does-max-path-issue-still-exists-in-windows-10

I did that, but it still doesn't work.

Any other ideas?

@bethesque
Copy link
Member

If it is indeed the 'too long path' issue, we don't have a fix at the moment I'm afraid. We are working on an alternative to the pact-ruby-standalone, however, we don't have an expected finish date yet.

@mefellows
Copy link
Member

mefellows commented Dec 2, 2019

Any other ideas?

Use a Linux VM? Or Docker?

@Christoph-Raab
Copy link
Author

Christoph-Raab commented Dec 3, 2019

If it is indeed the 'too long path' issue, we don't have a fix at the moment I'm afraid. We are working on an alternative to the pact-ruby-standalone, however, we don't have an expected finish date yet.

Ok, thanks, that's bad.

Use a Linux VM? Or Docker?

I would have to set this up and everyone in my team. Bit much overhead just to use a dependency.

But ok, than I guess I have to rethink and/or wait for the release of the new standalone

@snukone
Copy link

snukone commented Mar 2, 2022

In my case the path of the project under windows was just too long. To solv this i had to copy the project to a directory which wasnt that much nested as before (i.e. C:\myproject).

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

5 participants