[ ] 무μμ΄ κ³ μ₯λ¬λμ§ μλ €μ£ΌμΈμ. μμΈν μλ‘ μ’μ΅λλ€.
μμ±νκ³ μ μ©ν ν μ무 κ²λ λ³κ²½νμ§ μμΌλ©΄ jest ν
μ€νΈ μ νκ΅°μ΄ Windowsμμ νμ μλνμ§ μμ΅λλ€.
[ ] κ°λ₯νλ©΄ λ¬Έμ λ₯Ό μ¬ννλ κ°λ¨ν μμ λ₯Ό λ§λ€κ³ μμ§, jsbin, repo λ±μ λ§ν¬λ₯Ό μ°κ²°νμΈμ. μ΄λ κ² νλ©΄ λλ²κ·ΈνκΈ°κ° ν¨μ¬ μ¬μμ§κ³ μ¬ν κ°λ₯ν μμ κ° μλ λ¬Έμ μ μ°μ μμκ° λ λμμ§λλ€.
feathers generate app
? Do you want to use JavaScript or TypeScript? JavaScript
? Project name feathers
? Description
? What folder should the source files live in? src
? Which package manager are you using (has to be installed globally)? Yarn
? What type of API are you making? (Press <space> to select, <a> to toggle all, <i> to invert selection)REST, Realtime v
ia Socket.io
? Which testing framework do you prefer? Jest
? This app uses authentication Yes
? What authentication strategies do you want to use? (See API docs for all 180+ supported oAuth providers) Username + Pa
ssword (Local)
? What is the name of the user (entity) service? users
? What kind of service is it? NeDB
? What is the database connection string? nedb://../data
yarn jest
λͺ¨λ ν μ€νΈλ νμ ν΅κ³Όν©λλ€.
λλ νμ μ΄κ²μ μ»λλ€:
\feathers\node_modules\nedb\lib\datastore.js:77
if (err) { throw err; }
^
[Error: EPERM: operation not permitted, rename 'C:\Users\stef\feathers\data\users.db~' -> 'C:\Users\stef\feathers\data\users.db'] {
errno: -4048,
code: 'EPERM',
syscall: 'rename',
path: 'C:\\Users\\stef\\feathers\\data\\users.db~',
dest: 'C:\\Users\\stef\\feathers\\data\\users.db'
}
κ·Έλ¦¬κ³ λλ‘λ ν μ€νΈκ° ν΅κ³Όνκ³ λλ‘λ κ·Έλ μ§ μμ΅λλ€ (! 30000ms μκ° μ΄κ³Όλ‘ μλνμ§λ§ λμΌν κ²°κ³Ό)
: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error:
20 | });
21 |
> 22 | it('authenticates user and creates accessToken', async () => {
| ^
23 | const { user, accessToken } = await app.service('authentication').create({
24 | strategy: 'local',
25 | ...userInfo
at new Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
at Suite.<anonymous> (test/authentication.test.js:22:5)
at Suite.<anonymous> (test/authentication.test.js:8:3)
at Object.<anonymous> (test/authentication.test.js:3:1)
Test Suites: 1 failed, 2 passed, 3 total
Tests: 1 failed, 5 passed, 6 total
Snapshots: 0 total
Time: 25.515s
NodeJS λ²μ :
v12.13.0
μ΄μ 체μ :
μλμ° 10
Ubuntuμμ λͺ κ°μ§ ν
μ€νΈλ₯Ό μ€ννλλ° λμΌν μ’
λ₯μ μμ λ¬Έμ κ° μμμ λ°κ²¬νμ΅λλ€.
λ²μΈμ μ°Ύμ κ² κ°μμ. μλ§λ νμΌμ μ¬μ©νλ NeDBμΌ κ²μ
λλ€. κ·Έλ¦¬κ³ μ§κΈ ꡬμ±λ λλ‘ λ¬΄μμ μΆ©λμ μΌμΌν€λ ν
μ€νΈλ₯Ό λ³λ ¬λ‘ μ€νν©λλ€.
--runInBand μ΅μ
μ μ¬μ©νμ¬ jestλ₯Ό μ€ννλ©΄ λ μ΄μ λ¬Έμ κ° μμ΅λλ€.
μ΄ λ¬Έμ λ λ«μ μ μμ΅λλ€.
@daffl μ΄ λ¬Έμ λ λ λ§μ μ‘°μ¬λ₯Ό μν΄ λ€μ μ΄λ €μΌ νλ€κ³ μκ°ν©λλ€.
--runInBand
μ΅μ
μ μλνμ§λ§ μ¬μ ν λμΌν λ¬Έμ κ° μμ΅λλ€.
[Error: ENOENT: no such file or directory, rename '/home/sullivan/p/gitlab.com/project/api/test/data/rides.db~' -> '/home/sullivan/p/gitlab.com/project/api/test/data/rides.db'] {
errno: -2,
code: 'ENOENT',
syscall: 'rename',
path: '/home/sullivan/p/gitlab.com/data/api/test/data/rides.db~',
dest: '/home/sullivan/p/gitlab.com/data/api/test/data/rides.db'
}
μ μ©ν μΆκ° μ 보λ₯Ό μΆκ°νκ³ μΆμ§λ§ λλ²κ·Ένλ €λ νλͺ©μ λν λͺ κ°μ§ λ¨μκ° νμν©λλ€. :+1:
GitHub Action λ¬λμ ν¨κ» Jestλ₯Ό μ¬μ©ν λλ λΉμ·ν λ¬Έμ κ° μμ΅λλ€. ν μ€νΈλ macOSκ° μ€μΉλ λ‘컬 μ»΄ν¨ν°μμ μ λλ‘ μ€νλ©λλ€. (a) λ©λͺ¨λ¦¬ λ΄ λ°μ΄ν°λ² μ΄μ€λ₯Ό μ¬μ©νκ±°λ (b) κ° ν μ€νΈμ λν΄ λμ νμΌ μ΄λ¦μ μ¬μ©νλλ‘ ν μ€νΈλ₯Ό μ λ°μ΄νΈν΄μΌ νλ€κ³ μκ°ν©λλ€. μ λ μλ²μ§ μνκ³κ° μ²μμ΄λΌ ꡬν λ°©λ²μ λͺ¨λ¦ λλ€.
μ΅μν Jestμ λν μ νλ μ§μμ λ μ λ°μνλλ‘ λ¬Έμκ° μ λ°μ΄νΈλλ©΄ μ’μ κ²μ λλ€. νν 리μΌμ΄λ Mocha μ νμ μ μνλ λ§λ²μ¬κ° μμλ κ±Έλ‘ κΈ°μ΅ν©λλ€. κ·Έλ¬λ Jestμ λν λ λ§μ κ²½νμ΄ μμΌλ―λ‘ Jestμ ν¨κ»νμ΅λλ€. λ¬Έμκ° μ μΆ©μμ λ μ μ€λͺ νλ€λ©΄ λ€λ₯Έ κ²°μ μ λ΄λ Έμ κ²μ λλ€.
μ λ°μ΄νΈ 1: https://burnedikt.com/feathers-and-nedb-for-testing/ μ λ¨κ³μ λ°λΌ λ©λͺ¨λ¦¬ λ΄ λ°μ΄ν°λ² μ΄μ€λ₯Ό μ¬μ©νλλ‘ ν μ€νΈλ₯Ό μ λ°μ΄νΈνμ΅λλ€.
μ
λ°μ΄νΈ 2: Feathers CLIλ connectionString
κ° λ¨μΌ λ¬Έμμ΄(μ: κ²½λ‘)μ΄λΌκ³ κ°μ ν©λλ€. NeDB μ§μ μλΉμ€μμ μλΉμ€ μμ±κΈ°λ₯Ό μ¬μ©νλ €λ©΄ nedb
κ° λ¬Έμμ΄μ΄ λλλ‘ config/default.json
μ λν λ³κ²½ μ¬νμ λλλ €μΌ ν©λλ€.
κ°μ₯ μ μ©ν λκΈ
Ubuntuμμ λͺ κ°μ§ ν μ€νΈλ₯Ό μ€ννλλ° λμΌν μ’ λ₯μ μμ λ¬Έμ κ° μμμ λ°κ²¬νμ΅λλ€.
λ²μΈμ μ°Ύμ κ² κ°μμ. μλ§λ νμΌμ μ¬μ©νλ NeDBμΌ κ²μ λλ€. κ·Έλ¦¬κ³ μ§κΈ ꡬμ±λ λλ‘ λ¬΄μμ μΆ©λμ μΌμΌν€λ ν μ€νΈλ₯Ό λ³λ ¬λ‘ μ€νν©λλ€.
--runInBand μ΅μ μ μ¬μ©νμ¬ jestλ₯Ό μ€ννλ©΄ λ μ΄μ λ¬Έμ κ° μμ΅λλ€.
μ΄ λ¬Έμ λ λ«μ μ μμ΅λλ€.