-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test and fixture * Fix cannot find module issue createRequire expects a path to a filename (or URL). When using cwd() it assumes the last directory is a filename and the require will be based upon the wrong directory (1 level up).
- Loading branch information
Showing
4 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/plugin-helpers': patch | ||
--- | ||
|
||
Fix module not found bug in resolveExternalModuleAndFn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/utils/plugins-helpers/tests/fixtures/externalModuleFn.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.test = 'foobar'; |
11 changes: 11 additions & 0 deletions
11
packages/utils/plugins-helpers/tests/resolve-external-module-and-fn.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import path from 'path'; | ||
import { resolveExternalModuleAndFn } from '../src/resolve-external-module-and-fn'; | ||
|
||
describe.only('resolveExternalModuleAndFn', () => { | ||
describe('Issues', () => { | ||
it('#6553 - Cannot find module', () => { | ||
const relativePathToSelf = path.relative(process.cwd(), path.join(__dirname, './fixtures/externalModuleFn.js')); | ||
expect(resolveExternalModuleAndFn('./' + relativePathToSelf + '#test')).toBe('foobar'); | ||
}); | ||
}); | ||
}); |