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

Ensure dependencySatisfies only considers actual dependencies (includes a fix for invalid results within monorepo scenarios) #1070

20 changes: 20 additions & 0 deletions packages/macros/tests/babel/dependency-satisfies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,25 @@ describe(`dependencySatisfies`, function () {
);
expect(runDefault(code)).toBe(true);
});

test('monorepo resolutions resolve correctly', () => {
NullVoxPopuli marked this conversation as resolved.
Show resolved Hide resolved
project = new Project('test-app', '1.0.0');
project.addDependency('@embroider/util', '*');
project.writeSync();

process.chdir(project.baseDir);

let code = transform(`
import { dependencySatisfies } from '@embroider/macros';

// specified in dependencies
export const util = dependencySatisfies('@embroider/util', '*');
// not specified as any kind of dep
export const webpack = dependencySatisfies('@embroider/webpack', '*');
`);

expect(code).toMatch(/util = true/);
expect(code).toMatch(/webpack = false/);
NullVoxPopuli marked this conversation as resolved.
Show resolved Hide resolved
});
});
});