-
-
Notifications
You must be signed in to change notification settings - Fork 652
feat: add support for installing specific versions of packages #4878
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
base: 6.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,32 @@ test.group('Install', (group) => { | |
assert.deepEqual(pkgJson.devDependencies, { test: 'file:node_modules/foo' }) | ||
}) | ||
|
||
test('should install specific version of dependency', async ({ assert, fs }) => { | ||
const ace = await new AceFactory().make(fs.baseUrl, { | ||
importer: (filePath) => import(join(filePath, `index.js?${Math.random()}`)), | ||
}) | ||
|
||
await setupProject(fs, 'npm') | ||
await setupPackage(fs) | ||
|
||
const packageVersion = await fs.contentsJson('package.json') | ||
console.log({ packageVersion }) | ||
Comment on lines
+184
to
+185
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was me trying to grab the root package.json so I could just use an already installed package at it's installed version, but uh, that doesn't work due to scoping of the filesystem β I'd probably have to do something different. Idea was to use like the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can read it manually using the |
||
|
||
await ace.app.init() | ||
|
||
ace.addLoader(new ListLoader([Configure])) | ||
ace.ui.switchMode('raw') | ||
ace.prompt.trap('install').accept() | ||
|
||
const command = await ace.create(Add, [new URL('node_modules/foo', fs.baseUrl).href, 'latest']) | ||
command.verbose = true | ||
|
||
await command.exec() | ||
|
||
const pkgJson = await fs.contentsJson('package.json') | ||
assert.deepEqual(pkgJson.devDependencies, { test: 'file:node_modules/foo' }) | ||
}) | ||
|
||
test('pass unknown args to configure', async ({ fs, assert }) => { | ||
const ace = await new AceFactory().make(fs.baseUrl, { | ||
importer: (filePath) => import(join(filePath, `index.js?${Math.random()}`)), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for the packages that are filesystem based installs, like those used in the tests. Really the actual installation should probably be mocked out in most of the tests, since we can probably assume that
installPackage
does its thing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason we don't mock is, because we have been bitten in the past with the
install-pkg
package. They swapped the underlying fetch library that had different timeout settings and suddenly all installations taking longer than x timeout started failing.