[Solved] Pnpm run test error

Hi,

Solution

I’ve tried to run test with pnpm, pnpm run test, but gotten error (see error-output below).
Got same error with fresh install pnpm dlx makes aurelia/v1 (see makes-options)
Any ideas?

makes-options:

aurelia/v1 new-project-name -s cli-bundler,alameda,typescript,htmlmin,postcss,karma,cypress,scaffold-navigation

error-output:

...
Starting 'karma'...
10 02 2022 21:37:15.233:WARN [karma-server]: Passing raw CLI options to `new Server(config, done)` is deprecated. Use `parseConfig(configFilePath, cliOptions, {promiseConfig: true, throwErrors: true})` to prepare a processed `Config` instance and pass that as the `config` argument instead.
10 02 2022 21:37:15.483:ERROR [plugin]: Cannot load "typescript", it is not registered!
  Perhaps you are missing some plugin?
10 02 2022 21:37:15.483:ERROR [plugin]: Cannot load "sourcemap", it is not registered!
  Perhaps you are missing some plugin?
10 02 2022 21:37:15.486:ERROR [karma-server]: Server start failed on port 9876: Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
Finished 'karma'
 ELIFECYCLE  Test failed. See above for more details.

Sorry never used pnpm, only npm.

ok. noted.

If anyone tried aurelia test with pnpm and can get it to work, please advise. Thanks

i havent tried but I suspect its the way how karma automatically loads plugins without conf named karma-xxx using npm. If you try whats mentioned here and explicitely register/load the plugins does it help? Karma and Rollup - Not found provider for: framework:qunit · Issue #720 · pnpm/pnpm · GitHub

also, which version of nodejs and pnpm are you running?

1 Like

@zewa666 thank you. it works.

nodejs: v17.3.0
pnpm: 6.31.0

karma.conf.js

    // Make Karma work with pnpm.
    // See: https://github.com/pnpm/pnpm/issues/720#issuecomment-954120387
    plugins: Object.keys(require("./package.json").devDependencies).flatMap(
      (packageName) => {
        if (!packageName.startsWith("karma-")) return []
        return [ require(packageName) ]
      },
    ),
1 Like