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

Fix: tests, resolve importSync module resolution issue #2190

Draft
wants to merge 3 commits into
base: v2-addon-type-module-macros-resolve-build
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/macros/tests/babel/import-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('importSync', function () {
import { importSync } from '@embroider/macros';
importSync('foo');
`);
expect(code).toMatch(/import esc from "\.\.\/\.\.\/src\/addon\/es-compat2"/);
expect(code).toMatch(/import esc from "\.\.\/\.\.\/src\/addon\/es-compat2\.js"/);
expect(code).toMatch(/esc\(require\(['"]foo['"]\)\)/);
expect(code).not.toMatch(/window/);
});
Expand All @@ -31,7 +31,7 @@ describe('importSync', function () {
import { importSync as i } from '@embroider/macros';
i('foo');
`);
expect(code).toMatch(/require\(['"]foo['"]\)/);
MehulKChaudhari marked this conversation as resolved.
Show resolved Hide resolved
expect(code).toMatch(/require\(['"]foo['"]\)\)/);
expect(code).not.toMatch(/window/);
});
test('import of importSync itself gets removed', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/v2-addon-type-module-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ appScenarios
addon.pkg.exports = {
'./*': './src/*.js',
'./addon-main.cjs': './addon-main.cjs',
'./side-effecting.js': './src/side-effecting.js'
};
addon.pkg['ember-addon'].main = 'addon-main.cjs';

Expand All @@ -32,8 +33,7 @@ appScenarios
*/
'demo.js': `
import { importSync } from '@embroider/macros';

importSync('./side-effecting.js');
MehulKChaudhari marked this conversation as resolved.
Show resolved Hide resolved
importSync('v2-addon/side-effecting.js');
`,
},
});
Expand Down