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

Upgrade Jasmine + friends to v5 #11647

Closed
chadlwilson opened this issue Jun 8, 2023 · 0 comments · Fixed by #11648
Closed

Upgrade Jasmine + friends to v5 #11647

chadlwilson opened this issue Jun 8, 2023 · 0 comments · Fixed by #11648
Labels
javascript Pull requests that update Javascript code no stalebot Don't mark this stale. technical-debt tests

Comments

@chadlwilson
Copy link
Member

chadlwilson commented Jun 8, 2023

Summary

Currently we use Jasmine 4.6. jasmine v5 is out, however seems to have some kind of issue with either jasmine-karma or our use of webpack.

Steps to Reproduce
  1. Upgrade jasmine, jasmine-core to 5.0.0+, upgrade jasmine-browser-runner to 2.0.0+
  2. Run ./gradlew jasmineKarma
Expected Results

Tests should work :-)

Actual Results
> Task :server:jasmineKarma FAILED
const stringWidth = require('string-width');
[/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails]$ yarn run jasmine-ci
                    ^
yarn run v1.22.19

$ karma start --single-run
Error [ERR_REQUIRE_ESM]: require() of ES Module /go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/string-width/index.js from /go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs not supported.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Instead change the require of index.js in /go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs:291:21)
    at Object.<anonymous> (/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/yargs/build/index.cjs:2861:12)
    at Object.<anonymous> (/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/yargs/index.cjs:5:30)
    at Object.<anonymous> (/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/karma/lib/cli.js:4:15)
    at Object.<anonymous> (/go/pipelines/build-linux-pull_11645/server/src/main/webapp/WEB-INF/rails/node_modules/karma/bin/karma:3:1) {
  code: 'ERR_REQUIRE_ESM'
}

/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs:293
const wrap = require('wrap-ansi');
             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/wrap-ansi/index.js from /Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/cliui/build/index.cjs:293:14)
    at Object.<anonymous> (/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/yargs/build/index.cjs:2861:12)
    at Object.<anonymous> (/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/yargs/index.cjs:5:30)
    at Object.<anonymous> (/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/karma/lib/cli.js:4:15)
    at Object.<anonymous> (/Users/chad/Projects/community/gocd/gocd/server/src/main/webapp/WEB-INF/rails/node_modules/karma/bin/karma:3:1) {
  code: 'ERR_REQUIRE_ESM'
}

Possible Fix
  warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/Users/chad/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.2.0"] is trying to unpack in the same destination "/Users/chad/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["wrap-ansi@^7.0.0"] is trying to unpack in the same destination "/Users/chad/Library/Caches/Yarn/v6/npm-wrap-ansi-cjs-7.0.0-67e145cff510a6a6984bdf1152911d69d2eb9e43-integrity/node_modules/wrap-ansi-cjs" as pattern ["wrap-ansi-cjs@npm:wrap-ansi@^7.0.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.2.3"] is trying to unpack in the same destination "/Users/chad/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
@chadlwilson chadlwilson added tests technical-debt javascript Pull requests that update Javascript code labels Jun 8, 2023
@chadlwilson chadlwilson added the no stalebot Don't mark this stale. label Jun 8, 2023
chadlwilson added a commit to chadlwilson/gocd that referenced this issue Jun 8, 2023
Locks some transitive dependencies to non-ESM versions as there seems to be a clash/issue with either Yarn, webpack or our use of CJS/ESM, see gocd#11647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code no stalebot Don't mark this stale. technical-debt tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant