:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context 🇺🇦
:camera: Responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers. 🇺🇦
A Vue.js plugin for lazyload your Image or Component in your application.
A low-level toolkit to create floating elements. Tooltips, popovers, dropdowns, and more
Everyone can help and create PR
| Software | Version(s) | | ---------------- | ---------- | | typeorm-fixtures | 3.0.0 | Node | v16.14.2 | npm/Yarn | yarn 1.22.15 | Operating System | Windows 11
The lib is unable to find fixture files inside a folder in Windows beacuse glob.sync
seems not to work properly in glob 8
Workaround using yarn resolutions
:
"resolutions": {
"typeorm-fixtures-cli/**/glob": "7.2.3"
}
@kkent030315 thank you
chore(release): 3.0.2 :tada:
configure ci for multi-platform
making sure it works
configure lf eol and autocrlf in windows
remove temporally debug code
recover whitespace in the bracket
Merge pull request #205 from kkent030315/develop
ci(github actions): configure build ci for multiplatform
Linking Issues/PRs
This improves reliability by making it to be able to catch platform-specific bugs.
In the test CI of this changes in my fork repo, it clearly reproduces #203. https://github.com/kkent030315/typeorm-fixtures/actions/runs/3368028319/jobs/5586113197
Hey, I am having problems loading fixtures from a folder.
The folder ./graphql/fixtures/
actually contains .yml
but never be loaded in both CLI & Programmatically loading fixtures
📦fixtures
┗ 📜Customer.yml
> npm run fixtures load ./graphql/fixtures/ --dataSource=./dataSource.ts --sync --require=ts-node/register --require=tsconfig-paths/register
Connection to database...
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
Loading fixtureConfigs
Resolving fixtureConfigs
Progress [██████████████████████████████████████████████████] 100% | ET
Database disconnect
loadFixtures('./graphql/fixtures') // never loads any files.
But specifying the exact file just like below works. as well on the Programmatically loading fixtures.
> npm run fixtures load ./graphql/fixtures/Customer.yml --dataSource=./dataSource.ts --sync --require=ts-node/register --require=tsconfig-paths/register
loadFixtures('./graphql/fixtures/Customer.yml') // loads only "Customer.yml" file as expected.
So then I cloned this repo and tried to execute tests:
gh repo clone RobinCK/typeorm-fixtures
npm i
npm run test
Then specific tests regarding Loader, Resolver will be failed.
> typeorm-fixtures-cli@3.0.1 test
> nyc mocha "test/**/*.ts"
Builder
✔ should be build entity
✔ should be build and transformed entity
✔ should be processed entity
✔ should be call method
✔ should be processor not found
✔ should be invalid __call parameter
✔ should be resolved entity field as promised
Loader
1) should be loaded data from folder
✔ should be loaded data from file
✔ should be fail load
✔ should be no such file
2) should be invalid fixture config
Parser
✔ should be parsed object
✔ should be parsed array
✔ should be parsed deep object
✔ should be parsed deep array
✔ should parse `null` as `null`
EJS parser
✔ should be support
✔ should be not support
✔ should be parsed
Faker parser
✔ should be support
✔ should be not support
✔ should be number
✔ should be boolean
✔ should be string
✔ should be translated string
Parameter parser
✔ should be support
✔ should be not support
✔ should be parsed
✔ should be not parsed
✔ should be taken from process.env
✔ should throw on unknown env variable
✔ should prefer explicit parameters to env variables
Parameter parser
✔ should be support
✔ should be not support
✔ should be resolver
✔ should be resolver mask
✔ should be not resolver
Resolver
3) should be resolved fixtures
✔ should be resolved range fixtures
✔ should be resolved range reference
✔ should be resolved range fixtures
✔ should be resolved deep reference
✔ should be resolved mask reference
✔ should be resolved current
✔ should be resolved calculated current
✔ should be fail resolved current
✔ should be reference not found
✔ should be resolved with equal dependencies for wildcard
Fixtures Iterator
✔ should be sort and iterate fixtures
47 passing (67ms)
3 failing
1) Loader
should be loaded data from folder:
AssertionError: expected [] to have a length of 2 but got +0
+ expected - actual
-0
+2
at Context.<anonymous> (test\unit\Loader.test.ts:18:28)
at processImmediate (node:internal/timers:466:21)
2) Loader
should be invalid fixture config:
AssertionError: expected [Function] to throw an error
at Context.<anonymous> (test\unit\Loader.test.ts:94:92)
at processImmediate (node:internal/timers:466:21)
3) Resolver
should be resolved fixtures:
AssertionError: expected [] to deeply equal [ { parameters: {}, …(4) }, …(1) ]
+ expected - actual
-[]
+[
+ {
+ "data": {
+ "email": "{{internet.email}}"
+ "firstName": "{{name.firstName}}"
+ "lastName": "{{name.lastName}}"
+ }
+ "dependencies": []
+ "entity": "User"
+ "name": "user1"
+ "parameters": {}
+ }
+ {
+ "data": {
+ "description": "{{lorem.paragraphs}}"
+ "title": "{{name.title}}"
+ "user": "@user1"
+ }
+ "dependencies": [
+ "user1"
+ ]
+ "entity": "Post"
+ "name": "post1"
+ "parameters": {}
+ }
+]
at Context.<anonymous> (test\unit\Resolver.test.ts:19:32)
at processImmediate (node:internal/timers:466:21)
https://github.com/RobinCK/typeorm-fixtures/blob/86d1395daa1102d1bf210dfc4aa54c3190ea570d/src/Loader.ts#L22-L36
files
was empty array []
so this line of code is cause:
https://github.com/RobinCK/typeorm-fixtures/blob/86d1395daa1102d1bf210dfc4aa54c3190ea570d/src/Loader.ts#L33
So then, I thought something is wrong in glob and downgraded to "glob": "^7.x",
it works.
According to the glob changelog in 8.x
8.0 Only support node v12 and higher \ is now only used as an escape character, and never as a path separator in glob patterns, so that Windows users have a way to match against filenames containing literal glob pattern characters. Glob pattern paths must use forward-slashes as path separators, since \ is an escape character to match literal glob pattern characters. (8.0.2) cwd and root will always be automatically coerced to use / as path separators on Windows, as they cannot contain glob patterns anyway, and are often supplied by path.resolve() and other methods that will use \ path separators by default.
Then I made some changes, to avoid \
path separator and use /
instead:
files = glob.sync(
path
.resolve(path.join(fixturesPath, `*.{${extensions}}`))
.split(path.sep)
.join('/'),
);
The all tests passed and fixed. I'll make a PR for this issue, so I appreciate if you take a look to it. :)
| Software | Version(s) | | ---------------- | ---------- | | typeorm-fixtures | 3.0.1 | | Node | v16.14.2 | | npm/Yarn | npm | | Operating System | Windows 11 |
Path passed to glob.sync must explicitly use /
instead of \
in Windows environment due to glob 7.x -> 8.x changes as described in the issue.
fix: glob path separator must use '/' on Windows (#203)
path passed to glob.sync must explicitly use '/' instead of '' due to glob 7.x -> 8.x changes.
FIX #203
Merge pull request #204 from kkent030315/fixglob
fix: glob path separator must use '/' on Windows