Skip to content

Commit

Permalink
test: big lockfile (#213)
Browse files Browse the repository at this point in the history
* test: big lockfile

* fix(test): ignore failed platforms
  • Loading branch information
KSXGitHub authored Nov 22, 2023
1 parent 744976d commit c98128d
Show file tree
Hide file tree
Showing 5 changed files with 9,825 additions and 1 deletion.
38 changes: 37 additions & 1 deletion crates/cli/tests/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ use assert_cmd::prelude::*;
use command_extra::CommandExtra;
use pacquet_testing_utils::{
bin::{AddMockedRegistry, CommandTempCwd},
fixtures::{BIG_LOCKFILE, BIG_MANIFEST},
fs::{get_all_files, get_all_folders, is_symlink_or_junction},
};
use pipe_trait::Pipe;
use std::fs;
use std::{
fs::{self, OpenOptions},
io::Write,
};

#[test]
fn should_install_dependencies() {
Expand Down Expand Up @@ -131,3 +135,35 @@ fn should_install_index_files() {

drop((root, mock_instance)); // cleanup
}

#[cfg(not(target_os = "windows"))] // It causes ConnectionAborted on CI
#[cfg(not(target_os = "macos"))] // It causes ConnectionReset on CI
#[test]
fn frozen_lockfile_should_be_able_to_handle_big_lockfile() {
let CommandTempCwd { pacquet, root, workspace, npmrc_info, .. } =
CommandTempCwd::init().add_mocked_registry();
let AddMockedRegistry { mock_instance, .. } = npmrc_info;

eprintln!("Creating package.json...");
let manifest_path = workspace.join("package.json");
fs::write(manifest_path, BIG_MANIFEST).expect("write to package.json");

eprintln!("Creating pnpm-lock.yaml...");
let lockfile_path = workspace.join("pnpm-lock.yaml");
fs::write(lockfile_path, BIG_LOCKFILE).expect("write to pnpm-lock.yaml");

eprintln!("Patching .npmrc...");
let npmrc_path = workspace.join(".npmrc");
OpenOptions::new()
.append(true)
.write(true)
.open(npmrc_path)
.expect("open .npmrc to append")
.write_all(b"\nlockfile=true\n")
.expect("append to .npmrc");

eprintln!("Executing command...");
pacquet.with_args(["install", "--frozen-lockfile"]).assert().success();

drop((root, mock_instance)); // cleanup
}
2 changes: 2 additions & 0 deletions crates/testing-utils/src/fixtures.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub const BIG_MANIFEST: &str = include_str!("fixtures/big/package.json");
pub const BIG_LOCKFILE: &str = include_str!("fixtures/big/pnpm-lock.yaml");
118 changes: 118 additions & 0 deletions crates/testing-utils/src/fixtures/big/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"name": "alotta-modules",
"version": "0.0.1",
"dependencies": {
"animate.less": "^2.2.0",
"autoprefixer": "^10.4.8",
"babel-core": "^6.26.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.5",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-1": "^6.24.1",
"babel-runtime": "^6.26.0",
"clean-webpack-plugin": "^4.0.0",
"core-decorators": "^0.20.0",
"css-loader": "^6.7.1",
"css-mqpacker": "^7.0.0",
"cssnano": "^5.1.13",
"custom-event-polyfill": "^1.0.7",
"draft-js": "^0.11.7",
"ejs": "^3.1.8",
"eslint": "^8.23.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.6",
"express": "^4.18.1",
"express-http-proxy": "^1.6.3",
"font-awesome": "^4.7.0",
"fready": "^1.0.0",
"glob": "^8.0.3",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-csslint": "^1.0.1",
"gulp-cssnano": "^2.1.3",
"gulp-eol": "^0.2.0",
"gulp-less": "^5.0.0",
"gulp-livereload": "^4.0.2",
"gulp-minify-css": "^1.2.4",
"gulp-postcss": "^9.0.1",
"gulp-rename": "^2.0.0",
"gulp-util": "^3.0.8",
"happypack": "^5.0.1",
"highcharts": "^10.2.1",
"highcharts-solid-gauge": "^0.1.7",
"history": "^5.3.0",
"howler": "^2.2.3",
"imports-loader": "^4.0.1",
"jquery": "^3.6.1",
"jquery-ui": "1.13.2",
"js-cookie": "^3.0.1",
"json-loader": "^0.5.7",
"leftpad": "^0.0.1",
"less": "^4.1.3",
"lesshat": "^4.1.0",
"lodash": "^4.17.21",
"medium-draft": "^0.5.18",
"mobx": "^6.6.1",
"mobx-react": "^7.5.2",
"moment": "^2.29.4",
"moment-range": "^4.0.2",
"moment-timezone": "^0.5.37",
"password-policy": "0.0.3",
"postcss-reporter": "^7.0.5",
"progress": "^2.0.3",
"qs": "^6.11.0",
"raw-loader": "^4.0.2",
"rc-slider": "^10.0.1",
"react": "^18.2.0",
"react-addons-css-transition-group": "^15.6.2",
"react-addons-shallow-compare": "^15.6.3",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.2.0",
"react-draft-wysiwyg": "^1.15.0",
"react-dropzone": "^14.2.2",
"react-grid-layout": "^1.3.4",
"react-highcharts": "^16.1.0",
"react-hot-loader": "4.13.0",
"react-input-calendar": "^0.5.4",
"react-lazyload": "^3.2.0",
"react-measure": "^2.5.2",
"react-mixin": "^5.0.0",
"react-responsive": "9.0.0-beta.10",
"react-responsive-tabs": "^4.4.3",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-select-plus": "1.0.0-rc.3.patch12",
"react-skylight": "^0.5.1",
"react-sortablejs": "^6.1.4",
"react-tappable": "^1.0.4",
"react-tooltip": "4.2.21",
"react-virtualized": "^9.22.3",
"react-waypoint": "^10.3.0",
"sortablejs": "^1.15.0",
"style-loader": "^3.3.1",
"stylelint": "^14.11.0",
"superagent": "^8.0.0",
"uglify-js": "^3.17.0",
"uuid": "^8.3.2",
"verge": "^1.10.2",
"webpack-bundle-analyzer": "^4.6.1",
"webpack-hot-middleware": "^2.25.2",
"webpack-notifier": "^1.15.0",
"webpack-split-by-path": "^2.0.0",
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"nan-as": "^1.6.1"
}
}
Loading

0 comments on commit c98128d

Please sign in to comment.