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

ember try:reset with workspaces #466

Closed
BarryThePenguin opened this issue Mar 12, 2020 · 1 comment · Fixed by #467
Closed

ember try:reset with workspaces #466

BarryThePenguin opened this issue Mar 12, 2020 · 1 comment · Fixed by #467
Labels

Comments

@BarryThePenguin
Copy link
Contributor

BarryThePenguin commented Mar 12, 2020

I've tried running ember try:reset within a monorepo with yarn workspaces and I'm seeing the following error

TypeError: Cannot read property 'map' of undefined
/node_modules/ember-try/lib/dependency-manager-adapters/workspace.js:90:43
/node_modules/ember-try/lib/utils/scenario-manager.js:40:25
...

It looks like this._packageAdapters is undefined?

cleanup() {
return RSVP.all(this._packageAdapters.map(adapter => adapter.cleanup()));
},

It looks like the package adapters are initialised in setup()

this._packageAdapters = workspacePaths.map(workspacePath => {
return new NpmAdapter({
cwd: workspacePath,
run: this.run,
managerOptions: this.managerOptions,
useYarnCommand: true,
buildManagerOptions: this.buildManagerOptions,
});
});

In the tests setup() is run before cleanup(), so either the tests are assuming setup() is run first and it isn't, or the package adapters should be initialised in both setup() and cleanup()?

return workspaceAdapter.setup().then(() => {
writeJSONFile('packages/test/package.json', { originalPackageJSON: false });
writeJSONFile('packages/test/node_modules/prove-it.json', { originalNodeModules: true });
return workspaceAdapter.cleanup();
}).then(() => {
assertFileContainsJSON(path.join(tmpdir, 'packages/test/package.json'), { originalPackageJSON: true });
assertFileContainsJSON(path.join(tmpdir, 'packages/test/node_modules/prove-it.json'), { originalNodeModules: true });
});
});

I can put together a PR, but I'm still figuring out what order things run in..

@rwjblue
Copy link
Member

rwjblue commented Mar 12, 2020

Should be fixed by #467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants