Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: allow deep imports * fix: fix export declarations * test: fix deep-exports test Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
55 additions
and
9 deletions.
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
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
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,30 @@ | ||
const chai = require('chai'), | ||
expect = chai.expect; | ||
|
||
/** | ||
* Tests whether users can import files deeper than "sequelize" (eg. "sequelize/package.json"). | ||
* Context: https://github.com/sequelize/sequelize/issues/13787 | ||
*/ | ||
|
||
const nodeMajorVersion = Number(process.version.match(/(?<=^v)\d+/)); | ||
|
||
describe('exports', () => { | ||
it('exposes /package.json', async () => { | ||
// TODO: uncomment test once https://nodejs.org/api/esm.html#json-modules are stable | ||
// if (nodeMajorVersion >= 16) { | ||
// await import('sequelize/package.json', { | ||
// assert: { type: 'json' } | ||
// }); | ||
// } | ||
|
||
require('sequelize/package.json'); | ||
}); | ||
|
||
it('exposes lib files', async () => { | ||
if (nodeMajorVersion >= 12) { | ||
await import('sequelize/lib/model'); | ||
} | ||
|
||
require('sequelize/lib/model'); | ||
}); | ||
}); |
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
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
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
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