Skip to content

Commit

Permalink
tests: pnpm setup
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Jun 17, 2024
1 parent 42ad6cb commit 5a1aba9
Show file tree
Hide file tree
Showing 13 changed files with 1,284 additions and 5,624 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ jobs:
run: |-
npm i -g npm@^8
npm --version
- name: enable pnpm
run: |-
corepack enable pnpm
pnpm --version
- name: enable yarn
if: "matrix.node-version != '14.0.0'" # yarn14 has broken corepack
run: |-
Expand Down
5,686 changes: 62 additions & 5,624 deletions tests/integration/__snapshots__/index.test.js.snap

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions tests/integration/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ const testSetups = [
}
]
},
{
dir: 'webpack5-vue2-pnpm',
purpose: 'functional: webpack5 with vue2 in pnpm setup',
packageManager: 'pnpm',
results: [ // paths relative to `dir`
{
format: 'xml',
file: 'dist/.bom/bom.xml'
},
{
format: 'json',
file: 'dist/.bom/bom.json'
},
{
format: 'json',
file: 'dist/.well-known/sbom'
}
]
},
{
dir: 'webpack5-angular13',
purpose: 'functional: webpack5 with angular13',
Expand Down
23 changes: 23 additions & 0 deletions tests/integration/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ const nodeSV = Object.freeze((process?.versions?.node ?? '').split('.').map(Numb
// endregion regression tests
]

const REQUIRES_PNPM_INSTALL = [
// region functional tests

Check failure on line 39 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 4 spaces but found 6
'webpack5-vue2-pnpm'

Check failure on line 40 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 4 spaces but found 6
// endregion functional tests

Check failure on line 41 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 4 spaces but found 6
// region regression tests

Check failure on line 42 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 4 spaces but found 6
// endregion regression tests

Check failure on line 43 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 4 spaces but found 6
]

Check failure on line 44 in tests/integration/setup.js

View workflow job for this annotation

GitHub Actions / test standard

Expected indentation of 2 spaces but found 4

const REQUIRES_YARN_INSTALL = nodeSV[0] > 16
? [
// region functional tests
Expand Down Expand Up @@ -68,6 +76,21 @@ const nodeSV = Object.freeze((process?.versions?.node ?? '').split('.').map(Numb
}
}

for (const DIR of REQUIRES_PNPM_INSTALL) {
console.log('>>> setup with PNPM:', DIR)
const done = spawnSync(
'pnpm', ['install', '--frozen-lockfile'], {
cwd: path.resolve(__dirname, DIR),
stdio: 'inherit',
shell: true
}
)
if (done.status !== 0) {
++process.exitCode
console.error(done)
}
}

for (const DIR of REQUIRES_YARN_INSTALL) {
console.log('>>> setup with YARN:', DIR)
let done = spawnSync(
Expand Down
1 change: 1 addition & 0 deletions tests/integration/webpack5-vue2-pnpm/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
** linguist-vendored
10 changes: 10 additions & 0 deletions tests/integration/webpack5-vue2-pnpm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*
!/.gitignore
!/.gitattributes
!/README.md
!/package.json
!/pnpm-lock.yaml
!/.npmrc
!/webpack.config.js
!/src
!/src/*
3 changes: 3 additions & 0 deletions tests/integration/webpack5-vue2-pnpm/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
; see the docs: https://pnpm.io/npmrc

lockfile=true
4 changes: 4 additions & 0 deletions tests/integration/webpack5-vue2-pnpm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Test: Vue.js bundled with webpack5 in a pnpm setup

This setup is intended to create reproducible results (SBoM).
It might install outdated, unmaintained or vulnerable components, for showcasing purposes.
46 changes: 46 additions & 0 deletions tests/integration/webpack5-vue2-pnpm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@cyclonedx-webpack-plugin-tests/example-webpack5-vue2-pnpm",
"description": "example setup witch Vue2 in WebPack5 with pnpm setup",
"private": true,
"homepage": "https://github.com/CycloneDX/cyclonedx-webpack-plugin/tree/master/tests/integration/webpack5-vue2#readme",
"copyright": "Copyright OWASP Foundation",
"license": "Apache-2.0",
"author": {
"name": "Jan Kowalleck",
"email": "jan.kowalleck@gmail.com"
},
"contributors": [
{
"name": "Jan Kowalleck",
"email": "jan.kowalleck@gmail.com"
}
],
"repository": {
"type": "git",
"url": "git+https://github.com/CycloneDX/cyclonedx-webpack-plugin.git",
"directory": "tests/integration/webpack5-vue2-yarn"
},
"bugs": {
"url": "https://github.com/CycloneDX/cyclonedx-webpack-plugin/issues"
},
"main": "index.html",
"scripts": {
"prebuild:node": "node -r fs -e 'fs.rmSync(\"dist\",{recursive:true,force:true})'",
"build": "webpack build"
},
"dependencies": {
"vue": "^2.6.14"
},
"devDependencies": {
"@cyclonedx/webpack-plugin": "link:../../..",
"html-inline-script-webpack-plugin": "^3.0.0",
"html-webpack-plugin": "^5.5.0",
"webpack": "^5",
"webpack-cli": "^5"
},
"engines": {
"node": ">=14",
"pnpm": ">=8"
},
"packageManager": "pnpm@8.3.1"
}
Loading

0 comments on commit 5a1aba9

Please sign in to comment.